postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.86k stars 1.16k forks source link

First request is slow #3034

Open dkoch84 opened 1 year ago

dkoch84 commented 1 year ago

The first request is considerably slower than the remaining requests and which request comes first does not matter. This only occurs in newman. Running the collection in Postman seems to not behave this way. There is this older issue #366 however, what I'm experiencing appears to only impact the very first request.

For some more information, this is a simple dotnet api. Same behavior whether running the app locally or when deployed to various places.

  1. Newman Version (can be found via newman -v): 5.3.2
  2. OS details (type, version, and architecture): linux - Arch - amd64
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: Unsure, noticed recently
  5. Expected behaviour: being first does not mean being worst
  6. Command / script used to run Newman: newman run postman/loco-logo.postman_collection.json -e postman/local.postman_environment.json
  7. Sample collection, and auxiliary files (minus the sensitive details): attached
  8. Screenshots (if applicable): image image

image image

collection-and-env.zip

dkoch84 commented 1 year ago

Furthermore, if I run multiple iterations, it is still only the very 1st request of the very 1st iteration that is slow:

image

malvikach commented 1 year ago

@dkoch84 I can see that the first request in all these screenshots is also responding with higher Bytes of response size(1.13Kb vs 154B in the latest screenshot) - This might be a potential reason for the response to take longer. I believe that the first request might be setting up cookies.

You can check your response header and verify the same: (Example)

Screenshot 2022-11-01 at 2 01 27 AM

Let me know if this is the case and this helps.

dkoch84 commented 1 year ago

Hi @malvikach that is not the case. My image is not that clear I suppose, the first request shown in the last image here is not the first in an iteration, it is simply the last request of hte first iteration, shown only to illustrate that a new iteration of the calls is started. note the size of the responses for each endpoint, they are consistent no matter their order:

/hello = 154B /hello Copy = 154B /blinky = 380B

image image