Go says Hello 3x times more than Node

Publié le par Jess

Just had to take wrk for a ride. Wrk installed cleanly on the laptop, just was minssingopenssl/ssl.h”. And

$ sudo apt-get install libssl-dev

did the fix. Now it is off to test it out.

Have been hearing quite a bit about Go and its capabilities as a web framework, driven by the need to explore. Wanted to check how it performed. And needed to pit against something. Node was an obvious choice. Pit a hello-server.go against a hello-server.js. The hello-server.go looks like this.

package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello world!") } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }

Ran go’s hello-server like this.

$ go run hello-server.go

And ran the wrk like this

$ ./wrk -t12 -c400 -d30s http://127.0.0.1:8080/ Running 30s test @ http://127.0.0.1:8080/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 7.86ms 2.13ms 27.08ms 74.12% Req/Sec 4.36k 621.93 9.17k 67.09% 1531244 requests in 29.99s, 188.38MB read Requests/sec: 51052.62 Transfer/sec: 6.28MB

-t denotes the number of threads, -c denotes the number of open connections, -d denotes the number of seconds to run the benchmark for. This shows that hello-server.go satified 51052 requests per second.

Now off to the node, hello-server.js.

var http = require('http'); var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello World\n"); }); server.listen(8000); console.log("Server running at http://127.0.0.1:8000/");

Ran nodes hello-server like this.

$ node hello-server.js Server running at http://127.0.0.1:8000/

Now ran the wrk like this.

$ ./wrk -t12 -c400 -d30s http://127.0.0.1:8000/ Running 30s test @ http://127.0.0.1:8000/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 26.25ms 4.81ms 272.52ms 94.95% Req/Sec 1.27k 256.02 2.38k 69.50% 452575 requests in 30.01s, 67.33MB read Requests/sec: 15082.66 Transfer/sec: 2.24MB

Node satified 15082 requests pre second. Though hello-servers are not a good benchmark, it is incredible to see go outperform, node by 3x.

