PProf Web: A public web UI for the PProf profiler

about | archive


[ 2020-January-27 18:41 ]

Go has a built-in profiler called pprof, accessible by running go tool pprof. It produces a graph visualization (the nodes and edges kind) and flamegraphs, which are much more useful than the plain-text output. Unfortunately, the graph view requires graphviz (dot) to be installed, which is a bit annoying. Additionally, if you want to share the profile, you have to figure out how to share the files. I recently learned it has a web UI (go tool pprof -http=localhost:8080), and wondered if I could make a public version. I hacked together a tiny web frontend that wraps the existing UI, packaged it into a container, and deployed it on Google Cloud Run. You can go to pprofweb.evanjones.ca, upload a file, and view it. For more details, see the pprofweb Github repository. Like many experiments, it is unclear if this is actually useful, but it might come in handy.

This has the huge limitation that it stores the profile in memory. Cloud Run starts and stops instances whenever it wants, so it will lose the profile at some undefined time in the future, which is annoying. The bit that I've played with it, it seems to stick around for a few hours, which is usually long enough to figure out what you wanted to. This also currently only supports one profile at a time, so if someone else uploads a profile while you are using it, the state will be overwritten. Ideally, this should generate all the web pages from the profile and upload them to Google Cloud Storage. The UI could then just serve static files, and expire them after some time.

Wishlist (that may never happen)

Pprof fun facts