<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">

How to simulate network bandwidth in JMeter?

Kishore Bhamare Jan 07, 2019

apache JMeter Apache 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.

The performance of these mobile sites could vary depending on the fluctuations in the networks. Very often users face issue while accessing the web application on their mobile devices. This is the reason why telecom network related scenarios should be taken into consideration while doing performance testing where different network bandwidths are tested.

In Apache JMeter, we can simulate network bandwidth very easily.

Following are the steps to simulate network bandwidth:

  • Open ‘jmeter.properties’ file in notepad (location: apache-jmeter/bin)

  • Search ‘cps’ (characters per second) you will find
    • Define characters per second > 0 to emulate slow connections
    • #httpclient.socket.http.cps=0
    • #httpclient.socket.https.cps=0
  • Change cps value as per your need
    cps = rb*128 (rb= Required Bandwidth)
    Network 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
    WIFI 802.11n : 600 Mbit/s 76800000
    Ethernet LAN ; 10 Mbit/s 1280000
    Fast Ethernet : 100 Mbit/s 12800000
    Gigabit Ethernet : 1 Gbit/s 128000000
    10 Gigabit Ethernet : 10 Gbit/s 1280000000
    100 Gigabit Ethernet : 100 Gbit/s 12800000000
    WAN modems V.92 modems : 56 kbit/s 7168
    ADSL : 8 Mbit/s 1024000
    ADSL2 : 12 Mbit/s 1536000
    ADSL2+ : 24 Mbit/s 3072000

  • Save the file and restart JMeter
  • Example if you want to simulate 1000 kbps speed for the test then
    cps = 10000 * 128
    cps = 128000

If you want to set a bandwidth while executing in non GUI mode, below command can be useful - jmeter -httpclient.socket.http.cps=<cps value> -n -t <path of .jmx>

In a distributed mode, you can set a different bandwidth for each remote engine by specifying your desired ‘cps’ value in the user.properties file to run the test cases.

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.