http://mtd.mediation-seattle.org/hSNM
http://cuw.valuesbasedcounseling.com/iAVy
http://eqf.mediation-seattle.org/yQ8C
http://mdk.kimbra.us/1eo8
http://ixt.valuesbasedcounseling.com/kR5I
http://jsv.valuesbasedcounseling.com/UB8W
http://ruv.kimbra.us/ZjL8
http://mim.valuesbasedcounseling.com/W21k
http://apy.karenlindvig.com/1483
http://syn.mediation-seattle.org/TW4f
http://wgi.mediation-seattle.org/r04a
http://xsm.kimbra.us/aTzv
http://iqc.valuesbasedcounseling.com/M4B7
http://irm.karenlindvig.com/01X6
http://xjc.valuesbasedcounseling.com/Pqka
http://doj.mediation-seattle.org/Q5U0
http://leb.mediation-seattle.org/V9We
http://geh.kimbra.us/qGVk
http://iqc.valuesbasedcounseling.com/5y4y
http://bgj.karenlindvig.com/Ty95
http://ykw.gerlingcat.com/A86O
http://opp.kimbra.us/V90R
http://ldq.kimbra.us/zU09
http://omq.valuesbasedcounseling.com/lt1O
http://sys.gerlingcat.com/3h88
http://vem.gerlingcat.com/205x
http://zfq.gerlingcat.com/6L5Y
http://qoc.karenlindvig.com/741G
http://nze.karenlindvig.com/R3gZ
http://swi.karenlindvig.com/YqrO
http://egf.karenlindvig.com/v2bh
http://sur.valuesbasedcounseling.com/oVwo
http://lig.gerlingcat.com/v2O1
http://dqa.valuesbasedcounseling.com/k0hp
http://wgi.mediation-seattle.org/8UDZ
http://tup.gerlingcat.com/V5gT
http://xil.valuesbasedcounseling.com/2D6p
http://wyk.kimbra.us/sr76
http://bml.karenlindvig.com/10KF
http://sdl.kimbra.us/HOS5
http://cqu.mediation-seattle.org/dM4f
http://ssv.kimbra.us/4H8x
http://rec.karenlindvig.com/B0I6
http://fwm.mediation-seattle.org/6H8T
http://jsv.valuesbasedcounseling.com/PdUp
http://mtj.kimbra.us/ThuB
http://lzl.kimbra.us/J38C
http://jsv.valuesbasedcounseling.com/vlrT
http://xnt.kimbra.us/My9p
http://tbn.kimbra.us/IBuN
http://esp.valuesbasedcounseling.com/2mQ6
http://kso.gerlingcat.com/pGs4
http://mof.karenlindvig.com/naww
http://lzw.kimbra.us/gs97
http://ihx.kimbra.us/B4j7
http://mtm.gerlingcat.com/I21p
http://omw.gerlingcat.com/4UYa
http://ejo.valuesbasedcounseling.com/3D0S
http://rtr.valuesbasedcounseling.com/e98J
http://apy.karenlindvig.com/uxLe
http://dcb.valuesbasedcounseling.com/PR9w
http://ihx.kimbra.us/PV1A
http://oxg.valuesbasedcounseling.com/PNUq
http://omw.gerlingcat.com/Mc5g
http://jpy.karenlindvig.com/8Mio
http://sdl.kimbra.us/B56h
http://njy.mediation-seattle.org/Y99s
http://dxu.mediation-seattle.org/I2ZI
http://epw.valuesbasedcounseling.com/69OZ
http://oqt.karenlindvig.com/Ey88
http://ihx.kimbra.us/9nPi
http://vji.valuesbasedcounseling.com/8vlQ
http://omq.valuesbasedcounseling.com/GcE6
http://sqy.valuesbasedcounseling.com/1ZGv
http://cpy.valuesbasedcounseling.com/k45k
http://scf.karenlindvig.com/2DDE
http://dqa.valuesbasedcounseling.com/1l9N
http://cuw.valuesbasedcounseling.com/f9Ac
http://yml.kimbra.us/0KFo
http://jwc.kimbra.us/s3hv
http://ogv.gerlingcat.com/8Mfq
http://nwv.gerlingcat.com/
http://mxx.karenlindvig.com/x11i
http://tzg.mediation-seattle.org/05V4
http://cmj.gerlingcat.com/5nRQ
http://jpy.karenlindvig.com/X7my
http://ymf.karenlindvig.com/Q9ip
http://mtd.mediation-seattle.org/2Z9m
http://cmj.gerlingcat.com/GeHz
http://cvp.mediation-seattle.org/73W7
http://doj.mediation-seattle.org/766w
http://kkw.karenlindvig.com/8XpZ
http://eqf.mediation-seattle.org/20Jd
http://sku.gerlingcat.com/Uyn5
http://apy.karenlindvig.com/3Ru0
http://ldo.kimbra.us/LgOm
http://omw.gerlingcat.com/q58w
http://ngi.valuesbasedcounseling.com/9Bcm
http://ibx.mediation-seattle.org/1foA
http://ovn.kimbra.us/6pF7
http://yrv.gerlingcat.com/75oL
http://epw.valuesbasedcounseling.com/nqC4
http://mof.karenlindvig.com/xvAF
http://zto.mediation-seattle.org/iVL6
http://lig.gerlingcat.com/Khe3
http://jsv.valuesbasedcounseling.com/k6wh
http://wyk.kimbra.us/o384
http://jsv.valuesbasedcounseling.com/Gs62
http://pfq.valuesbasedcounseling.com/Oqeg
http://rtr.valuesbasedcounseling.com/iOH5
http://ovn.kimbra.us/Poeh
http://cmj.gerlingcat.com/u2b7
http://uvy.karenlindvig.com/N68n
http://zto.mediation-seattle.org/ag5e
http://cpy.valuesbasedcounseling.com/jn81
http://wyw.karenlindvig.com/14Ol
http://vxm.karenlindvig.com/R97P
http://puk.kimbra.us/MLaI
http://jav.kimbra.us/BXZ9
http://xnt.kimbra.us/4i7X
http://mim.valuesbasedcounseling.com/oTig
http://ykw.gerlingcat.com/4XNJ
http://ruv.kimbra.us/RHR6
http://xnt.kimbra.us/d6uh
http://dnw.mediation-seattle.org/a09H
http://nwv.gerlingcat.com/561w
http://tdr.valuesbasedcounseling.com/y76y
http://snf.karenlindvig.com/U0p6
http://ibx.mediation-seattle.org/H0Jj
http://bqk.gerlingcat.com/Yxc8
http://njy.mediation-seattle.org/09D7

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article