node0.6.0 已经发布了,性能提高如何呢?
本文将记录 nodejs 历史更新中所有版本的hello world性能测试。
$ uname -a
Linux xxx 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
$ cat /proc/cpuinfo
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
$ http_load -p 100 -s 10 http://127.0.0.1:1337/
0.7.0 |
---|
7676 |
0.6.7 | 0.6.6 | 0.6.5 | 0.6.4 | 0.6.3 | 0.6.2 | 0.6.1 | 0.6.0 |
---|---|---|---|---|---|---|---|
7791 | 8046 | 8060 | 8111 | 8070 | 8138 | 8240 | 8157 |
0.5.10 | 0.5.9 | 0.5.8 | 0.5.7 | 0.5.6 | 0.5.5 | 0.5.4 | 0.5.3 | 0.5.2 | 0.5.1 | 0.5.0 |
---|---|---|---|---|---|---|---|---|---|---|
8200 | 7259 | 7071 | 7098 | 6996 | 8073 | - | 7931 | 8127 | - | - |
0.4.12 | 0.4.11 | 0.4.10 | 0.4.9 | 0.4.8 | 0.4.7 | 0.4.6 | 0.4.5 | 0.4.4 | 0.4.3 | 0.4.2 | 0.4.1 | 0.4.0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
7510 | 7558 | 7600 | 7606 | 6588 | 7916 | 7931 | 7960 | 7981 | 7930 | 7965 | 7975 | 7490 |
0.3.8 | 0.3.7 | 0.3.6 | 0.3.5 | 0.3.4 | 0.3.3 | 0.3.2 | 0.3.1 | 0.3.0 |
---|---|---|---|---|---|---|---|---|
7810 | 7871 | 7815 | 8880 | 9000 | 8999 | 9200 | 9347 | - |
0.2.6 | 0.2.5 | 0.2.4 | 0.2.3 | 0.2.2 | 0.2.1 | 0.2.0 |
---|---|---|---|---|---|---|
7525 | 7481 | 7489 | 7500 | 7410 | 7136 | 7130 |
0.1.104 | 0.1.103 | 0.1.102 | 0.1.101 | 0.1.100 | 0.1.99 | 0.1.98 | 0.1.97 | 0.1.96 | 0.1.95 | 0.1.94 | 0.1.93 | 0.1.92 | 0.1.91 | 0.1.90 | 0.1.0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7640 | 7538 | 7537 | 7674 | 7040 | 7280 | 7211 | 7340 | 7270 | 7210 | 7063 | 7931 | 8020 | 8561 | 8146 | - |
在v0.6.0更新 说明文章中,列出的对比数据
http_simple.js /bytes/1024 5461 r/s 6263 r/s
io.js read 19.75 mB/s 26.63 mB/s
io.js write 21.60 mB/s 17.40 mB/s
startup.js 74.7 ms 49.6 ms
http_simple.js /bytes/1024 3858 r/s 5823 r/s
io.js read 12.41 mB/s 26.51 mB/s
io.js write 12.61 mB/s 33.58 mB/s
startup.js 152.81 ms 52.04 ms
v0.4 和 v0.6之间的更新说明请查看: API-changes-between-v0.4-and-v0.6
7675.8 fetches/sec, 92109.6 bytes/sec
msecs/connect: 0.050985 mean, 1.047 max, 0.02 min
msecs/first-response: 12.9343 mean, 47.329 max, 2.926 min
7790.79 fetches/sec, 93489.5 bytes/sec
msecs/connect: 0.052154 mean, 0.716 max, 0.023 min
msecs/first-response: 12.7397 mean, 41.609 max, 5.318 min
8046.29 fetches/sec, 96555.5 bytes/sec
msecs/connect: 0.0517639 mean, 0.396 max, 0.023 min
msecs/first-response: 12.3359 mean, 36.495 max, 4.808 min
8060.28 fetches/sec, 96723.4 bytes/sec
msecs/connect: 0.0518643 mean, 0.702 max, 0.021 min
msecs/first-response: 12.3109 mean, 35.02 max, 4.762 min
8111 fetches/sec, 97332 bytes/sec
msecs/connect: 0.051521 mean, 1.847 max, 0.021 min
msecs/first-response: 12.2351 mean, 49.227 max, 1.847 min
8070 fetches/sec, 96840 bytes/sec
msecs/connect: 0.0517654 mean, 0.502 max, 0.02 min
msecs/first-response: 12.2967 mean, 51.886 max, 5.151 min
8137.79 fetches/sec, 97653.5 bytes/sec
msecs/connect: 0.0515829 mean, 0.642 max, 0.021 min
msecs/first-response: 12.1961 mean, 42.128 max, 3.111 min
8239.6 fetches/sec, 98875.2 bytes/sec
msecs/connect: 0.0530447 mean, 0.439 max, 0.022 min
msecs/first-response: 12.0422 mean, 32.93 max, 1.846 min
8157.38 fetches/sec, 97888.5 bytes/sec
msecs/connect: 0.0512865 mean, 0.741 max, 0.022 min
msecs/first-response: 12.1661 mean, 46.023 max, 4.57 min
8200 fetches/sec, 98400 bytes/sec
msecs/connect: 0.0517871 mean, 0.508 max, 0.024 min
msecs/first-response: 12.0963 mean, 34.816 max, 4.831 min
7258.88 fetches/sec, 87106.6 bytes/sec
msecs/connect: 0.0521661 mean, 0.667 max, 0.022 min
msecs/first-response: 13.6817 mean, 49.23 max, 3.31 min
7070.8 fetches/sec, 84849.6 bytes/sec
msecs/connect: 0.0523142 mean, 0.517 max, 0.022 min
msecs/first-response: 14.0466 mean, 39.545 max, 6.215 min
7097.59 fetches/sec, 85171.1 bytes/sec
msecs/connect: 0.0526457 mean, 0.586 max, 0.024 min
msecs/first-response: 13.9935 mean, 44.333 max, 5.604 min
6995.6 fetches/sec, 83947.2 bytes/sec
msecs/connect: 0.0525126 mean, 0.413 max, 0.022 min
msecs/first-response: 14.1971 mean, 37.55 max, 6.123 min
8073.3 fetches/sec, 96879.6 bytes/sec
msecs/connect: 0.0509257 mean, 0.41 max, 0.02 min
msecs/first-response: 12.2924 mean, 44.222 max, 4.323 min
出现编译错误:
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/home/admin/pkgs/node-v0.5.4/build/default/deps/uv/uv.a(eio.o): In function `eio__sync_file_range':
/home/admin/pkgs/node-v0.5.4/build/default/deps/uv/src/eio/eio.c:1083: undefined reference to `sync_file_range'
collect2: ld returned 1 exit status
Waf: Leaving directory `/home/admin/pkgs/node-v0.5.4/build'
Build failed: -> task failed (err #1):
{task: cxx_link node_main_5.o,node_5.o,node_buffer_5.o,node_javascript_5.o,
node_extensions_5.o,node_http_parser_5.o,node_constants_5.o,node_file_5.o,
node_script_5.o,node_os_5.o,node_dtrace_5.o,node_string_5.o,timer_wrap_5.o,
handle_wrap_5.o,stream_wrap_5.o,tcp_wrap_5.o,pipe_wrap_5.o,cares_wrap_5.o,
stdio_wrap_5.o,process_wrap_5.o,node_cares_5.o,node_net_5.o,
node_signal_watcher_5.o,node_stat_watcher_5.o,node_io_watcher_5.o,
node_stdio_5.o,node_child_process_5.o,node_timer_5.o,platform_linux_5.o,
node_crypto_5.o,http_parser_3.o -> node}
make: *** [program] Error 1
7931.39 fetches/sec, 95176.7 bytes/sec
msecs/connect: 0.0520728 mean, 0.701 max, 0.024 min
msecs/first-response: 12.5109 mean, 45.553 max, 5.302 min
8126.8 fetches/sec, 97521.6 bytes/sec
msecs/connect: 0.0513291 mean, 2.476 max, 0.021 min
msecs/first-response: 12.2076 mean, 38.541 max, 1.328 min
编译不通过,暂缺
编译不通过,暂缺
7510 fetches/sec, 90120 bytes/sec
msecs/connect: 0.0540341 mean, 0.631 max, 0.023 min
msecs/first-response: 13.2113 mean, 47.364 max, 3.807 min
7557.79 fetches/sec, 90693.5 bytes/sec
msecs/connect: 0.0553164 mean, 0.467 max, 0.025 min
msecs/first-response: 13.13 mean, 44.789 max, 2.899 min
7600 fetches/sec, 91200 bytes/sec
msecs/connect: 0.0534043 mean, 0.367 max, 0.022 min
msecs/first-response: 13.0584 mean, 53.123 max, 4.559 min
7605.7 fetches/sec, 91268.4 bytes/sec
msecs/connect: 0.0539834 mean, 0.379 max, 0.02 min
msecs/first-response: 13.0469 mean, 46.833 max, 5.299 min
6587.9 fetches/sec, 79054.8 bytes/sec
msecs/connect: 0.0512022 mean, 0.499 max, 0.021 min
msecs/first-response: 15.0846 mean, 49.04 max, 4.448 min
7916.1 fetches/sec, 94993.2 bytes/sec
msecs/connect: 0.0516686 mean, 1.629 max, 0.021 min
msecs/first-response: 12.5375 mean, 43.116 max, 5.695 min
7930.88 fetches/sec, 95170.6 bytes/sec
msecs/connect: 0.0517224 mean, 0.704 max, 0.022 min
msecs/first-response: 12.5125 mean, 42.465 max, 5.519 min
7960 fetches/sec, 95520 bytes/sec
msecs/connect: 0.0522368 mean, 0.674 max, 0.021 min
msecs/first-response: 12.4676 mean, 43.185 max, 5.598 min
7981.4 fetches/sec, 95776.8 bytes/sec
msecs/connect: 0.0511981 mean, 0.729 max, 0.02 min
msecs/first-response: 12.4255 mean, 51.829 max, 5.506 min
7929.9 fetches/sec, 95158.8 bytes/sec
msecs/connect: 0.0510949 mean, 0.833 max, 0.023 min
msecs/first-response: 12.5189 mean, 51.677 max, 5.02 min
7965.19 fetches/sec, 95582.3 bytes/sec
msecs/connect: 0.0526699 mean, 0.864 max, 0.023 min
msecs/first-response: 12.4563 mean, 42.695 max, 3.897 min
7975.19 fetches/sec, 95702.3 bytes/sec
msecs/connect: 0.0527306 mean, 1.418 max, 0.021 min
msecs/first-response: 12.4361 mean, 47.871 max, 0.767 min
7490 fetches/sec, 89880 bytes/sec
msecs/connect: 0.051049 mean, 0.691 max, 0.021 min
msecs/first-response: 13.255 mean, 51.421 max, 5.735 min
7810 fetches/sec, 93720 bytes/sec
msecs/connect: 0.0514884 mean, 0.581 max, 0.02 min
msecs/first-response: 12.7136 mean, 43.613 max, 5.42 min
7870.99 fetches/sec, 94451.9 bytes/sec
msecs/connect: 0.0527374 mean, 0.453 max, 0.022 min
msecs/first-response: 12.6068 mean, 37.022 max, 5.835 min
7814.89 fetches/sec, 93778.6 bytes/sec
msecs/connect: 0.0522743 mean, 0.719 max, 0.023 min
msecs/first-response: 12.6983 mean, 37.436 max, 5.748 min
8879.97 fetches/sec, 106560 bytes/sec
msecs/connect: 0.0571404 mean, 0.753 max, 0.022 min
msecs/first-response: 11.1496 mean, 46.028 max, 4.842 min
9000 fetches/sec, 108000 bytes/sec
msecs/connect: 0.0566353 mean, 0.633 max, 0.023 min
msecs/first-response: 11.0017 mean, 46.633 max, 5.126 min
8999.29 fetches/sec, 107992 bytes/sec
msecs/connect: 0.0569282 mean, 0.583 max, 0.022 min
msecs/first-response: 11.0035 mean, 43.218 max, 5.112 min
9200 fetches/sec, 110400 bytes/sec
msecs/connect: 0.0582272 mean, 0.709 max, 0.023 min
msecs/first-response: 10.7557 mean, 32.685 max, 5.059 min
9347.3 fetches/sec, 112168 bytes/sec
msecs/connect: 0.0564677 mean, 0.974 max, 0.022 min
msecs/first-response: 10.592 mean, 38.921 max, 4.77 min
编译不通过
7524.9 fetches/sec, 90298.7 bytes/sec
msecs/connect: 0.0581787 mean, 0.649 max, 0.02 min
msecs/first-response: 13.1609 mean, 105.413 max, 5.191 min
7480.6 fetches/sec, 89767.1 bytes/sec
msecs/connect: 0.0589546 mean, 0.693 max, 0.023 min
msecs/first-response: 13.2442 mean, 94.122 max, 5.744 min
7488.59 fetches/sec, 89863.1 bytes/sec
msecs/connect: 0.0595586 mean, 0.428 max, 0.023 min
msecs/first-response: 13.2342 mean, 95.229 max, 5.88 min
7500 fetches/sec, 89999.9 bytes/sec
msecs/connect: 0.0591254 mean, 0.57 max, 0.024 min
msecs/first-response: 13.1974 mean, 94.721 max, 5.728 min
7409.99 fetches/sec, 88919.9 bytes/sec
msecs/connect: 0.0597531 mean, 0.558 max, 0.021 min
msecs/first-response: 13.3618 mean, 102.09 max, 5.846 min
7135.9 fetches/sec, 85630.8 bytes/sec
msecs/connect: 0.0565066 mean, 0.59 max, 0.023 min
msecs/first-response: 13.8999 mean, 100.855 max, 5.703 min
7129.99 fetches/sec, 85559.9 bytes/sec
msecs/connect: 0.0565618 mean, 0.356 max, 0.02 min
msecs/first-response: 13.915 mean, 100.048 max, 4.344 min
7640 fetches/sec, 91679.9 bytes/sec
msecs/connect: 0.0577092 mean, 0.564 max, 0.024 min
msecs/first-response: 12.9695 mean, 90.161 max, 3.711 min
7538.38 fetches/sec, 90460.6 bytes/sec
msecs/connect: 0.0577052 mean, 1.091 max, 0.021 min
msecs/first-response: 13.1506 mean, 92.522 max, 5.378 min
7537.49 fetches/sec, 90449.9 bytes/sec
msecs/connect: 0.0583015 mean, 0.396 max, 0.024 min
msecs/first-response: 13.1514 mean, 103.188 max, 5.577 min
7673.9 fetches/sec, 92086.8 bytes/sec
msecs/connect: 0.0588679 mean, 0.767 max, 0.021 min
msecs/first-response: 12.9082 mean, 99.924 max, 4.776 min
7040 fetches/sec, 84480 bytes/sec
msecs/connect: 0.0557378 mean, 0.592 max, 0.022 min
msecs/first-response: 14.0982 mean, 107.368 max, 6.009 min
7279.99 fetches/sec, 87359.9 bytes/sec
msecs/connect: 0.0555776 mean, 0.569 max, 0.022 min
msecs/first-response: 13.6292 mean, 93.241 max, 5.983 min
7210.6 fetches/sec, 86527.2 bytes/sec
msecs/connect: 0.0552844 mean, 0.379 max, 0.02 min
msecs/first-response: 13.7576 mean, 94.502 max, 5.685 min
7339.55 fetches/sec, 88074.6 bytes/sec
msecs/connect: 0.057371 mean, 0.802 max, 0.022 min
msecs/first-response: 13.5052 mean, 89.268 max, 5.326 min
7269.6 fetches/sec, 87235.2 bytes/sec
msecs/connect: 0.0566584 mean, 0.573 max, 0.021 min
msecs/first-response: 13.6483 mean, 60.543 max, 4.296 min
7209.65 fetches/sec, 86515.9 bytes/sec
msecs/connect: 0.0565087 mean, 0.529 max, 0.024 min
msecs/first-response: 13.7617 mean, 60.438 max, 4.418 min
7063.39 fetches/sec, 84760.6 bytes/sec
msecs/connect: 0.0547156 mean, 0.66 max, 0.022 min
msecs/first-response: 14.0522 mean, 130.751 max, 4.987 min
7930.6 fetches/sec, 95167.2 bytes/sec
msecs/connect: 0.0587932 mean, 0.61 max, 0.023 min
msecs/first-response: 12.4891 mean, 77.833 max, 3.689 min
8019.99 fetches/sec, 96239.9 bytes/sec
msecs/connect: 0.058158 mean, 0.718 max, 0.021 min
msecs/first-response: 12.354 mean, 79.033 max, 3.423 min
8560.98 fetches/sec, 102732 bytes/sec
msecs/connect: 0.0596777 mean, 0.471 max, 0.022 min
msecs/first-response: 11.522 mean, 71.727 max, 3.235 min
8146.18 fetches/sec, 97754.2 bytes/sec
msecs/connect: 0.0595273 mean, 0.826 max, 0.021 min
msecs/first-response: 12.1531 mean, 223.064 max, 3.189 min
helloworld.js跑不起来了,出现一下异常:
hello.js:8: TypeError: Object #
has no method 'createServer' http.createServer(function (req, res) { ^
^_^ 希望本文对你有用