Skip to content

Instantly share code, notes, and snippets.

@mhausenblas
Created July 9, 2019 14:02
Show Gist options
  • Select an option

  • Save mhausenblas/ab076a34343d1fcfed77326a690c99e2 to your computer and use it in GitHub Desktop.

Select an option

Save mhausenblas/ab076a34343d1fcfed77326a690c99e2 to your computer and use it in GitHub Desktop.

Revisions

  1. mhausenblas created this gist Jul 9, 2019.
    17 changes: 17 additions & 0 deletions load-gen-ecs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/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
    23 changes: 23 additions & 0 deletions load-gen-eks.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/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