Local Network Simulation On JMeter
For the recent years, mobile had overtaken desktop traffic. It seems that this trend will continue to rise. But does it change in our lives? That means that our users are on the move. They are not sitting in their comfortable chairs and take benefit of great DSL network speeds.
In most cases, mobile device users access the internet via their cellular operator network. The speed, reliability varies depending on the location of the user. You’ll realize that it’s always changing. That means speed varies mostly during the day. So we need to make sure that websites or mobile application work on every condition without affecting the user experience with functional and non-functional aspects in different internet connection speeds.
How to Simulate Different Network Speeds?
By default, JMeter sends all requests defined in a Test Plan as fast as it could, depending on the local computer that you are working on. This is incredibly important for producing the load effectively but from a user side, it is not very realistic. As real users don’t send requests to the server without taking a breath, they also spend some time to think between any operations. Besides that, mobile users have limited network bandwidth and that limits them to make requests at the slower speed. So mobile performance testing scripts should mimic the network type.
In your jmeter.properties file, there are two properties that define the bandwidth type that you use during your performance tests. Those properties are
httpclient.socket.http.cps=0
httpclient.socket.https.cps=0
One is for HTTP, the other one is for HTTPS requests. CPS stands for “Character per second”. When all those values are set to zero, it means there is no limit. No limit means no waiting. When those values are set to some other value, it means that the bandwidth throttle according to the value that you specified.
CPS Calculation Formula is:
cps = (target bandwidth in kbps * 1024) / 8
For example: to emulate the Mobile EDGE cellular network speed (which is 384 Kbits/second downstream), the relevant CPS value would be: 49152 (384 * 1024 / 8)
Then go to your jmeter.properties file and set the cps values.
httpclient.socket.http.cps=21888
httpclient.socket.https.cps=21888
In case you don’t want to mess up with all those setting files, you can use the command line to manipulate those values on runtime. Below is the command for it.
jmeter -Jhttpclient.socket.http.cps=21888 -Jhttpclient.socket.https.cps=21888 -t /performancescript.jmx
Here are some popular bandwidth presets:
Bandwidth | cps Value |
Mobile data GPRS : 171 kbit/s | 21888 |
Mobile data EDGE : 384 kbit/s | 49152 |
Mobile data HSPA : 14,4 Mbp/s | 1843200 |
Mobile data HSPA+ : 21 Mbp/s | 2688000 |
Mobile data DC-HSPA+ : 42 Mbps | 5376000 |
Mobile data LTE : 150 Mbp/s | 19200000 |
WIFI 802.11a/g : 54 Mbit/s | 6912000 |
Loadium allows you to manipulate those values before the test run.
You can set different bandwidth type for all the engines. So you can create a realistic load with the different type of bandwidth usage. Don’t forget that this kind of configurations are very useful when it comes to testing Black Friday, Cyber Monday scenarios.
Happy testing!
Getting Started with LoadiumJMeter TestPricingIf you don't see the answer to your question here, please reach out to us to let us know! We're always improving our documentation.
Last updated