-
Notifications
You must be signed in to change notification settings - Fork 5
Load Testing
Rafael edited this page Mar 30, 2017
·
2 revisions
- To gather data on the application's behavior under low, medium, and high load.
- Using Siege to send requests to local, staging, and production environments. Siege is a command line script that can benchmark/load test any web application by sending large amounts of requests in many different configurations as needed.
- Install brew
- Follow instructions in the link
- Install and have Gambit up and running
-
IMPORTANT: set
MOBILECOMMONS_DISABLED=true
inside your.env
file to prevent sending an SMS message on each request.
-
IMPORTANT: set
- Install Siege
brew install siege
We need to setup a baseline. It can easily be done by analyzing metrics in Heroku and/or New Relic. This data will give us an idea of what normal load looks like and will form the basis to define load (requests/min).
siege --header 'x-gambit-api-key:<API KEY GOES HERE>' --header 'Content-Type:application/x-www-form-urlencoded' 'http://localhost:5000/v1/chatbot/ POST phone=5550000001&profile_id=5550000001&args=TACOS' -c64 -t60s -d1
This command is going to attempt to spawn 64 concurrent requests (-c64) for a time period of 60 seconds (-t60s) with a delay of 1 second between request (-d1)
Result
Transactions: 173 hits
Availability: 95.58 %
Elapsed time: 59.49 secs
Data transferred: 0.03 MB
Response time: 19.69 secs
Transaction rate: 2.91 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 57.26
Successful transactions: 173
Failed transactions: 8
Longest transaction: 30.28 secs
Shortest transaction: 13.64 secs
siege --header 'x-gambit-api-key:<API KEY GOES HERE>' --header 'Content-Type:application/x-www-form-urlencoded' -f urls.txt -c1 -r 500
This command reads a
\r\n
delimited file namedurls.txt
that has 500 URLs. Each URL is of the form:http://localhost:5000/v1/chatbot/ POST phone=5550002400&profile_id=495&keyword=TACOS
. This command will mimic the response of hundreds of users after a broadcast.
Result
Transactions: 500 hits
Availability: 100 %
Elapsed time: 1761.86 secs
Data transferred: 0.17 MB
Response time: 3.27 secs
Transaction rate: 0.28 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.93
Successful transactions: 500
Failed transactions: 0
Longest transaction: 16.14 secs
Shortest transaction: 1.28 secs