Scenario with one user makeing many simultaneous requests

Hi, I was developing a scenario to an app that is based on maps (like google maps). So the scenario to my User is:

Request 8 parts of the map in the server (8 gets) to fill the screen. This should be done in the same time.

I wrote like this:

val pngWithTile = feed(feeder).exec(http(“png_with_tile”).get("/map/teste_marcelodb_porto/${tile}/tile.png?styleid=style_test&stylenames[]=stylePt&mapkey=123")).pause(2)

val TESTE = scenario(“TESTE_2”).exec(pngWithTile)

setUp (TESTE.inject(atOnceUsers(1))
.protocols(harpiaWisHTTPConf))

but in this way each user only make one request, and if I use some repeat struture this does not throws all the 8 request at the same time.

Since now, thanks.

You can try

 .exec(exec(), exec())

I think the second inner exec()will not wait for the 1st inner exec() to complete.

@Neil : This form of exec doesn’t work that way, execs will still get chained.
This form of exec is only a convenience, but has it uses (used it myself today) : Imagine that you have a bunch of request that follows almost the same pattern. You could write a Scala function that generate a list of requests, chained all together and then use this form of exec to plug them in your scenario :

`
def requestsList(ids: List[Int]): List[ChainBuilder] = ids.map(id => exec(http("…").get("/products/" + id))

scenario("…")
.exec(requestList(List(1, 2, 3, 4)): _*)
`

@Everton:

The problem here is your pause duration: if you use your pngWithTile chain inside one of Gatling’s looping structures, each request will be fired only two seconds after the last one.
If you drop the .pause(2) from your chain, your requests won’t still be fired at the exact same time, but unless the system under tests takes a lot of time to respond to those requests, the delay beetween each request would be pretty small.

Hope this helps.

Cheers,

Pierre

Hi Pierre, Everton, I think you need to go back and look more closely at the page you are trying to model.
write it down.

initial URL request returns html which
causes the browser to execute some js which
calls 8 further URLs in parallel as the requests do not block [each other] (possibly as the js injects some resource links into the DOM, which the browser downloads in parallel)

if so:
you will have to use gatling 2

val map_image = http(“png_with_tile”).get("/map/teste_marcelodb_porto/${tile}/tile.png?styleid=style_test&stylenames[]=stylePt&mapkey=123")

val pngWithTile = feed(feeder).exec(
http(“png_with_tile”)
.get("/page_url")
.resources(map_image,map_image,map_image,map_image,
map_image,map_image,map_image,map_image)
// pause here if there is another page that the user views, else no need for a pause as not looping.

)

that should do it?
I’m sure you can factor out the repeated map_images.
http://gatling.io/docs/2.0.0-RC2/http/http_request.html#resources

Don’t loop unless your users are obsessive compulsive map viewers, or admin staff → instead use usersPerSecond() if they are normal users that only view a few pages then leave the site.

Thanks,
Alex