The server for each of these benchmarks is based on https://github.com/rcrowley/go-tigertonic/tree/master/example. It was run as ./example >/dev/null 2>/dev/null
.
The client for each of these benchmarks is ab -H"Host: example.com" -c"100" -n"1000000" "http://127.0.0.1:8000/stuff/ID"
.
As a baseline, I removed the chan struct{}
and sync.WaitGroup
from server.go
and built the binary against Go tip.
Concurrency Level: 100
Time taken for tests: 235.452 seconds
Complete requests: 1000000
Failed requests: 0
Write errors: 0
Total transferred: 136000000 bytes
HTML transferred: 28000000 bytes
Requests per second: 4247.15 [#/sec] (mean)
Time per request: 23.545 [ms] (mean)
Time per request: 0.235 [ms] (mean, across all concurrent requests)
Transfer rate: 564.07 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.7 0 18
Processing: 0 23 8.5 21 252
Waiting: 0 23 8.5 21 252
Total: 0 24 8.5 22 252
Percentage of the requests served within a certain time (ms)
50% 22
66% 23
75% 25
80% 26
90% 30
95% 37
98% 47
99% 62
100% 252 (longest request)
This benchmark is of CL 67730046 that adds an int32
(accessed via sync/atomic
) and a sync.WaitGroup
to net/http
and uses bufio.Buffer.Peek
to preempt keepalive connections.
Concurrency Level: 100
Time taken for tests: 228.575 seconds
Complete requests: 1000000
Failed requests: 0
Write errors: 0
Total transferred: 136000000 bytes
HTML transferred: 28000000 bytes
Requests per second: 4374.94 [#/sec] (mean)
Time per request: 22.857 [ms] (mean)
Time per request: 0.229 [ms] (mean, across all concurrent requests)
Transfer rate: 581.05 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.6 0 17
Processing: 1 23 7.9 21 209
Waiting: 1 22 7.8 21 209
Total: 1 23 7.9 21 209
Percentage of the requests served within a certain time (ms)
50% 21
66% 23
75% 24
80% 25
90% 28
95% 34
98% 45
99% 57
100% 209 (longest request)
This benchmark is of CL 69260044 and uses http.Server.ConnState
to manage a chan struct{}
, sync.WaitGroup
, and a map[string]net.Conn
to preempt keepalive connections.
Concurrency Level: 100
Time taken for tests: 249.333 seconds
Complete requests: 1000000
Failed requests: 0
Write errors: 0
Total transferred: 136000000 bytes
HTML transferred: 28000000 bytes
Requests per second: 4010.70 [#/sec] (mean)
Time per request: 24.933 [ms] (mean)
Time per request: 0.249 [ms] (mean, across all concurrent requests)
Transfer rate: 532.67 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.8 0 70
Processing: 0 25 9.8 23 384
Waiting: 0 24 9.8 22 384
Total: 0 25 9.9 23 384
Percentage of the requests served within a certain time (ms)
50% 23
66% 25
75% 26
80% 27
90% 31
95% 40
98% 51
99% 65
100% 384 (longest request)