-
-
Save afzaale01/dbf5e70f320c04d41f680f1e37e97a3f to your computer and use it in GitHub Desktop.
Load testing example using Apache Bench (ab) to POST JSON to an API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shoot off 300 requests at the server, with a concurrency level of 10, to test the number of requests it can handle per second | |
# -p POST | |
# -H Authentication headers | |
# -T Content-Type | |
# -c Concurrent clients | |
# -n Number of requests to run | |
# -l Accept variable document length | |
# -k Connection keep-alive | |
# -v Verbosity level | |
nohup ab -p transaction.txt -T application/json -H 'Accept: application/json' -H 'Authorization: Basic SoMEtoKEN==' -H "Cookie: My_Session=AnOTheRTOken" -c 10 -n 300 -l -k -v 2 http://my.staging.server.com/api/v1/portfolios/123456/transactions > transaction_post_results.txt & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"position" : { | |
"id" : 123456 | |
}, | |
"currency" : { | |
"id": 123456, | |
"code":"INR" | |
}, | |
"type": "buy", | |
"share": 10, | |
"price": 10, | |
"transactionDate": "1995-01-01" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment