How to Perform Load Testing Using JMeter with different Network Speed?
With the sudden rise in mobile traffic over desktop traffic, there is a need to focus on mobile users for performance testing. With the trend expected to rise, if the application doesn’t perform well, one can lose a lot of business.
Mobile web traffic comprises users with different connection speeds. So, it is very important to perform load testing on mobile apps with different connection speeds. In the case of mobile, user access the internet mainly through their cellular operator network. Moreover, the connection speed might vary depending upon their exact location. It is therefore required to ensure application functionalities on mobile and tablets with varying internet speed.
One of the ways to do this is to control the bandwidth of simulated virtual users in JMeter. JMeter sends Samplers request by default on a regular basis. However, it is not very realistic, as a user interaction with the server is not a continuous process. In addition, the process could further slowdown due to limited network bandwidth.
The other option to simulate different network speeds is to throttle outgoing bandwidth. This can be done in JMeter using these properties:
You can use these properties to limit the bandwidth in following ways:
- In the bin folder of your JMeter installation, open the user.properties file and add these two lines and restart JMeter.
- You can also pass the properties value using –J command line argument.
jmeter -Jhttpclient.socket.http.cps=21888 -Jhttpclient.socket.https.cps=21888 -t /path/to/your/testplan.jmx
Now, to check it, you can create a simple test plan with 100 virtual users and 100 iterations. In addition, include HTTP request that sends GET method to static HTML page along with an aggregate report listener. You will notice different results with full LAN speed and limited bandwidth.
Tips and Best Practices
- In order to adjust the JMeter bandwidth, you can either use HTTPClient3.1 or HTTPClient4 implementation.
- The fastest way to implement all HTTP request samplers is through the HTTP Request Defaults.
- In distributed mode, set different bandwidth for each remote engine by mentioning the cps (characters per second) value.
You may also like: Top Five Features of a Cloud-Based Load Testing Tool