zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/debug/pprof/pprof.md (about) 1 # Profiling in Zot 2 3 This project gives the user the posibility to debug and profile the runtime to find relevant data such as CPU intensive function calls. An in-depth article on profiling in Go can be found [here](https://go.dev/blog/pprof). 4 5 A call to http://localhost:8080/v2/_zot/pprof/ would list the following available profiles, wrapped in an HTML file, with count values prior to change due to the runtime: 6 7 ``` 8 Types of profiles available: 9 Count Profile 10 95 allocs 11 0 block 12 0 cmdline 13 11 goroutine 14 95 heap 15 0 mutex 16 0 profile 17 13 threadcreate 18 0 trace 19 full goroutine stack dump 20 ``` 21 22 For example, the following can be used to gather the cpu profile for the amount of seconds specified as a query parameter, and then the results are stored in `cpu.prof` file: 23 ``` 24 curl -sK -v http://localhost:8080/v2/_zot/pprof/profile?seconds=30 > cpu.prof 25 ``` 26 27 Then, the user can use the `go tool pprof` to analyze the information generated previously in `cpu.prof`. The following command boots up an http server with a GUI and multiple charts that represent the data. 28 ``` 29 go tool pprof -http=:9090 cpu.prof 30 ``` 31 A flamegraph example would look like the following: 32 33 <img src="flamegraph.png" height="50%">