2

I have a scenario where web clients poll a server. Depending on the data in the response they are granted/denied access to certain resources. The clients dynamically react to those changes and the user is shown either the resources or some waiting page (denied). This is done via long polling mechanism. If the resources are available the user can interact e.g. answer a question.

I have a test plan that incorporates this long polling mechanism. I initially tried adding the polling into a request-loop to simulate it according to the real clients but my requests then got delayed until the long polling request got a response.

Thread group
 |
 |- Get State from server (saves value in variable) - no long polling here
 |- Request loop
 |  |- If Controller (checks the variable) 
       |- Loop until all resources are processed
          |- Get State - long poll **this blocks the user response until the timeout for the server response is met**
          |- User response

I then tried running the polling in a separate loop. However the request-loop seems to be never entered any more when the the polling-loop is executed. I checked with a Debug Sampler that the variable is indeed changed by the polling-loop whenever something changes on the server.

Thread group
 |
 |- Get State from server (saves value in variable) - no long polling here
 |- Request loop
 |  |- If Controller (checks the variable) 
 |     |- Loop until all resources are processed
 |        |- User response
 |
 |- Long-polling loop
 |  |- Set variable

Is there a solution that would nearly map the real scenario?

jackie.ms
  • 320
  • 2
  • 11
  • could you provide 2 schemas of what you tried I am confused a bit about your question, try to make it a bit clearer, thx – UBIK LOAD PACK Aug 21 '14 at 09:40
  • I edited my post to have it include more details, I also rephrased most of it. Hopefully it is clearer now. The schemas are more detailed now, though are not showing every detail. I tried to keep it simple ;-) – jackie.ms Aug 22 '14 at 10:24
  • Is it long polling as described in Ajax Long Polling here : http://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet what do you want to happen for Get State ? – UBIK LOAD PACK Aug 22 '14 at 19:43
  • I'm not hundred percent sure if it is the AJAX long polling but I think so. The only difference in our implementation - compared to the example from your link - is, that our server always responds after a certain timeout even if no data is changed. The Get State should in the best case occur in parallel to the other requests and not interfere with them while it is polling. It basically acts as as a gate that is either closed or open so the clients know that a specific resource is available or closed. – jackie.ms Aug 26 '14 at 09:17
  • No one knows how to do that? :( – jackie.ms Sep 04 '14 at 10:29

1 Answers1

1

You will have to send longpolls from a different threadGroup. The problem then would be about how to share the session information between two thread groups. I did that by writing session information(cookies etc) to a file and reading them in a different thread.

So, one threadgroup with do regular requests. The other threadgroup would do long polls. This is the way to simulate parallel http requests using jmeter. For me it worked.

anony
  • 314
  • 2
  • 14