Breaking the Kubernetes Kill Chain: Host Path Mount
12 Steps to API Load Testing with Apache JMeter
1. 12 Steps to API Load
Testing with Apache
JMeter
Dmitry Sotnikov
VP, Cloud at WSO2
2. Apache JMeter and API load testing
● Apache JMeter™ is a popular free, open source software, designed
to load test functional behavior and measure performance
● It was originally designed for testing Web applications but has
since expanded to other test functions
● Load-testing your APIs allow you to know in advance what kind of
load from subscribers and applications your gateway can sustain
3. Action Plan
● Set up API and install Apache JMeter
● Create the test plan and call request
● Add listener to collect results
● Test single call and then scale up
● Do multiaccount and distributed testing
This presentation will guide you through these steps in detail
4. 1. Publish your API and subscribe
to it
● If using WSO2 API Cloud, get yourself a free trial and follow these
tutorials:
5. 2. Download and launch JMeter
1. Download from: http://jmeter.apache.org/download_jmeter.cgi
2. Unzip the package
3. Start Apache JMeter:
○ sh jmeter.sh on Linux or Mac
○ jmeter.bat on Windows.
6. 3. Add your test
● Right click the Test Plan node and click the Add / Threads (Users) /
Thread Group on the shortcut menu:
7. 4. Add API call request
● Right click the Thread Group and click the Add / Sampler / HTTP
Request on the shortcut menu:
8. 5. Copy over server name and path
● Invoke API in API store’s API console and copy over Server Name
and Path to HTTP Request in JMeter:
9. 6. Add authorization header
1. Right click the HTTP Request
node and, on the shortcut
menu, click Add / Config
Element / HTTP Header
Manager
2. In the HTTP Header Manager,
click the Add button. A new
row will get added to the table
of Headers Stored in the
Header Manager
3. Set Name to Authorization
4. And copy the Bearer part from
API Console
10. 7. Add listener to see results
● Right click the Thread Group node and, on the shortcut menu, click
Add / Listener / View Results Tree:
11. 8. Test the API
● Click the Run button and verify that the API call was successful. If
prompted to save the configuration, do so.
12. 9. Increase the load
● To be able to test at larger load, go back to the Thread Group node,
and increase the Number of Threads and Loop Count:
13. 10. See when and why calls fail
● Check out the Response data tab
to see why
● Limits imposed by Subscription
Tier you set for the API (e.g. 20
calls / minute) result in “You have
exceeded your quota”
● Limits based on your API Cloud
subscription level lead to “Your
request was blocked due to
exceeding the allocated quota.
Please contact the API Store
owner to resolve this.”
14. 11. (Optional) Simulate more
subscribers
1. Create another subscriber account or another application in API
Cloud
2. Subscribe to the API
3. Create another HTTP request in Apache JMeter with this new
application’s authorization header
15. 12. (Optional) Distributed load
1. Deploy Apache JMeter on multiple machines
2. Copy the saved test plan
3. Run the following command line or the corresponding .bat
command on Windows:
sh jmeter.sh -n -t TestPlan.jmx -l Test1.jtl
where -t specifies the saved Test Plan file and -l specifies the output
file for the responses
16. API Management Options on the Market
Hosted Service:
WSO2 API Cloud free trial at :
● http://wso2.com/cloud/api-cloud
Open Source:
WSO2 API Manager free download at :
● http://wso2.com/api-management/try-it/