I was benchmarking my little web application and noticed some significant slowdown when I was running apache bench against it after a couple of thousand requests.
ab -n 20000 http://localhost:8080
The first few thousand requests are fast, then it gets slower and slower. Dramatically slower. While the first thousand take maybe a second, requests 18000-20000 take up to 10 seconds.
So I was trying to find the slow parts and at some point didn't have anything to exclude anymore until I ended up with benchmarking a "hello world" style http server example. To my surprise, the same slowdown occurred.
package main
import "net/http"
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
})
http.ListenAndServe(":8080", mux)
}
The same little example runs consistently fast on a linux box. It's not really a big thing because I don't plan to run the app on osx in production ;) But I'm curious what's causing the terrible slowdown on osx anyways