Hello,
I have a webserver application written in Golang that runs on a dedicated
server. It serves a popular website and uses almost 100% CPU and 100GB of
memory. It's in production but I'd like to profile it as it is: live. It's
on a remote webserver, which I have access too via HTTP and SSH (i.e.
non-local.)
I'd like to profile the webserver so that I can optimize both CPU and
memory usage. I tried adding "import _ net/http/pprof" but I am unable to
access any of the reports.
The website is served using the "github.com/facebookgo/grace/gracehttp"
package to allow for graceful restarts, as follows:
serverHTTPS := &http.Server{
Addr: constants.URL + `:443`,
Handler: hdl,
ReadTimeout: 30 * time.Second, // how long a file can be uploaded for
before it timesout
WriteTimeout: 60 * time.Minute, // how long a file can be downloaded for
before it timesout
MaxHeaderBytes: 1024 * 1024, // 1 MB
TLSConfig: &tls.Config{Certificates: []tls.Certificate{cert}},
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)), //
disable http2 due to bugs
}
serverHTTP := &http.Server{
Addr: constants.URL + `:80`,
Handler: redirhdl{},
ReadTimeout: 10 * time.Second, // how long a file can be uploaded for
before it timesout
WriteTimeout: 10 * time.Minute, // how long a file can be downloaded for
before it timesout
MaxHeaderBytes: 512 * 1024, // 512 KB
}
log.Fatal(gracehttp.Serve(serverHTTPS, serverHTTP))
The "hdl" struct has a ServeHTTP method which parses the URL to decide
which page to serve.
If I try to visit the site with /debug/pprof all I get is my standard 404
page not found message.
I tried catching the /debug/pprof path from ServeHTTP and just returning
this immediately, but that doesn't work either, it just gives a blank page.
Any ideas how I can profile this live webserver?
Thanks,
Alasdair
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.