Skip to content

Instantly share code, notes, and snippets.

@mhausenblas
Created July 9, 2019 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhausenblas/ab076a34343d1fcfed77326a690c99e2 to your computer and use it in GitHub Desktop.
Save mhausenblas/ab076a34343d1fcfed77326a690c99e2 to your computer and use it in GitHub Desktop.
Load generator scripts for NGINX services in ECS and EKS
#!/bin/bash
################################################################################
# Generate load for the NGINXs services in ECS
nginxurls=$(ecs-cli ps --desired-status RUNNING | grep nginx | awk '{ split($3, url, "-") ; print(url[1]) }')
while true
do
printf "Hit "
for nginxurl in $nginxurls
do
curl -s $nginxurl > /dev/null
printf "$nginxurl "
done
printf "\n"
sleep 2
done
#!/bin/bash
################################################################################
# Generate load for the NGINXs services in EKS
# make sure to patch to LB
kubectl patch svc nginx -p '{"spec": {"type": "LoadBalancer"}}'
# give the LB 3 minutes to be up and running
echo "Now waiting for 3min until the load balancer is up ..."
sleep 180
echo "Starting to hammer the load balancer:"
nginxurl=$(kubectl get svc/nginx -o json | jq .status.loadBalancer.ingress[].hostname -r)
while true
do
printf "Hit "
curl -s $nginxurl > /dev/null
printf "$nginxurl "
printf "\n"
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment