How to calculate end-to-end page response time in Gatling

Hi Team, I recently started using Gatling. I tried to execute a login page and the page contains many components inside it like js files, css files, api calls, image files… etc. The requirement is to test each and every components(even image files). I have executed the page with certain no. of users like below.
.exec(http(“Component01”).get(“hostname/login.html”"))
.exec(http(“Component01”).get(“hostname/xyz.png”))
.exec(http(“Component01”).get(“hostname/def.json”))
.exec(http(“Component01”).get(“hostname/ghi.js”))
Note: There are around 50 calls in my login page, including css, js, json, png, html… etc

In the gatling results, I’m seeing response time for each and every component separately like below
login.html - 700ms
xyz.png - 300ms
def.json - 900ms
ghi.js - 150ms
Now my question is, how can I calculate the actual login page response time ?
I cannot add all the above component times because the calls doesn’t process sequentially in real time on a browser.
At the same time, I cannot consider the highest response time(900ms) as the login page time because when a page loads on a browser, not all components will process parallel at the same time. There can be a combination of synchronous and asynchronous calls.
In Gatling, Is there any way to know the start time of the first component/api call and end time of the last component/api call happens on a page ? So that we will know the actual page response time

Hi @nvsgururaj,

Are you aware of groups? It will aggregated different actions (API calls or subgroup) metrics.

And from your explanation, I think you may be interested in resource as well because usually, the web browser will get the first url (your login.html) then will parallelly fetch resources (images, css, json, etc.) So you will be able to simulate this behavior with resources.

Cheers!

1 Like

Thankyou @sbrevet
I will explore more on groups and resources.

Resources is what I’m looking for. Can you please explain how to use .exec while I use resources ?

Which one of the below is correct ?

.exec(http("name").get("/")
  .resources(
    http("api.js").get("/assets/api.js"),
    http("ga.js").get("/ga.js")
  ))

OR

.exec(http("name").get("/"))
  .resources(
    .exec(http("api.js").get("/assets/api.js")),
    .exec(http("ga.js").get("/ga.js"))
  )

The former, as shown in the doc.

1 Like