gitlab.com/lightnet1/evrynet-node@v1.1.0/PPROF.md (about)

     1  # PPROF
     2  
     3  - Type profiles of node are available at `http://<NODE_IP>:<PPROF_PORT>/debug/pprof/`   
     4  - You can get profile data to local by command:  
     5  `curl http://<NODE_IP>:<PPROF_PORT>/debug/pprof/<PROFILE_NAME> > pprof.out`  
     6  Ex: `go tool pprof ./gev http://<NODE_IP>:<PPROF_PORT>/debug/pprof/heap > pprof.out`   
     7  - After that, you can see the visualization of `pprof.out` by this command `go tool pprof -web ./gev ./pprof.out`. It will show you the result after analyzing `./gev` on webbrowser.
     8  - You can do more with `pprof.out` by `go tool pprof ./gev ./pprof.out`
     9  
    10  Here is some profiles you can use directly:
    11  ## CPU Profile  
    12  `go tool pprof http://<NODE_IP>:<PPROF_PORT>/debug/pprof/profile`  
    13  The CPU profiler runs for 30 seconds by default. It uses sampling to determine which functions spend most of the CPU time. The Go runtime stops the execution every 10 milliseconds and records the current call stack of all running goroutines.
    14  
    15  When pprof enters the interactive mode, type `top`, the command will show a list of functions that appeared most in the collected samples. In our case these are all runtime and standard library functions.
    16  
    17  There is a much better way to look at the high-level performance overview - web command, it generates an SVG graph of hot spots and opens it in a web browser.   
    18  
    19  ## Heap Profile
    20  `go tool pprof http://<NODE_IP>:<PPROF_PORT>/debug/pprof/heap`
    21  By default it shows the amount of memory currently in-use.
    22  But we are more interested in the number of allocated objects. Call pprof with -alloc_objects option:  
    23  `go tool pprof -alloc_objects http://<NODE_IP>:<PPROF_PORT>/debug/pprof/heap`
    24  
    25  ## Goroutine Profile
    26  Goroutine profile dumps the goroutine call stack and the number of running goroutines:  
    27  `go tool pprof http://<NODE_IP>:<PPROF_PORT>/debug/pprof/goroutine`  
    28  
    29  ## Block Profile   
    30  Blocking profile shows function calls that led to blocking on synchronization primitives like mutexes and channels.   
    31  `go tool pprof http://<NODE_IP>:<PPROF_PORT>/debug/pprof/block`  
    32  
    33  ...