13

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?
Cœur
  • 37,241
  • 25
  • 195
  • 267
Axel
  • 1,674
  • 4
  • 26
  • 38

1 Answers1

21

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.

ljk
  • 488
  • 1
  • 5
  • 11
Nachiket Kate
  • 8,473
  • 2
  • 27
  • 45
  • 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 – Axel Sep 24 '14 at 14:48
  • 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 – eddy Sep 24 '14 at 14:52
  • 2
    personally I find the throughput shaping timer more accurate than JMeter's built-in constant throughput timer: http://jmeter-plugins.org/wiki/ThroughputShapingTimer/ – Ophir Prusak Sep 24 '14 at 22:14
  • 1
    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 – Axel Sep 24 '14 at 22:48
  • 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 Sep 25 '14 at 04:59
  • Yes, agree with Ophir, Throughput shaping timer is also a good option. – Nachiket Kate Sep 25 '14 at 05:03
  • Well, still kind of confusing. I thought requests was the same as users/threads. – eddy Sep 25 '14 at 12:04
  • nope, requests are simulated by samplers but threads are simulation of users. – Nachiket Kate Sep 25 '14 at 13:36
  • @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 ??? – eddy Sep 25 '14 at 15:41
  • we can have chat. let me know when you are available. I'll try my best to resolve your doubts – Nachiket Kate Sep 26 '14 at 05:07
  • @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. – eddy Oct 12 '14 at 02:19
  • NP, Tuesday will be fine for me or we can use gtalk (nachiket.kate@gmail.com) if I get some busy, posting same comment on question so that you will get notification – Nachiket Kate Oct 13 '14 at 05:38
  • Hi @NachiketKate my email is (axell9641@gmail.com) My time zone is UTC/GMT -5 hours http://www.timeanddate.com/worldclock/peru/lima . Hope that's not a problem for you – eddy Oct 13 '14 at 12:41