insomnia
insomnia copied to clipboard
First request always takes at least 200 milliseconds
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:
- Open Insomnia
- Send the request
- It takes 200+ ms
Method 2:
- Insomnia is already open
- Wait at least 5 seconds after the previous request
- Send the request
- It takes 200+ ms
Is there an existing issue for this?
- [X] I have searched the issue tracker for this problem.
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
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](https://user-images.githubusercontent.com/11976836/181245278-187b5068-1b82-4411-aa4a-102a54ce47b5.png)
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.
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.