How to simulate network bandwidth in JMeter?

The rise of the smartphone and easy connectivity to the internet has made access to information easier with most of them accessing websites and web applications from their smartphones.

As a performance engineer, I would like to run my load test on different network speeds like 1 mbps, 4 mpbs, 16 mbps and so on to ensure the app performance.

Why it is needed?

Day by day, mobile traffic over desktop traffic is growing, there is a need to focus on mobile users for performance testing. hence, it is very important to watch how good we are at mobile else it could be lose to 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.

So it’s time to Throttle Outgoing Bandwidth to Simulate Different Network Speeds.

By default, Jmeter will send the requests to the target server as fast as it can.

Throttling Outgoing Bandwidth to Simulate Different Network Speeds

JMeter has capability to throttle the outgoing bandwidth in order to have different network speed and to achieve that follow the below mentioned steps:

1. Open file located in /bin folder of JMeter

Simulate Network Speed in JMeter
‘’ file

2. Search for keyword “cps”

Simulate Network Speed in JMeter
Figure 02: Search with ‘cps’ keyword

3. If you search using “cps” then you will get two properties:

  • httpclient.socket.http.cps=0
  • httpclient.socket.https.cps=0

Remove “#” to enable the properties

Simulate Network Speed in JMeter
Remove ‘#’

The first property simulates the speed when you use HTTP method (protocol) and the second property is used to simulate the speed for HTTPS method.

4. Calculate the value using below formula

CPS = RB * 128

CPS = Characters per second
RB = Required Bandwidth that you need to set for the load test. The input value of required bandwidth should be in kbps.

Simulate Network Speed in JMeter
Calculate and insert the value for CPS (say 64000)

5. Save and close the file. Restart JMeter

Calculating cps value
  • Example if you want to simulate 1000 kbps speed for the test then
    cps = 10000 * 128
    cps = 128000

Note: You need to use the HTTPClient3.1 or HTTPClient4 implementation to be able to adjust the JMeter bandwidth.HTTP Request Defaults is the fastest and easiest way to implement all HTTP Request samplers

If you want to set a bandwidth while executing in non GUI mode, below command can be useful .

jmeter -Jhttpclient.socket.http.cps=<cps value> -n -t <path of .jmx>

Points to remember: 

  • Check the testing environment network bandwidth (where the test to be conducted) before simulating the speed. Because JMeter can only simulate the bandwidth equal to or less than the testing environment network bandwidth.
  • Use RB (Required Bandwidth) value in kbps for CPS calculation.  
  • In a distributed mode, you can set a different bandwidth for each remote engine by specifying your desired ‘cps’ value in the file to run the test cases.


Categories: Uncategorized

Tagged as:

6 replies »

  1. Hi Small update in the command.
    please update you command with “J” just before -httpclient.socket.http.cps=.
    like – jmeter -Jhttpclient.socket.http.cps= -n -t

  2. Hi, The bandwidth settings mentioned here, is it applicable for each thread/thread group? ex: If I give CPS as 21888 and run a test of 100 users, how it works?

    • It is applicable to whole thread group ( no of ussers) and all users will use this bandwidth.In your case 100 user loaded would be tested for 21888 CPS .

      • Thanks team for the reply. We have one scenario , need to execute a 100 concurrent user load test and each virtual user internet upload speed is 2 Mbps . so what is the cps value in the file. whether cps value is setting on each virtual user level or for all the virtual user

        Option 1 ( 2 Mbps = 256000 cps)

        Option 2 ( 2 Mbps *100 concurrent user = 25600000 cps)

Leave a Reply