In this presentation, we will study some of the JMeter preprocessors. If you just bump to this page, mind that there is another article JMeter Pre-processors – 1 in our blog. What we are going to cover is;
Precise Throughput Timer
Synchronizing Timer
BeanShell Timer
JSR223 Timer
Poisson Random Timer
2. 1
In this presentation, we will study some of the JMeter
preprocessors. If you just bump to this page, mind that
there is another article JMeter Pre-processors – 1 in
our blog. What we are going to cover is;
Precise Throughput Timer
Synchronizing Timer
BeanShell Timer
JSR223 Timer
Poisson Random Timer
3. 2
This timer is not having any fixed amount of pause, it
has variable pauses and calculated the throughput as
close as possible to the given number. Although it has
a precise word in the name itself, still throughput not
need to be precise.
For instance, if a user wants to pause with different
times for switching different pages in the website, then
this throughput timer is used without using precise
throughput.
If you want to add this timer, follow these steps:
Go to Thread Group
Add new Sampler
Right-click on Sampler
Click on Add
Click on Timer
Click on Precise Throughput Timer
Precise Throughput Timer
5. 4
There are multiple fields in Precise Throughput Timer. Let’s go the details of each one.
Name: This is just a name for the timer which will display in the result.
Target throughput: This is for all the groups and samplers. This works as samples per “throughput period.”
Throughput Period- This time is divided with the throughput value and the user gets the samples per second.
Test duration: This is the total time which a test is taken to execute.
Number of threads in a Batch: It shows the total no. of threads in a go.
Delay between the threads- It shows delay time between the threads.
Use approximate throughput when sequence length exceeds: When the samples are less than the limit then this timer will create
the exact no. of samples.
Allowed throughput surplus: It is used when the samples are more than the limit then it increased accordingly.
Random seed: This value can change from 0 to any random value.
Precise Throughput Timer
7. 6
This timer is used to block the threads until the certain
no. of threads have been blocked. After that all the
blocked threads are released at once thus it increases
the load at many points in the test plan.
For example, After signup in the particular website
with multiple users, and after that all users may log in
at the same time then we can use this timer for the
blocking the process for some time after sign up.
To find this timer, see these steps:
Go to Thread Group
Add new Sampler
Right-click on Sampler
Click on Add
Click on Timer
Click on Synchronizing Timer
Synchronizing Timer
9. 8
This timer also has following sections,
Name: This is just a name for the timer which will
display in the result.
Number of simultaneous users to Group by: It
shows the threads which are ready to release.
Timeout in milliseconds: This time is basically for
the above field to reach the value of the number of
simultaneous users to group by.
Synchronizing Timer
11. 10
The BeanShell Timer is used to create a delay time
between each request.
For example, after Login into the Facebook, User
wants to go to the profile page and wants to update
the profile picture then this timer can be used for the
delay between opening the updating the profile
picture.
For adding this Timer to your sampler, here you go:
Go to Thread Group
Add new Sampler
Right-click on Sampler
Click on Add
Click on Timer
Click on BeanShell Timer
Synchronizing Timer
13. 12
This timer displays these fields:
Name: This is just a name for timer which will display
in the result.
Reset bsh. Interpreter before each call: If a user
wants to select this option then the interpreter will be
regenerated for each sample.
Parameters: This is used for the parameters to be
passed to the script.
Script File: This is having a file to run which is a
BeanShell Script.
Script: This is the BeanShell script which returns the
value of the used milliseconds to wait.
Beanshell Timer
15. 14
Beanshell Timer
In the above screenshot, no. of threads (TCount) and ramp duration (RPeriod) are used as user-defined variables and
accessed these variables using vars.get (Parameter-name). Thread loop counter argument accessed by bsh.args[].
16. 15
This Timer works same as BeanShell Timer to
generate the delay but the difference is that it
generates the delay between each request using the
JSR223 scripting language.
For example, If a user wants to delay between the
Login and edit profile requests then this timer should
take place.
How to add this timer to your Sampler, Please follow
these steps:
Go to Thread Group
Add new Sampler
Right-click on Sampler
Click on Add
Click on Timer
Click on JSR223 Timer
JSR223 Timer
18. 17
This Timer has sections below:
Name: This is just a name for timer which will display
in the result.
Script Language: This is for JSR223 scripting
language.
Parameters: This is used for the parameters to be
passed to the script.
Script File: This is having a file to run which is a
BeanShell Script.
Script compilation caching: It has the cache of
compiled scripting.
Script: This is the BeanShell script which returns the
value of the used milliseconds to wait.
JSR223 Timer
19. 18
JSR223 Timer
In the above screenshot, Scenario is for 3000 milliseconds (3 seconds). If the scenario runs over 3 seconds then The
‘Abc’ value is not required anymore. Here ‘a’ is having the conditions for null and not null situations of scenario timer
and used vars.put method just before returning the value of ‘a’.
20. 19
This Timer basically works as Gaussian Random
Timer for the random amount of pause but the
difference is that the total delay value is an addition of
Poisson distributed value and the offset value.
For example, If a user wants to switch the pages after
Login into the particular website with the distributed
amount of time pauses then this timer should be used.
To add this timer into your sampler follow these steps:
Go to Thread Group
Add new Sampler
Right-click on Sampler
Click on Add
Click on Timer
Click on Poisson Random Timer
Poisson Random Timer
22. 21
This timer contains these fields:
Name– This is just a name for timer which will display
in the result.
Lambda- This value used in milliseconds for the
Poisson distribution.
Constant Delay Offset- This time is to pause in
addition to random delay in milliseconds.
Poisson Random Timer