Is their a way in Jmeter to control sending of HTTP request? My scenario is like
Note: the requests are sent one by one as an when response is received. Flooding the server with parallel request ( by setting no of thread > 1) will yield wrong response. So I want that Request 2 is to be triggered after receiving response 1.
The bad solution that works is:
More precisely the requirement is "read values stored in a csv file one by one and send http post request". The sequence what I wanted to achieve is Send_1, Receive_1, Send_2, Receive_2.......Send_n, Receive_n". My thread group setting is
Number of threads =1 Ramp up period =1 Loop Count = 10 ( as I want to read 10 values from csv and send out)
What I observed is Send_1, Send_2, ..Send_10 are sent immediately without giving server enough time to respond. How should I configure this so that Send and Receive will progress in locked step manner.
You don't need to do anything, by default JMeter waits for response for the previous Sampler before starting next one (assuming that you're using "normal" HTTP Request sampler), if you're getting errors with your setup without "sleep" time - it indicates the issue with your application, not with JMeter.
If you need the evidence you can
Add JSR223 PreProcessor with the following code:
log.info(' Iteration: ' + vars.getIteration() + '; Sampler ' + sampler.getName() + ' started')
Add JSR223 PostProcessor with the following code:
log.info(' Iteration: ' + vars.getIteration() + '; Sampler ' + sampler.getName() + ' ended')
where:
sampler.getName()
returns current Sampler labelvars.getIteration()
returns current loop of the Thread GroupSee Top 8 JMeter Java Classes You Should Be Using with Groovy article for more details if needed.
This way you will get sampler start and end time into jmeter.log file:
As you can see there are several milliseconds between ending the Sampler 1
and starting the Sampler 2
so you don't need to introduce any explicit waits.