Stimulate 2G, 3G , 4G network speed on Jmeter

How To stimulate different networks (2G, 3G ,4G, wifi , ethernet ) on Jmeter


Jmeter gives you the option to stimulate different network speeds (2G, 3G ,4G ,wifi , Ethernet) based on your requirement .

1. Open bin folder of jmeter and search for user.properties file


2. Add the below code to your user.properties file

   #Default
   httpclient.socket.http.cps=0
   httpclient.socket.https.cps=0

   #2G network 
   httpclient.socket.http.cps=21888
   httpclient.socket.https.cps=21888

   #EDGE network 
   httpclient.socket.http.cps= 49152
   httpclient.socket.https.cps= 49152

   #3G network 
   httpclient.socket.http.cps= 256000
   httpclient.socket.https.cps= 256000

   #4G network 
   httpclient.socket.http.cps=21888
   httpclient.socket.https.cps=21888


    
3.  Restart  jmeter

By default its value is set to zero which means it can allow maximum traffic and with no limitation.

Here’s the formula of calculating “cps”:

cps = (target bandwidth in kbps * 1024) / 8

For example: to emulate the GPRS cellular network speed (which is 171 Kbits/second downstream), the relevant CPS value would be: 21888  (171 * 1024/8)


To stimulate 2G  network , 

Maximum network speed = 35 Kbits/sec downstream
the relevant CPS value would be: 4480  (35 * 1024/8)

minimum network speed = 171 Kbits/sec downstream
the relevant CPS value would be: 21888  (171 * 1024/8)


To stimulate EDGE network ,

Maximum network speed = 120 Kbits/sec downstream
the relevant CPS value would be: 15360  (120* 1024/8)

minimum network speed = 384 Kbits/sec downstream
the relevant CPS value would be: 49152  (384 * 1024/8)

To stimulate 3G network ,

Minimum network speed = 384 Kbits/sec downstream
the relevant CPS value would be: 49152  (384* 1024/8)

Maximum network speed = 2000 Kbits/sec downstream
the relevant CPS value would be: 256000  (2000 * 1024/8)

To stimulate 4G network ,

Minimum network speed = 3000 Kbits/sec downstream
the relevant CPS value would be: 384000  (3000* 1024/8)

Maximum network speed = 10000 Kbits/sec downstream
the relevant CPS value would be:1280000  (10000 * 1024/8)

To stimulate WIFI 802.11a/g  ,

The relevant CPS value would be:1280000 

To stimulate WIFI 802.11a/g  ,

The relevant CPS value would be:6912000 

To stimulate ADSL  ,

The relevant CPS value would be:1024000

To stimulate 100MB Lan ,

The relevant CPS value would be:12800000

2. Alternatively, you can pass the properties’ values via the -  J command line argument, like this:

jmeter -Jhttpclient.socket.http.cps=21888 -Jhttpclient.socket.https.cps=21888 -t /path/to/your/testplan.jmx

Comments

Popular posts from this blog

ADD EMPTY HEADER IN JMETER SAMPLE REQUEST

How To Automate Rest API in Postman

Constructing Curl from Python , HTTP , PHP , Java Request