How it works...
The pprof tool provides a lot of runtime information about your application. Using the net/pprof package is usually the most simple to configure--all that's required is listening on a port and doing an import.
In our case, we wrote a handler that uses a very compute-heavy applications (bcrypt) so that we can demonstrate how they pop up when profiling with pprof. This will quickly isolate chunks of code that are creating bottlenecks in your application.
We chose to collect a general profile that causes pprof to poll our application endpoint for 30 seconds. We then generated traffic against the endpoint to help produce results. This can be helpful when you're attempting to check a single handler or branch of code.
Lastly, we ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access