Go pprof: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 17: Line 17:
=Overview=
=Overview=
Go comes with built-in frameworks for testing and profiling.
Go comes with built-in frameworks for testing and profiling.
=Subjects=
* [[Go_pprof_Concepts#Overview|Concepts]]
* [[Go_pprof_Operations#Overview|Operations]]


=Concepts=
=Concepts=

Revision as of 03:29, 16 November 2024

External

Internal

Reading List

Read these and link those wroth it from External:

Overview

Go comes with built-in frameworks for testing and profiling.

Subjects

Concepts

Profile

Profile a Running Process

Assuming that your local 127.0.0.1 address is aliased to "localhost.somedomain.com" in /etc/hosts and the certificates are issued for "localhost.somedomain.com", set CERT_PATH to the directory that contains and and:

export CERT_PATH=/Users/ovidiu/some-project/config
go tool pprof -http 127.0.0.1:8080 -tls_cert ${CERT_PATH}/localhost.somedomain.com.chain.pem -tls_key ${CERT_PATH}/localhost.somedomain.com.key.pem https://localhost.somedomain.com:8443

Inspect a Running Process with a Browser

Go to https://localhost.somedomain.com:8443/debug/pprof/

Dump the Goroutines into a Text File

curl -k https://localhost:8443/debug/pprof/goroutine?debug=2

Replace the port with the actual HTTP(S) port the process is listening on.