Skip to content

Instantly share code, notes, and snippets.

@bsphere
Created February 3, 2013 06:59
Show Gist options
  • Save bsphere/4700801 to your computer and use it in GitHub Desktop.
Save bsphere/4700801 to your computer and use it in GitHub Desktop.
node.js (version 0.8.18):
-------------------------
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/');
Go (version go1.0.2):
---------------------
package main
import (
"net/http"
"log"
"fmt"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, "Hello, World\r\n")
})
log.Printf("Server running at http://127.0.0.1:1337/")
http.ListenAndServe("127.0.0.1:1337", nil)
}
benchmark: ab -n 100000 -c 100 localhost:1337/
results:
========
Node.js:
--------
Document Path: /
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 15.446 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11300000 bytes
HTML transferred: 1200000 bytes
Requests per second: 6474.21 [#/sec] (mean)
Time per request: 15.446 [ms] (mean)
Time per request: 0.154 [ms] (mean, across all concurrent requests)
Transfer rate: 714.44 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 5
Processing: 1 15 7.8 15 47
Waiting: 1 15 7.8 15 47
Total: 1 15 7.8 15 47
Percentage of the requests served within a certain time (ms)
50% 15
66% 19
75% 22
80% 23
90% 25
95% 28
98% 32
99% 34
100% 47 (longest request)
Go:
---
Document Path: /
Document Length: 14 bytes
Concurrency Level: 100
Time taken for tests: 22.960 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 9600000 bytes
HTML transferred: 1400000 bytes
Requests per second: 4355.31 [#/sec] (mean)
Time per request: 22.960 [ms] (mean)
Time per request: 0.230 [ms] (mean, across all concurrent requests)
Transfer rate: 408.31 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 4
Processing: 1 23 6.6 26 40
Waiting: 1 23 6.6 26 40
Total: 3 23 6.6 26 40
Percentage of the requests served within a certain time (ms)
50% 26
66% 27
75% 27
80% 28
90% 29
95% 29
98% 30
99% 32
100% 40 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment