5 ms·
I tried running as simple an HTTP server as possible with go: package main import ( "fmt" "net/http" ) func main() { http.HandleFun
by derwiki 7y ago
I tried running as simple an HTTP server as possible with go:
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Foo")
})
http.ListenAndServe(":8088", nil)
}
and when I run it with `ab -c 100 -n 100000`, it falls over before 10k requests:
$ ab -c 100 -n 100000 http://127.0.0.1:8088/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
apr_socket_recv: Operation timed out (60)
Total of 6388 requests completed
I'm extremely new to go so maybe I'm doing something wrong. Could someone help me understand?
- jiofih 7y agoYou probably need to increase max open sockets using `ulimit`. Plus ab kinda sucks, use wrk instead.
- derwiki 7y agoAhh this explains it: https://danielmendel.github.io/blog/2013/04/07/benchmarkers-beware-the-ephemeral-port-limit/ https://danielmendel.github.io/blog/2013/04/07/benchmarkers-...