3

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:

  • Node js version: 0.6.11
  • OS: Windows Server 2003 R2 SP2
  • Server environment: VMWare Workstation 8.0.0
  • Workload utility: jMeter 2.6 (1 thread workload)

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.

tamasf
  • 1,068
  • 2
  • 10
  • 22
  • 2
    no, it's not what I'd expect. How do you measure request time? What results `ab` gives you? Which version of node you are using? – Andrey Sidorov Feb 20 '12 at 01:51

3 Answers3

3

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);
2

Getting 5ms latency, 3ms download for a total of 8ms here. It varies but the highest I've seen is about 14ms total.

Ran on OS X 10.7.3 though. I will have to try on Windows and see.

Rodger
  • 21
  • 1
  • I tried on Windows Server 2008 R2 too, the additional latency did not occur, so it seems this is a platform specific problem. – tamasf Feb 21 '12 at 00:22
1

I'm running Ubuntu 64bit and node version 0.6.10 and at most I get a 20ms delay. I believe it is a windows problem, since Node is still not perfect on windows, have to wait for some more stability. I suggest you to post your problems to the mailing list.

Farid Nouri Neshat
  • 29,438
  • 6
  • 74
  • 115
  • 2
    It could be anything, node is pretty stable on windows, more likely to be an issue with his network/hardware – Raynos Feb 20 '12 at 03:17