Load testing and scaling
In this part, we will generate random workloads to see how Lambda acts when incoming requests increase. To achieve that, we will use a load-testing tool, such as Apache Bench. In this chapter, I will be using hey
, which is a Go-based tool, and is very efficient and faster than classic HTTP
benchmarking tools due to Golang's built-in concurrency. You can download it by installing the following Go
package from your terminal:
go get -u github.com/rakyll/hey
Note
Be sure that the $GOPATH
variable is set to be able to execute the hey
command regardless of your current directory, or you can add the $HOME/go/bin
folder to the $PATH
variable.
Lambda autoscaling
Now, we are ready to run our first harness or load testing by executing the following command:
hey -n 1000 -c 50 https://51cxzthvma.execute-api.us-east-1.amazonaws.com/staging/movies
Note
If you prefer apache benchmark, the same command can be used by replacing the hey keyword with ab.
The command will open 50 connections...