How to Simulate Different Network Speeds for Mobile Apps and Websites Using JMeter
This article explains how to use JMeter to limit output bandwidth by configuring httpclient.socket.http.cps and httpclient.socket.https.cps, enabling realistic simulation of various mobile network speeds such as GPRS, 3G, 4G, Wi‑Fi, and Ethernet, and shows how to apply these settings via user.properties or command‑line parameters.
In most cases, mobile device users access the Internet through their cellular carrier networks, which vary in coverage and connection speed; therefore, it is essential to ensure that websites or applications can handle different mobile and tablet network speeds.
This article demonstrates how to control the simulated virtual users' bandwidth in JMeter load testing to achieve this.
By default, JMeter sends requests as quickly as possible, which is useful for generating load but unrealistic because real users pause between actions and are limited by network bandwidth.
Limit output bandwidth to simulate different network speeds
JMeter provides options to limit output bandwidth using two properties:
httpclient.socket.http.cps = 0
httpclient.socket.https.cps = 0These properties apply to the HTTP and HTTPS protocols respectively; a value of 0 means no limit. The acronym cps stands for “characters per second”. Setting a value greater than zero adjusts the bandwidth accordingly.
The formula for calculating cps is:
cps = (target bandwidth in kbps * 1024) / 8
For example, to simulate GPRS downlink speed of 171 Kbits/s, the corresponding CPS value is 21888 (171 * 1024 / 8).
Add these two lines to the user.properties file (found in JMeter’s bin folder)
httpclient.socket.http.cps = 21888
httpclient.socket.https.cps = 21888Restart JMeter for the configuration to take effect.
Pass property values via the -J command‑line parameter
Example command:
jmeter -Jhttpclient.socket.http.cps=21888 -Jhttpclient.socket.https.cps=21888 -t /path/to/your/testplan.jmx
Some popular bandwidth presets:
Bandwidth
cps value
GPRS
21888
3G
2688000
4G
19200000
WIFI 802.11a/g
6912000
ADSL
1024000
100 Mb LAN
12800000
Gigabit NIC
128000000
The article also lists additional JMeter topics and resources for further learning.
FunTester
10k followers, 1k articles | completely useless
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.