2

I have the following problem. Even with rampup and think time, some requests are still sent at the exact same time. Let's look the example below:

Number of threads: 2 Rampup: 60 sec

Thread Group

  • Transaction Controller
    • Action 1 (Transaction controller)
      • Sampler 1
      • Sampler 2
      • Sampler 3
      • Sampler 4
      • Sampler 5
    • Think Time (between 5 and 10 seconds)
    • Action 2 (Transaction controller)
      • Sampler 6
      • Sampler 7
      • Sampler 8
      • Sampler 9
      • Sampler 10 ...and so on

The problem is that somehow thread 2 catches thread 1 and for example Sampler 7 is sent for both threads at the exact same time. I don't know why this happens, but when the sampler is a POST request, the server handles only the first received request and the second one fails with 500 error message. I can add a random timer to Sampler 7, but I don't like this solution. Here, I've shown you an example with only 10 samplers, but in the real scenario I have more than 700 Samplers and I don't want to add an additional think time to all post request. I thought that the rampup period and the think time will do the job and not let a sampler to be sent to both users at the same time, but it does not work.

Please help

1
  • Hi, How did you implement think time between transaction controllers? I tired the "constant time", but no matter where I put it, it always adds the time between requests, not between transactions. This means if page 1 has 20 requests, and page 2 has 30, the timer is run 50 times instead of once, between transactions. Jul 21, 2020 at 14:14

2 Answers 2

2

If your requirement is not to have 2 (or more) threads executing a sampler at the same time the solution is to put the sampler under the Critical Section Controller.

The feature is available since Apache JMeter version 2.12

The Critical Section Controller

This allows you to run the execution of a specific section in your tree in a logical series. Only one instance of the section will be executed at any given time during the test.

1

(I can't add clarifying comments) As I have no idea what you exactly try to accomplish, I can only assume here. Jmeter would start a thread after 30s and the next after the next 30s and they start to run as fast as the machine is able to. It seems that the samplers execution time (request+response) is not similar for the subsequent calls and your threads start to run 'in sync' at some point. I am not sure why this is a problem: the 500 is an indicator something goes wrong on your server - the site you are testing I would think. Look in to that first. Assuming these are 'user actions' you are testing, this could actually happen in real life.

Using the interleave controller could help you to add a (small random) timer valid for every sampler without the need of adding one for every sampler. Thus adding a bit more randomness in the mix. But it will not guarantee that this same issue will not pop-up with any of the other 700 samplers you have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.