boom test the http server's QPS is just 7000~8000,but if I only set header,
in boom test the QPS is up to 40000. is the http.ResponseWriter Write() is
enefficiency?
here is my test code:
func handleHeader(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", "0")
}
func handlePayload50(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", "50")
w.Write(make([]byte, 50))
}
func handlePayload128(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", "128")
w.Write(make([]byte, 128))
}
func handlePayload1024(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", "1024")
w.Write(make([]byte, 1024))
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
http.HandleFunc("/header", handleHeader)
http.HandleFunc("/payload50", handlePayload50)
http.HandleFunc("/payload128", handlePayload128)
http.HandleFunc("/payload1024", handlePayload1024)
host := fmt.Sprintf("%s:%d", "0.0.0.0", 5001)
http.ListenAndServe(host, nil)
}
and the boom test result:
./boom -c 1000 -n 500000 -cpus 12 http://192.168.0.2:5001/header
500000 / 500000 Boooooooooooooooooooooooooooooooooooooooooooooooooooo!
100.00 %
Summary:
Total: 12.8799 secs.
Slowest: 3.2799 secs.
Fastest: 0.0018 secs.
Average: 0.0239 secs.
Requests/sec: 38810.4907
Status code distribution:
[200] 499875 responses
Response time histogram:
0.002 [1] |
0.330 [499306] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
0.657 [0] |
0.985 [0] |
1.313 [312] |
1.641 [0] |
1.969 [0] |
2.297 [0] |
2.624 [0] |
2.952 [0] |
3.280 [256] |
Latency distribution:
10% in 0.0125 secs.
25% in 0.0172 secs.
50% in 0.0216 secs.
75% in 0.0257 secs.
90% in 0.0295 secs.
95% in 0.0327 secs.
99% in 0.0549 secs.
Error distribution:
[125] Get http://192.168.0.2:5001/header: dial tcp 192.168.0.2:5001:
connection timed out
./boom -c 500 -n 500000 -cpus 12 http://192.168.0.2:5001/payload128
500000 / 500000 Boooooooooooooooooooooooooooooooooooooooooooooooooooo!
100.00 %
Summary:
Total: 62.5205 secs.
Slowest: 3.0714 secs.
Fastest: 0.0112 secs.
Average: 0.0601 secs.
Requests/sec: 7997.1501
Total Data Received: 63998208 bytes.
Response Size per Request: 128 bytes.
Status code distribution:
[200] 499986 responses
Response time histogram:
0.011 [1] |
0.317 [495652] |∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎
0.623 [0] |
0.929 [0] |
1.235 [4092] |
1.541 [0] |
1.847 [0] |
2.153 [0] |
2.459 [0] |
2.765 [0] |
3.071 [241] |
Latency distribution:
10% in 0.0405 secs.
25% in 0.0436 secs.
50% in 0.0481 secs.
75% in 0.0546 secs.
90% in 0.0629 secs.
95% in 0.0731 secs.
99% in 0.1054 secs.
Error distribution:
[14] Get http://192.168.0.2:5001/payload128: dial tcp 192.168.0.2:5001:
connection timed out
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.