1

I have a workflow that involves saving some data, and then updating it a few seconds later. I've created a CSV file with parameters like so:

ID,Success
1,true
2,false
3,true
4,false
5,true

And so on and so forth. The first HTTP request is to save a new ID:

POST http://server/save
{ id: 1 }

And the second HTTP request updates the ID with the status:

POST http://server/update/
{ id: 1, success: true }

I've created a JMeter test to benchmark this workflow. I created a Thread Group with the following steps:

1. Do save request
2. Wait a random period between 5 and 30 seconds
3. Do update request

I've set my Thread Group to use 2 threads at once as an initial test. However, I've noticed that what happens is actually this:

Thread 1
----------------------------------------------------
| 1. Do save request                               |
| 2. Wait a random period between 5 and 30 seconds |
| 3. Do an update request                          |
|--------------------------------------------------|

Thread 2
----------------------------------------------------
| 1. Do save request                               |
| 2. Wait a random period between 5 and 30 seconds |
| 3. Do an update request                          |
|--------------------------------------------------|

Problem is, what I'd actually like to do is ensure that there's always 2 simultaneous HTTP requests to the server. In this case, it spawns 2 threads and runs through the ENTIRE workflow as one thread, meaning that I can't guarantee a certain load on the server. What I'd like for it to do instead is this:

Thread 1
-------------------------------------------------------
|                                                     |
|  HTTP request                                       |
|  **********************************************     |
|  * 1. Do save request                         *     |
|  **********************************************     |
|                                                     |
|    2. Wait a random period between 5 and 30 seconds |
|                                                     |
|  HTTP request                                       |
|  **********************************************     |
|  * 3. Do update request                       *     |
|  **********************************************     |
|                                                     |
|-----------------------------------------------------|

Is there a way that I can write my JMeter test such that it will ensure that there are always 2 simultaneous HTTP requests on the server? Also, the update request must happen after the save request, otherwise the ID will not exist.

Here's an image of my JMeter test:

The while controller simply processes every line in the CSV file.

Daniel T.
  • 37,212
  • 36
  • 139
  • 206
  • Why do yo want to use one thread sending quiet random requests instead of two threads sending requests in a sequence? – Andrei Botalov Nov 07 '12 at 07:17
  • Because I need to simulate a workflow where the user saves some data, confirms it on his page, and then sends the success status. Think shopping cart, for example. User first creates a shopping cart, confirms on his screen that the cart looks correct, and then places the order. – Daniel T. Nov 07 '12 at 20:42
  • Any news on that ? Was my answer helpful ? If yes you should accept it, if not you can comment – UBIK LOAD PACK Nov 10 '12 at 13:59
  • Hi PMD, I've found another solution using JMeter Plugins, available here: http://code.google.com/p/jmeter-plugins/. It provides a Throughput Shaping Timer which does exactly what I need (limit the number of requests per second to the server). – Daniel T. Nov 12 '12 at 19:42

2 Answers2

1

I am sorry to say I don't understand you question. What do you want to achieve exactly, particularly in your last workflow description.

Anyway if you notice that you don't have simultaneous requests with 2 threads that can be totally regular as you have high pause time and only 2 threads.

Try with 100 threads you will see you have simultaneous requests.

Some notes about your test plan:

  • You don't need while controller to iterate over CSV, just set iteration in thread group to infinite

  • remove View Tree Results and Response Time Graph when you load test

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
  • My pause times exactly simulate the user's workflow, and 2 was just an example. The real load test will have thousands of threads. – Daniel T. Nov 07 '12 at 20:44
0

lower the 'ramp up' period for threads in the Thread Group (give it 0 seconds). that means they will both start up simultaneously.

Koby
  • 837
  • 7
  • 11
  • You've misunderstood the question. The problem is not with the threads starting up simultaneously or not. The problem is that the threads will sleep for an x number of seconds, during which time no requests are being made to the server. – Daniel T. Nov 07 '12 at 20:43