1
votes

I am trying to test the loading time of a home page. The sequence of HTTP requests made by browser when loading the home page is like A -> B -> [C, D, E]

Which is to say

  • B executes after A's response is received and
  • C, D, E starts concurrently after B's response is received.

I tried the below approach to simulate this:

Approach 1

Have one scenario each for A, B, C, D, E. All of the scenarios are configured with say 50 users. I tried this:

A.inject().andThen(B.inject.andThen(C.inject(), D.inject(), E.inject()))

The problem with this is that, B starts only after all users of A has stopped. This does not simulate the home page loading accurately because I expect a user who has finished A to start with B without waiting for other users.

Approach 2

I created a single scenario with all the http requests.

exec(A).exec(B).exec(C).exec(D).exec(E)

This would mean that for example, D executes only after C's response is received. This is not right.

What is the best way to solve the problem?

1
Concurrent requests in Gatling is still an open issue.George Leung

1 Answers

1
votes

That's not how Gatling works, nor do your actual web clients.

You should have 1 single scenario with users performing request A, then request B, then requests C, D and E concurrently using resources.

val scn = scenario("foo")
  .exec(requestA)
  .exec(requestB
    .resources(requestC, requestD, requestE)
  )