Search code examples
jmeterperformance-testingloadrunnerjmeter-pluginsblazemeter

How to allocate different bandwidth for different user in Jmeter


I have 10 concurrent users, and for 2 concurrent users, I need to assign x bandwidth, for 6 users I need to assign y bandwidth and for remaining 2 I need to assign z bandwidth.

How do I achieve the above scenario?

Can I achieve this by using stepping thread group and how?

if we cannot achieve this by using stepping thread group how will I achieve this?


Solution

  • You can't achieve this by using Stepping TG. JMeter lets you simulate network bandwidth very easily but it is not possible in Thread level.

    JMeter does give you the option to throttle outgoing bandwidth in order to simulate different network speeds. The bandwidth can be controlled through these two properties:

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

    These are for the HTTP and HTTPS protocols respectively.

    Configuration prerequisite:

    • Ensure you use HttpClient 3.1 or HttpClient 4 implementations.

    • Configure bandwidth by defining the 2 properties above in <jmeter home>/bin/user.properties.

    You will find these properties in <jmeter home>/bin/jmeter.properties location.

    The acronym “cps” stands for "characters per second".

    cps values are calculated with this formula :

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

    For some popular bandwidth presets and more detail you will find these two blogs Controlling Bandwidth in JMeter and How to Simulate Different Network Speeds in Your JMeter Load Test really helpful.

    If you run your test in the distributed mode you can set a different bandwidth for each remote engine by specifying your desired “cps” value in the user.properties file.