Skip to content

Instantly share code, notes, and snippets.

@mmaelzer
Last active November 22, 2015 04:46
Show Gist options
  • Save mmaelzer/907631039bf29a68336a to your computer and use it in GitHub Desktop.
Save mmaelzer/907631039bf29a68336a to your computer and use it in GitHub Desktop.
go vs node with 20k of json

Setup

http-bench

$ git clone git@github.com/mmaelzer/http-bench

wrk (on mac)

$ brew install wrk

go (on mac)

$ brew install go

Results

Run on Macbook Pro 2015

  • Core i5 Dual Core
  • 16GB RAM

Go

❯ go version
go version go1.5.1 darwin/amd64

❯ go run go/webserver.go
=== server running on 127.0.0.1:8080 ===
begin benchmark

❯ wrk -d10s -t10 -spost_json.lua http://127.0.0.1:8080/json
Running 10s test @ http://127.0.0.1:8080/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.45ms    5.44ms  80.53ms   88.64%
    Req/Sec   145.66     28.29   230.00     70.30%
  14594 requests in 10.06s, 248.55MB read
Requests/sec:   1450.23
Transfer/sec:     24.70MB

node.js

❯ node -v
v4.2.1

❯ node js/nodehttp.js
=== server listening on 127.0.0.1:8080 ===
begin benchmark

❯ wrk -d10s -t10 -spost_json.lua http://127.0.0.1:8080/json
Running 10s test @ http://127.0.0.1:8080/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     4.72ms    1.47ms  24.70ms   88.67%
    Req/Sec   213.38     46.62   340.00     79.30%
  21294 requests in 10.04s, 363.14MB read
Requests/sec:   2121.64
Transfer/sec:     36.18MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment