How to use the Constant Throughput Timer to specify a maximum of 4 concurrents users per second, during an hour

21,837

Constant throughput timer allows you maintain throughput of your sever. (req/sec) here requests are samplers. Threads are users/clients which are requesting server using samplers.

I hope this have cleared distinction between request and user i.e. sampler and thread.

Now Constant Throughput Timer works on sampler per minute basis. so for your requirement of 4 req per sec. it becomes 240 requests per minute.

and you want to maintain this throughput among all threads (if you have multiple thread groups) or among a single thread group if you have single thread group.

So JMeter engine will start all threads with given ramp-up but will allow only 4 samplers to executes at a given seconds i.e. only 4 request per second. Thus throughput is achieved among all threads and you can continue this for a specified time using either ways,

  1. Test duration
  2. Runtime controller

enter image description here

I hope it cleared your confusion and solved the issue.

Share:
21,837
Axel
Author by

Axel

Updated on July 09, 2022

Comments

  • Axel
    Axel almost 2 years

    I need to create a load test in which there's a maximum of 4 concurrent users per second. Then I need to repeat this for an hour. Is there any way to achieve this in JMeter?

    I have tried using this configuration:

    • Number of Threads: 4
    • Ramp-up period: 1
    • Loop count: Forever
    • Duration:3600

    And to make sure that this run exactly for an hour I have also used a Runtime Controller with the same "3600" runtime value.

    But these creates more concurrent users per second than what I need and besides it's also unlikely to have that many concurrent users as user usually take so time to think before they do something and this wasn't reflected in my configuration so also tried using Constant Throughput timer , but this only confused me more.

    • I'm sure I need to use the Constant Throughput Timer, but I don't have the faintest idea of how to do it in my case.
    • If a use the Constant Throughput Timer, how should I configure the Thread Properties (Number of threads, ramp-up period,loop count, schedule) ?
    • Do I really need to use a Runtime Controller, to ensure that the test plan runs exactly for an hour or is enough to specify a duration value of 3600?
  • Axel
    Axel over 9 years
    Thank you very much @Nachiket. Just a couple of more question: 1) Given the configuration you have shown, how would it be the configuration for the Thread Group (Number of threads, ramp-up period, Loop count, etc) ? 2) When I use Constant throughput timer I always get an extra requests in the first minute of execution, is that normal?? I so, is there any explanation for this? Once again, thank you very much
  • eddy
    eddy over 9 years
    I've got the same issue and as Axel says, In the documentation there's nothing about the reason why in the first minute we get one additional request
  • Ophir Prusak
    Ophir Prusak over 9 years
    personally I find the throughput shaping timer more accurate than JMeter's built-in constant throughput timer: jmeter-plugins.org/wiki/ThroughputShapingTimer
  • Axel
    Axel over 9 years
    Thank you very much @OphirPrusak, but please do you think you could give an example of how to configure the Thread Group for the scenario I explained in my question? There are some examples out there, but they never show how to configure the Thread Group when it used with a controller or constant
  • Nachiket Kate
    Nachiket Kate over 9 years
    Thread Group configurations will be the same which you have already mentioned. no. of threads will be the client load which you want to put(suppose 10 or 100), duration : 1 hr, loop : forever, rampup : 10 yes when you rampup i.e. in first minute generally you get more requests as threads are starting so it is normal behavior. To test your scenario run for exactly 1hr with given throughput you should test for 1hr 10min. exclude first 5 min and last 5 min of test as that is warm up time for your test as well as server and last 5 min are warm down period.
  • Nachiket Kate
    Nachiket Kate over 9 years
    Yes, agree with Ophir, Throughput shaping timer is also a good option.
  • eddy
    eddy over 9 years
    Well, still kind of confusing. I thought requests was the same as users/threads.
  • Nachiket Kate
    Nachiket Kate over 9 years
    nope, requests are simulated by samplers but threads are simulation of users.
  • eddy
    eddy over 9 years
    @NachiketKate, but when I specify 3 Threads/users, that shouldn't be the same as telling JMeter that there are three users that want to execute the sampler 3 times, 1 per user ???
  • Nachiket Kate
    Nachiket Kate over 9 years
    we can have chat. let me know when you are available. I'll try my best to resolve your doubts
  • eddy
    eddy over 9 years
    @NachiketKate For some reason I didn't get notification of your comment. I'm still struggling with JMeter and I was wondering if your offer still stands.If so, please let me know maybe tomorrow or the day after.
  • Nachiket Kate
    Nachiket Kate over 9 years
    NP, Tuesday will be fine for me or we can use gtalk ([email protected]) if I get some busy, posting same comment on question so that you will get notification
  • eddy
    eddy over 9 years
    Hi @NachiketKate my email is ([email protected]) My time zone is UTC/GMT -5 hours timeanddate.com/worldclock/peru/lima . Hope that's not a problem for you