0

I am trying to measure the performance of a single REST endpoint (GET) with Gatling, with a very simple setup like this one:

val httpProtocol: HttpProtocolBuilder = http
    .baseUrl("https://domain:8085") 
    .acceptHeader("*/*");

  val scn =
    scenario("MyScenario")
      .exec(
        http("MyRequest")
          .get(myPath)
      )
setUp(scn.inject(rampUsersPerSec(1) to (1) during (10 seconds))).protocols(httpProtocol)

Which means 1 request per second.

The problem is that the min response time is more than 500ms, average 600ms, but if I do the same test manually with Postman, same endpoint and parameters, the response time is between 150ms and 250ms.

Why could be this difference appear? How can I track the issue?

I verified that the execution time in the server side is the same for both.

Thank you!

Mr.Eddart
  • 10,050
  • 13
  • 49
  • 77
  • I'm afraid there's no way to investigate without you providing the actual endpoint (ie the actual Gatling and Postman tests). Could be DNS, could be logging... – Stéphane LANDELLE Feb 01 '22 at 23:29
  • Thanks. It is a direct IP, not domain name. Also there is no logging at gatling side... – Mr.Eddart Feb 01 '22 at 23:33
  • Really, can't say without being able to test your endpoint. For example, hitting `https://www.google.com/` with Gatling 3.7.4 from France, over home wifi, takes ~180ms for me. – Stéphane LANDELLE Feb 01 '22 at 23:53

1 Answers1

1
  1. Which means 1 request per second - no it doesn't, it means 1 thread executing requests for 10 seconds as fast as it can, given you state response time is around 500ms my expectation is that around 20 requests have been executed which gives approximately 2 requests per second. I don't think it is the real issue, but it's not the "same test"

  2. It's also not the "same test" when it comes to HTTP Headers, Postman sends few more by default like Postman-Token and especially Accept-Encoding which is missing in your Gatling test and present by default in Postman requests and this guy can have quite big impact

    enter image description here

    In order to be absolutely to send the same request that Postman sends you can just record it using Gatling Recorder

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks for your reply. In fact, read the code carefully: only 10 requests are sent. For the second part, I copied the header and same result. BUT Connection:keep-alive makes a difference. Now Postman takes around 300ms per request, while Gatling double of that... – Mr.Eddart Feb 02 '22 at 07:57
  • "no it doesn't, it means 1 thread executing requests for 10 seconds as fast as it can". This statement is wrong. Gatling is not JMeter. This Gatling configuration would create 10 virtual users (threads have nothing to do with this), one every second, and each of them would open a new connection. @Dmitri T, could you please correct? – Stéphane LANDELLE Feb 02 '22 at 08:31
  • `Connection:keep-alive` is the default behavior since HTTP/1.1 so setting it shouldn't make a default. Neither Gatling nor Postman support HTTP.1.0 in 2022. So if it were to really make a difference, it would be a bug in your server/app. – Stéphane LANDELLE Feb 02 '22 at 08:35
  • @Mr.Eddart If you're running with an anti-virus, try disabling it. – Stéphane LANDELLE Feb 02 '22 at 08:36
  • Thanks @StéphaneLANDELLE, in fact I am not using anti-virus... And in fact the problem is not gatling, because with Curl (via Windows Subsystem Linux) I get the same times as with Gatling, apparently Postman manages to increase response time somehow... – Mr.Eddart Feb 02 '22 at 10:11