vendredi 30 mars 2018

golang garbage collection frequency increases very rapidly when using my own response writter

func ResponseLogger() negroni.HandlerFunc { return negroni.HandlerFunc(func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { responseWriter := newLoggingResponseWriter(rw) next(responseWriter, r) path := GetAPIPath(r.URL.Path) statusCode := responseWriter.StatusCode() metric := getAPIPathWithStatusCode(path, statusCode) instrumentation.IncrementCounter(metric, 1) }) }

When I profiled this with traffic around 40K rpm. I witnessed something like this. enter image description here .

the GC pause frequency almost trippled. enter image description here

my application exposes multiple APIs and each of them in turn creates many objects to serve the data. What's going wrong here.




Aucun commentaire:

Enregistrer un commentaire