diff --git a/src/docs/markdown/profiling.md b/src/docs/markdown/profiling.md index b98e3b8..00f09af 100644 --- a/src/docs/markdown/profiling.md +++ b/src/docs/markdown/profiling.md @@ -31,19 +31,7 @@ http://localhost:2019/debug/pprof/ By default, the admin API is only accessible locally. If running remotely, in VMs, or in containers, see the next section for how to access this endpoint. -You will see a simple list of profiles available along with their descriptions: - -> - **allocs:** A sampling of all past memory allocations -> - **block:** Stack traces that led to blocking on synchronization primitives -> - **cmdline:** The command line invocation of the current program -> - **goroutine:** Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic. -> - **heap:** A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample. -> - **mutex:** Stack traces of holders of contended mutexes -> - **profile:** CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile. -> - **threadcreate:** Stack traces that led to the creation of new OS threads -> - **trace:** A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace. - -Above these descriptions, you'll notice a simple table of counts and links, such as: +You'll notice a simple table of counts and links, such as: Count | Profile ----- | -------------------- @@ -56,12 +44,24 @@ Count | Profile 0 | profile 29 | threadcreate 0 | trace -full goroutine stack dump +| | full goroutine stack dump The counts are a handy way to quickly identify leaks. If you suspect a leak, refresh the page repeatedly and you'll see one or more of those counts constantly increasing. If the heap count grows, it's a possible memory leak; if the goroutine count grows, it's a possible goroutine leak. Click through the profiles and see what they look like. Some may be empty and that's normal a lot of the time. The most commonly-used ones are goroutine (function stacks), heap (memory), and profile (CPU). Other profiles are useful for troubleshooting mutex contention or deadlocks. +At the bottom, there's a simple description of each profile: + +- **allocs:** A sampling of all past memory allocations +- **block:** Stack traces that led to blocking on synchronization primitives +- **cmdline:** The command line invocation of the current program +- **goroutine:** Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic. +- **heap:** A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample. +- **mutex:** Stack traces of holders of contended mutexes +- **profile:** CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile. +- **threadcreate:** Stack traces that led to the creation of new OS threads +- **trace:** A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace. +