# 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](https://loadium.com/blog/websocket-with-apache-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](https://loadium.com/blog/performance-testing-terminology/) 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](https://loadium.com/blog/tag/performance-testing/). 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](https://loadium.com/blog/functional-testing-with-loadium-apache-jmeter/) allows you to manipulate those values before the test run.

<figure><img src="https://33973752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUOy4kHWrKkuqX5mhH7%2Fuploads%2F0GrwCfSqW8NvwJ9t6JPE%2Fimage.png?alt=media&#x26;token=a6ce9ac0-f4d8-4ff6-ae6f-00fe2334195a" alt=""><figcaption></figcaption></figure>

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](https://loadium.com/blog/functional-testing-with-loadium-apache-jmeter/) Black Friday, Cyber Monday scenarios.

<figure><img src="https://33973752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUOy4kHWrKkuqX5mhH7%2Fuploads%2FJjQhwIsqrpFZeAQ1domd%2Fimage.png?alt=media&#x26;token=c405a1c5-9270-4348-999e-2c92bb63256f" alt=""><figcaption><p>Available Bandwith Configurations</p></figcaption></figure>

Happy testing!

{% content-ref url="../getting-started" %}
[getting-started](https://wiki.loadium.com/getting-started)
{% endcontent-ref %}

{% content-ref url="../create-test/jmeter-test" %}
[jmeter-test](https://wiki.loadium.com/create-test/jmeter-test)
{% endcontent-ref %}

{% content-ref url="../about-loadium/pricing" %}
[pricing](https://wiki.loadium.com/about-loadium/pricing)
{% endcontent-ref %}

If you don't see the answer to your question here, please [reach out to us](https://loadium.com/contact-us/) to let us know! We're always improving our documentation.
