How to script a load test scenario in Jmeter that resembles a typical day load on a Order Management
- Sarath Babu V S

- Oct 29, 2020
- 2 min read
Load testing a Order Management/Ecommerce system is a typical testing activity that a company in this space would carry out and is a critical one.
The challenge lies in scripting the scenario the way the test matches real world usage
This blog documents the approach taken to simulate the customer usage pattern by combining several Jmeter features
Step 1: Gather the typical usage pattern of the system
Based on historical usage pattern and predictions on how the system would be used in future, below usage was arrived at:
1. No. of users actively pushing orders to the system: 200
2. Average no. of orders created per min is 500, with spurts of 1000 in between. Below chart shows a typical case for 1 hr duration

3. Orders would have line items varying between 1 to 10. That is, some orders would have only 1 item, while others could have 10 items in it
4. Based on past history, the distribution of orders with specific lines was calculated. Ex: 6% of created orders would be of 1 line, 10% of created orders would be 2 lines,…, 5% of orders would be of 10 lines
5. Items to be used in the order – this had to be spread across popularly bought items; that is, the items should not be same in all orders
Step 2: Creating a Jmeter script that satisfies conditions in step 1
1. Below set of thread groups was created to create necessary load for specific duration

First thread group creates 500 orders for a duration of 11 min and then second thread group creates 1000 orders for 1 min and so on to match the graph
2. Thread group configuration with 200 users and specific duration to run
Below example shows configuration for thread group 1

3. Each thread group was setup as below

· HTTP request defaults – has details about protocol and server name/ip address
· HTTP Cache and Cookie manager – to simulate browser behaviour on caching and cookie usage
· Items from CSV – uses CSV Data Set config to read Items from CSV to be used during order creation. CSV has the list of popularly bought items
· PreProcessor – used to generate necessary unique/random values
· Throughput Controller – used to create the necessary % of orders for each line
Ex: First Throughput Controller has Throughput set to 6.0 to match 6% of orders of 1 lines to be created

Second Throughput Controller has Throughput set to 10.0 to match 10% of orders of 2 lines to be created

· Constant Throughput Timer – sets the necessary load to be generated. First thread group has to generate 500 orders per min. Hence, below are the configuration

Step 3: Script execution and viewing the results
Above script was executed in the identified environment and “jp@gc - Transactions per Second” graph depicted the load pattern that we wanted to generate

Conclusion:
By using various Jmeter features/plug-ins, a typical load scenario on a Order Management/Ecommerce system was executed successfully

Comments