Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Variable for Thread group Ramp up time

Tags:

jmeter

how to configure the thread group ramp up time with a jmeter variable, I tried for both number of threads and ramp up time. No of threads is working fine, but ramp up time takes the default value 1 and the variable value doesn't take effect, Appreciate any help

like image 564
Mercy Avatar asked Aug 09 '15 17:08

Mercy


People also ask

What is ramp up time in thread group?

Ramp-up is the amount of time it will take Apache JMeter™ to add all test users (threads) to a test execution. Or in other words, how long it will take for JMeter to start execution of all the threads. For example: 1000 target threads with 1000 seconds ramp-up: JMeter will add one user each second.

How do you use variables in different thread groups?

Step to implement the logic for passing the variable value to another Thread Group: Add a 'Regular Expression Extractor' post-processor as a child element of 1.1 HTTP Request (Fetcher) and fetch the value in a variable (say employeeID) Add a 'BeanShell Assertion' and write ${__setProperty(valueToPass,${employeeID})}

How do you calculate ramp up time in performance testing?

First, guess the average hit rate and then calculate the initial ramp-up period by dividing the number of threads by the guessed hit rate. For example, if the number of threads is 100, and the estimated hit rate is 10 hits per second, the estimated ideal ramp-up period is 100/10 = 10 seconds.

How does JMeter determine ramp up time?

The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun.


2 Answers

You cannot use variables in Thread Group setting as Thread Groups are initialised during startup, before any variables are read.

If you need to make number of threads and/or ramp-up period configurable use __P() function like:

  • ${__P(threads,)}
  • ${__P(rampup,)}

Properties

Aforementioned threads and rampup properties can be defined in several ways:

  1. If you run JMeter in command-line non-GUI mode you can pass the properties via -J command line key as

    jmeter -Jthreads=50 -Jrampup=30 -n -t /path/to/your/testplan.jmx
    

    The same approach will work for GUI mode, however it is not recommended to use GUI for load test execution as it is quite resource consuming and may ruin your test.

  2. You can define these properties in user.properties file (located in /bin folder of your JMeter installation) as:

    threads=50
    rampup=30
    

    After restart JMeter will pick the properties up and you will be able to refer them via __P() function as described above.

See Apache JMeter Properties Customization Guide for comprehensive information on various JMeter properties and ways of working with them

like image 70
Dmitri T Avatar answered Oct 14 '22 10:10

Dmitri T


There is no reason why it works for # of threads but doesn't work for ramp-up time. I've been using configurable properties for both with success.

1 is the default value in JMeter if variable can't be resolved properly. You likely made a typo. To investigate the problem, you may want to use 'Property Display' element (right-click WorkBench / Add / Non-Test Element / Property Display).

If this doesn't help, please post link to the screenshot of thread group, and relevant part of your config where you define the ramp-up time variable.

EDIT : example

This is the way I usually work with configurable properties stored in external files (and it works for ramp-up as well):

  • define user defined variable on test plan level, e.g. someVarName is ${__P(someVarName)}
  • then use this var e.g. in ramp-up as ${someVarName}
like image 2
automatictester Avatar answered Oct 14 '22 11:10

automatictester