How to get profile data from a openshift process on OpenShift 3 ?

Solution Verified - Updated

Environment

OpenShift Container Platform (master API)

Issue

How to get profile data from openshift process like memory, CPU load and blocking?

Resolution

You can hit oc get --raw /debug/pprof/<PROFILE>.

For openshift node, you need to specify --server https://<IP or hostname>:10250 for example:

oc get --raw /debug/pprof/heap?debug=1 --server https://knakayam-ose37-all:10250 

In the same manner, for openshift master controllers, you need to specify --server https://<IP or hostname>:8444.

Without --server https://HOST:PORT, oc command collects profile from master API. However, please notice that your access was load balanced if you have multiple master hosts.

Here is the example of the list:

NOTE: You need to run commands with admin role (e.g cluster-admin).

goroutine

# oc get --raw /debug/pprof/goroutine?debug=1 --server https://HOST:PORT

heap

# oc get --raw /debug/pprof/heap?debug=1 --server https://HOST:PORT

threadcreate

# oc get --raw /debug/pprof/threadcreate?debug=1 --server https://HOST:PORT

full goroutine stack dump

# oc get --raw /debug/pprof/goroutine?debug=2 --server https://HOST:PORT

Trace 30s CPU

NOTE This command takes 30 secsand outputs raw data.

# oc get --raw /debug/pprof/profile --server https://HOST:PORT

Heap dump & total allocations

NOTE This command outputs raw data.

# oc get --raw /debug/pprof/heap --server https://HOST:PORT
SBR
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.