I am working on a Node.js workload test and I have just encountered an interesting behavior. The minimum response time of an HTTP server is 200 ms, even for simplest logic:
var http = require("http");
http.createServer(function(request, response) {
response.write("Hello World");
response.end();
}).listen(8080);
Ran on Windows Server 2003:
> node main.js
I searched the web, but have not found any information about this. The test is done on local network, furthermore with the use of other webserver (namely IIS) I can achieve instant response time. Don't get me wrong, I see rational explanation behind this behavior, so this is my question:
Is this the default behavior coming with node.js, or could it be the result of something else?
Clarification on demand:
Update
The delay behavior only appear during remote requests. If a local workload test is executed, the latency will be close to zero. However, it cannot be a network latency issue, because a remote request against IIS on the same server does not give latency. I am going to try this out on other OSes.
It is Nagle algorithm set by default on Windows (reproducible also on Windows 2008 R2 on Azure).
Workaround - disable it on response socket, like this:
response.connection.setNoDelay(true);