Determine which AlloyDB Omni operator deployment to analyze. The AlloyDB Omni operator includes two deployments, and you can analyze the memory heap for either one. To identify the two deployments, run the following command:
kubectl get deployment -n alloydb-omni-systemThe output shows you the two deployments in the
alloydb-omni-systemnamespace:fleet-controller-managerlocal-controller-manager
You can get the memory heap of either deployment. For demonstration purposes, these steps show how to get the memory heap for the
local-controller-managerdeployment.Turn on memory analysis by specifying an available port to use. After the port is specified, the pod restarts. To specify an available port, use the
pprof-addressargument in the deployment:Open the deployment in a text editor by running the following command:
kubectl edit -n alloydb-omni-system deploy local-controller-managerSpecify the port in the
argsof thecontainersection in the templatespec:apiVersion: apps/v1 kind: Deployment spec: ... template: ... spec: containers: - args - --pprof-address=:PORTSave the deployment file. After you save the deployment file, the pod restarts.
Wait for the pod to restart before continuing to the next step.
To make sure the pod restarted, run the following command:
kubectl get pod -n alloydb-omni-systemVerify that the output value in the pod's
STATUScolumn isRunningand the output value in itsAGEcolumn is a short duration. For example, if theSTATUScolumn isRunningand the value in theAGEcolumn is50s, then the pod has been running for 50 seconds after the restart.Turn on port forwarding using the following command:
kubectl port-forward -n alloydb-omni-system DEPLOYMENT_POD_NAME PORT:PORTReplace DEPLOYMENT_POD_NAME with the name of your deployment as it appears in the
NAMEcolumn of the output of the following command:kubectl get pod -n alloydb-omni-systemIn a different terminal, run the following command to create a file with a snapshot of the memory heap of the deployment:
curl http://localhost:PORT/debug/pprof/heap > heap.outSave the
heap.outfile and use it to view the memory heap of the AlloyDB Omni operator deployment you chose to analyze.Turn off memory analysis by removing the
pprof-addressargument with the port you used from the deployment:Open the deployment in a text editor:
kubectl edit -n alloydb-omni-system deploy local-controller-managerRemove the port
--pprof-address=:PORTline from theargsof thecontainersection in templatespecthat you added earlier.
What's next
- Manage and monitor AlloyDB Omni
- Generate and diagnose AlloyDB Omni dump files
- Learn about automatic memory management