This is a creation in Article, where the information may have evolved or changed.
Note: This article for the new version of the Golang is not used, go1 after the performance of the Go has a better upgrade, the specific test see: http://www.cnblogs.com/QLeelulu/archive/2012/08/12/2635261.html
I heard that go is a very good language, understand, some features are really good.
By the way, the performance comparison between HTTP and node. js is tested.
Go's code:
(Note: It is compiled with 8g, 8l)
node. JS Code:
AB Test results:
==** GO **==
$ab-c -- N +http://127.0.0.1:8080/This is apachebench,Version2.3<$Revision:655654$>Server software:server Hostname:127.0.0.1Server Port:8080DocumentPath: /Document Length:1bytesconcurrency Level: - Timetaken forTests:0.322Secondscomplete Requests: +Failed Requests:0Write Errors:0Total Transferred:97000Byteshtml Transferred: +bytesrequests per second:3105.62 [#/sec](mean) Timeper request:32.200[MS](mean) Timeper request:0.322[MS](mean,across all concurrent requests)Transfer Rate:294.18[Kbytes/sec] Receivedconnection times(Ms)min mean[+/-SD] Median maxconnect:000.703Processing:1 -10.5 in -Waiting:1 -10.5 in -Total:4 -10.1 in -
==** node. js **==
$ab-c -- N +http://127.0.0.1:8080/This is apachebench,Version2.3<$Revision:655654$>Server software:server Hostname:127.0.0.1Server Port:8080DocumentPath: /Document Length: Abytesconcurrency Level: - Timetaken forTests:0.143Secondscomplete Requests: +Failed Requests:0Write Errors:0Total Transferred:50000Byteshtml Transferred:12000bytesrequests per second:6993.50 [#/sec](mean) Timeper request:14.299[MS](mean) Timeper request:0.143[MS](mean,across all concurrent requests)Transfer Rate:341.48[Kbytes/sec] Receivedconnection times(Ms)min mean[+/-SD] Median maxconnect:001.104Processing:2 -6.6 - -Waiting:2 -6.6 - -Total:2 -6.4 - -
Webbench test Results
==** GO **==
$webbench-t -- C -http://127.0.0.1:8080/webbench-simple Web Benchmark1.5Copyright(C)Radim Kolar1997-2004,GPL Open Source software.benchmarking:get http://127.0.0.1:8080/ -Clients,Running -sec. Speed=146934 pages/min, 262032 bytes/sec.Requests:73467Susceed,0failed.
==** node. js **==
$webbench-t -- C -http://127.0.0.1:8080/webbench-simple Web Benchmark1.5Copyright(C)Radim Kolar1997-2004,GPL Open Source software.benchmarking:get http://127.0.0.1:8080/ -Clients,Running -sec. Speed=485128 pages/min, 404273 bytes/sec.Requests:242564Susceed,0failed.
From the test results, node. JS's HTTP server performance is twice times more than go, and let me be depressed, when testing with Webbench, you can see that go is using the four cores of my Notebook CPU, and node. js, of course, runs on only one core, and go is so much slower than node. js.
Then I google, see:golang HelloWorld 45% slower than node. js
Ask the truth!