This document describes how you can get a snapshot of the memory heap of AlloyDB Omni operator to help diagnose and debug potential memory issues. Use the following steps to get a memory heap for analysis:
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-system
The output shows you the two deployments in the
alloydb-omni-system
namespace:fleet-controller-manager
local-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-manager
deployment.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-address
argument in the deployment:Open the deployment in a text editor by running the following command:
kubectl edit -n alloydb-omni-system deploy local-controller-manager
Specify the port in the
args
of thecontainer
section in the templatespec
:apiVersion: apps/v1 kind: Deployment spec: ... template: ... spec: containers: - args - --pprof-address=:PORT
Save 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-system
Verify that the output value in the pod's
STATUS
column isRunning
and the output value in itsAGE
column is a short duration. For example, if theSTATUS
column isRunning
and the value in theAGE
column 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:PORT
Replace DEPLOYMENT_POD_NAME with the name of your deployment as it appears in the
NAME
column of the output of the following command:kubectl get pod -n alloydb-omni-system
In 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.out
Save the
heap.out
file 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-address
argument with the port you used from the deployment:Open the deployment in a text editor:
kubectl edit -n alloydb-omni-system deploy local-controller-manager
Remove the port
--pprof-address=:PORT
line from theargs
of thecontainer
section in templatespec
that you added earlier.
What's next
- Run and connect to AlloyDB Omni
- Generate and diagnose AlloyDB Omni dump files
- Learn about automatic memory management