A sample project to demonstrate load testing a python flask web application with Apache JMeter.
To get started, simply:
-
In your terminal, clone this repository, and run the sample server
git clone git@github.com:ChrisCarini/sample-load-test-apache-jmeter.git cd sample-load-test-apache-jmeter source setup.sh gunicorn -w 8 -b 127.0.0.1:5000 "webapp:create_app()" --access-logfile -
-
Download Apache JMeter (as of publishing, version 5.4.1 is the latest - this sample assumes you are using that version.)
- Note: If you use
brew
on macOS, you can install viabrew install jmeter
.
- Note: If you use
-
Start JMeter in your terminal:
jmeter
(This should launch the Apache JMeter GUI.) -
Install the
Throughput Shaping Timer
a) In Apache JMeter, selectOptions
, thenPlugin Manager
a) Click onAvailable Plugins
, then search forThroughput Shaping Timer
. Select it (click the checkbox), and ClickApply Changes and Restart JMeter
. -
In Apache JMeter, open the
test_fast_endpoint.jmx
file. Make the needed configuration changes - see the " configuration tips" section below.
- Read "How Many Threads I Need To Produce Desired RPS?"; configure the threads accordingly.
- Change the protocol, domain/IP, port number under the
HTTP Request Defaults
config element. - Change the HTTP Request type and Path under the
HTTP GET /fast
config element. - Change the HTTP headers under the
HTTP Header Manager
config element. - Change the desired QPS / RPS under the
Throughput Shaping Timer
config element.
- Apache JMeter
- Apache JMeter - Download
- Apache JMeter - Throughput Shaping Timer (plugin used for
scaling throughput tests)
- NOTE: This page has information on calculating "How Many Threads I Need To Produce Desired RPS?". I recommend reading this to identify how many threads you should configure!
- https://stackoverflow.com/questions/16854986/jmeter-testing-multiple-urls
- https://sqa.stackexchange.com/questions/20831/how-to-load-100-urls-as-http-request-in-jmeter
- https://www.blazemeter.com/blog/jmeter-parameterization-the-complete-guide
- https://www.blazemeter.com/blog/csv-data-set-config-in-sharing-mode-made-easy
- https://www.linkedin.com/pulse/apache-jmeter-basics-common-errors-issues-best-practices-prasad/
- https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html
- https://jmeter.apache.org/usermanual/best-practices.html