# 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="/files/YJGkFmpsJubel6ymotKc" 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="/files/7pjXhSlTj8t7yLeGiruv" alt=""><figcaption><p>Available Bandwith Configurations</p></figcaption></figure>

Happy testing!

{% content-ref url="/pages/-MUQ5cTQeTV9Yioro2zC" %}
[Getting Started with Loadium](/getting-started.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MUSAunBwe2J09CIl1hu" %}
[JMeter Test](/create-test/jmeter-test.md)
{% endcontent-ref %}

{% content-ref url="/pages/MgN0OAuKVZtI6DuNx1bd" %}
[Pricing](/about-loadium/pricing.md)
{% 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.loadium.com/jmeter-corner/local-network-simulation-on-jmeter-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
