Repository navigation
Home
This is an early comparison of throughput between the built-in HTTP stack in node.js and the httpsys module.
Note that at this point little to none performance optimization had been done in httpsys.
- node.js v0.8.9-pre x86 as of bea0ac - thanks @bertbedler
- httpsys v0.2.0-pre as of f9bc1b
- server is Windows 2008 R2 on 4 core Intel Core 2 Quad Q6600 @ 2.4GHz
- a WCAT client with 100-300 concurrent connections with keep-alive, number chosen to best saturate the server; client runs on a separate machine
- test code is in server.js
Throughput and memory footprint had been measured for a 'Hello, world' HTTP server in three scenarios:
- using the built-in HTTP stack,
- using the
httpsysstack, - using the
httpsysstack with kernel mode output caching configured to 1 second.
Each of the scenarios was measured in two variants: single process, and cluster. The number of workers in the cluster was 4, which was meant to fully utilize the CPU.
In each scenario the throughput and total memory footprint of node.exe processes immediately after the run was measured.
Throughput [request/sec]
| Variant | require('http') | require('httpsys') | require('httpsys') with caching |
|---|---|---|---|
| 1 process | 12121 | 12987 | 32032 [1] |
| cluster | 32442 [2] | 32115 | 32129 [1] |
Memory of node.exe combined [KB]
| Variant | require('http') | require('httpsys') | require('httpsys') with caching |
|---|---|---|---|
| 1 process | 19584 [3] | 10582 | 10564 |
| cluster | 58000 [2] | 54000 | 54000 |
Notes:
[1] In all variants that involve HTTP.SYS output caching, the overall CPU utilization was under 50% (I did not have enough client machines to saturate the server). It is therefore expected the actual throughput in these cases would be about 200% of the number measured. I will get better numbers later.
[2] In the clustered variant of the built-in HTTP stack the overall CPU utilization of the server was around 85%. Given that the client CPU was not fully utilized, it seems the client was not a bottleneck in this measurement. Some investigation is due here.
[3] The variance of the memory consumption of the built-in HTTP stack across several measurements was large (several MBs). It may be affected by the timing of the V8 garbage collection?
- The throughput of the
httpsysmodule vs the built-in HTTP stack in node.js is comparable. - The user space memory consumption of the
httpsysmodule is less than that of the built-in HTTP stack. It is to be expected that this reduction is offset by more kernel mode memory allocation by HTTP.SYS, but that was not measured here. - The positive impact of the HTTP.SYS kernel mode output caching in the
httpsysmodule on throughput is very substancial. Even with caching duration as short as 1 second, throughput from a single process deployment usinghttpsysis expected to substantially exceed that of cluster.