Search code examples
jmeterperformance-testing

How can I test 50 threads and 60 threads ,for slave 1 and slave 2 respectively from jmeter non gui command?


Scenario : I have 2 slave machines configured , I want to send 50 users for slave 1, 60 users for slave 2 . I am using non GUI jmeter from command .

IP Address example :

Slave 1 : 1.0.0.1

Slave 2 : 2.0.0.2

Jmeter test plan configuration variables:

Number of threads :${__P(threads1,)}

Ramp-up period : ${__P(threads2,)}

Loop Count : ${__P(threads3,)}

I tried following command on jmeter start, but its not working as per expected:

jmeter -n -t POC1.jmx -R 1.0.0.1,2.0.0.2 -Gthreads1=50 -Gthreads2=1 -Gthreads3=1, -Gthreads1=60 -Gthreads2=1 -Gthreads3=1

Please help me if I am wrong in above command , please tell me how can I send 50 user threads , ramp up period 1 and loop count 1 for slave 1 and 60 user threads ramp up period 1 and loop count 1 for slave 2.


Solution

  • You won't be able to do it the above way as:

    1. All remote slaves are executing the same test plan
    2. You can pass global properties via -G command-line argument, so all the remote clients will be having the same properties set

    The solution is to use different user.properties on different slaves, like:

    1. Define amount of virtual users in your Test Plan using __P() function like:

      ${__P(threads,)}
      
    2. On first slave add the next line to user.properties file (lives in JMeter's "bin" folder)

      threads=50
      
    3. On second slave add the next line to user.properties file

      threads=60
      
    4. Restart JMeter on slaves

    You can also pass threads property value via -J command line argument while starting JMeter servers like:

    • On first slave

      jmeter -Jthreads=50 -s -j jmeter-slave1.log .....
      
    • On second slave

      jmeter -Jthreads=60 -s -j jmeter-slave2.log .....
      

    See Apache JMeter Properties Customization Guide for more information on using JMeter properties, setting and overriding them