insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

First request always takes at least 200 milliseconds

Open RobbyCBennett opened this issue 2 years ago • 2 comments

Expected Behavior

The first request should match the latency of the subsequent requests. The subsequent requests are in the impressive 0.7 - 1.0 ms range, which is faster than Postman. By quickly clicking "Send" over and over, the subsequent requests get this time.

Actual Behavior

The first request is actually 200+ ms. Postman is not inconsistent like this.

Reproduction Steps

The "first" request happens if it's the first request after opening Insomnia, or by waiting 5 seconds before sending it.

Sample code:

const http = require('http');
const PORT = 3000;

http.createServer(function (req, res) {
	res.writeHead(200, {'Content-Type': 'text/plain'});
	res.end('Hello World!');
}).listen(PORT);

Prerequisite for my sample code:

  • Install node.js
  • Pick an available port for the script.
  • Start with node sampleScriptName.js
  • Open Insomnia and add a GET request http://localhost:3000

Method 1:

  1. Open Insomnia
  2. Send the request
  3. It takes 200+ ms

Method 2:

  1. Insomnia is already open
  2. Wait at least 5 seconds after the previous request
  3. Send the request
  4. It takes 200+ ms

Is there an existing issue for this?

Additional Information

I have also reproduced the error in Insomnia 2022.5.0-beta.5

Insomnia Version

2022.4.2

What operating system are you using?

Windows

Operating System Version

Windows 10 Version 21H2 19044.1826

Installation method

download from insomnia.rest

Last Known Working Insomnia version

N/A

RobbyCBennett avatar Jul 27 '22 00:07 RobbyCBennett

Hi @RobbyCBennett, thank you for reporting this. I might be mistaken but this is a bit of a know issue, someone else from the team can correct me here.

I was able to in part reproduce this issue at least in Windows, with the first request seemingly taking 20ms and the remaining ones around 1 to 3 ms:

Screenshot 2022-07-27 at 13 20 09

This needs a bit deeper investigation, though I believe I've seen this a couple of times, and more folks have also mentioned this issue ( #4612 ) and other similar issues like #3786.

We'll update you here as soon as possible.

filfreire avatar Jul 27 '22 12:07 filfreire

I just tested it in another shell. It's more noticeable if node is running in WSL, which was my first test. My second test was with node running in CMD, and it's normally 0.5 ms and 1.5 ms during the first slow request.

RobbyCBennett avatar Jul 27 '22 14:07 RobbyCBennett