mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-29 02:50:29 +00:00
1.7 KiB
1.7 KiB
Profiling SFTPGo
The built-in profiler lets you collect CPU profiles, traces, allocations and heap profiles that allow to identify and correct specific bottlenecks.
You can enable the built-in profiler using telemetry
configuration section inside the configuration file.
Profiling data are exposed via HTTP/HTTPS in the format expected by the pprof visualization tool. You can find the index page at the URL /debug/pprof/
.
The following profiles are available, you can obtain them via HTTP GET requests:
allocs
, a sampling of all past memory allocationsblock
, stack traces that led to blocking on synchronization primitivesgoroutine
, stack traces of all current goroutinesheap
, a sampling of memory allocations of live objects. You can specify thegc
GET parameter to run GC before taking the heap samplemutex
, stack traces of holders of contended mutexesprofile
, CPU profile. You can specify the duration in theseconds
GET parameter. After you get the profile file, use thego tool pprof
command to investigate the profilethreadcreate
, stack traces that led to the creation of new OS threadstrace
, a trace of execution of the current program. You can specify the duration in theseconds
GET parameter. After you get the trace file, use thego tool trace
command to investigate the trace
For example you can:
- download a 30 seconds CPU profile from the URL
/debug/pprof/profile?seconds=30
- download a sampling of memory allocations of live objects from the URL
/debug/pprof/heap?gc=1
- download a sampling of all past memory allocations from the URL
/debug/pprof/allocs