Déterminez quel déploiement d'opérateur AlloyDB Omni analyser. L'opérateur AlloyDB Omni inclut deux déploiements, et vous pouvez analyser le tas de mémoire pour l'un ou l'autre. Pour identifier les deux déploiements, exécutez la commande suivante :
kubectlgetdeployment-nalloydb-omni-system
Le résultat affiche les deux déploiements dans l'espace de noms alloydb-omni-system :
fleet-controller-manager
local-controller-manager
Vous pouvez obtenir le tas de mémoire de l'un ou l'autre déploiement. À des fins de démonstration, ces étapes montrent comment obtenir le tas de mémoire pour le déploiement local-controller-manager.
Activez l'analyse de la mémoire en spécifiant un port disponible à utiliser. Une fois le port spécifié, le pod redémarre. Pour spécifier un port disponible, utilisez l'argument pprof-address dans le déploiement :
Ouvrez le déploiement dans un éditeur de texte en exécutant la commande suivante :
Enregistrez le fichier de déploiement. Une fois le fichier de déploiement enregistré, le pod redémarre.
Attendez que le pod redémarre avant de passer à l'étape suivante.
Pour vous assurer que le pod a redémarré, exécutez la commande suivante :
kubectlgetpod-nalloydb-omni-system
Vérifiez que la valeur de sortie dans la colonne STATUS du pod est Running et que la valeur de sortie dans sa colonne AGE est une durée courte. Par exemple, si la colonne STATUS est Running et que la valeur de la colonne AGE est 50s, cela signifie que le pod est en cours d'exécution depuis 50 secondes après le redémarrage.
Activez le transfert de port à l'aide de la commande suivante :
Enregistrez le fichier heap.out et utilisez-le pour afficher le tas de mémoire du déploiement de l'opérateur AlloyDB Omni que vous avez choisi d'analyser.
Désactivez l'analyse de la mémoire en supprimant l'argument pprof-address avec le port que vous avez utilisé lors du déploiement :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis document outlines the steps to capture a memory heap snapshot of the AlloyDB Omni operator for diagnosing memory-related issues.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves identifying one of two AlloyDB Omni operator deployments (\u003ccode\u003efleet-controller-manager\u003c/code\u003e or \u003ccode\u003elocal-controller-manager\u003c/code\u003e) to analyze.\u003c/p\u003e\n"],["\u003cp\u003eMemory analysis is enabled by adding the \u003ccode\u003e--pprof-address\u003c/code\u003e argument with an available port to the chosen deployment's configuration, which triggers a pod restart.\u003c/p\u003e\n"],["\u003cp\u003eAfter enabling memory analysis, a memory heap snapshot can be created by using \u003ccode\u003ecurl\u003c/code\u003e command that saves it to a file named \u003ccode\u003eheap.out\u003c/code\u003e, accessible via port forwarding.\u003c/p\u003e\n"],["\u003cp\u003eAfter analysis, it's critical to disable memory analysis by removing the \u003ccode\u003epprof-address\u003c/code\u003e argument from the deployment configuration to prevent potential security risks.\u003c/p\u003e\n"]]],[],null,["# Analyze AlloyDB Omni Kubernetes operator memory heap usage\n\nSelect a documentation version: Current (16.8.0)keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/analyze-memory-heap-usage)\n- [16.8.0](/alloydb/omni/16.8.0/docs/analyze-memory-heap-usage)\n- [16.3.0](/alloydb/omni/16.3.0/docs/analyze-memory-heap-usage)\n- [15.12.0](/alloydb/omni/15.12.0/docs/analyze-memory-heap-usage)\n- [15.7.1](/alloydb/omni/15.7.1/docs/analyze-memory-heap-usage)\n- [15.7.0](/alloydb/omni/15.7.0/docs/analyze-memory-heap-usage)\n\n\u003cbr /\u003e\n\nThis 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:\n\n\u003cbr /\u003e\n\n1. Determine which AlloyDB Omni operator deployment to analyze. The\n AlloyDB Omni operator includes two deployments, and you can analyze\n the memory heap for either one. To identify the two deployments, run the\n following command:\n\n kubectl get deployment -n alloydb-omni-system\n\n The output shows you the two deployments in the `alloydb-omni-system`\n namespace:\n - `fleet-controller-manager`\n - `local-controller-manager`\n\n You can get the memory heap of either deployment. For demonstration purposes,\n these steps show how to get the memory heap for the\n `local-controller-manager` deployment.\n2. Turn on memory analysis by specifying an available port to use. After the\n port is specified, the pod restarts. To specify an available port, use the\n `pprof-address` argument in the deployment:\n\n 1. Open the deployment in a text editor by running the following command:\n\n kubectl edit -n alloydb-omni-system deploy local-controller-manager\n\n 2. Specify the port in the `args` of the `container` section in the template\n `spec`:\n\n apiVersion: apps/v1\n kind: Deployment\n spec:\n ...\n template:\n ...\n spec:\n containers:\n - args\n - --pprof-address=:\u003cvar translate=\"no\"\u003ePORT\u003c/var\u003e\n\n | **Important:** To prevent malicious use of the feature, turn off memory analysis by removing this port argument when you finish analyzing the memory heap.\n 3. Save the deployment file. After you save the deployment file, the pod\n restarts.\n\n3. Wait for the pod to restart before continuing to the next step.\n\n To make sure the pod restarted, run the following command: \n\n kubectl get pod -n alloydb-omni-system\n\n Verify that the output value in the pod's `STATUS` column is `Running` and the\n output value in its `AGE` column is a short duration. For example, if the\n `STATUS` column is `Running` and the value in the `AGE` column is `50s`, then\n the pod has been running for 50 seconds after the restart.\n4. Turn on port forwarding using the following command:\n\n kubectl port-forward -n alloydb-omni-system \u003cvar translate=\"no\"\u003eDEPLOYMENT_POD_NAME\u003c/var\u003e \u003cvar translate=\"no\"\u003ePORT\u003c/var\u003e:\u003cvar translate=\"no\"\u003ePORT\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eDEPLOYMENT_POD_NAME\u003c/var\u003e with the name of your deployment as it\n appears in the `NAME` column of the output of the following command: \n\n kubectl get pod -n alloydb-omni-system\n\n5. In a different terminal, run the following command to create a file with a\n snapshot of the memory heap of the deployment:\n\n curl http://localhost:\u003cvar translate=\"no\"\u003ePORT\u003c/var\u003e/debug/pprof/heap \u003e heap.out\n\n6. Save the `heap.out` file and use it to view the memory heap of the\n AlloyDB Omni operator deployment you chose to analyze.\n\n7. Turn off memory analysis by removing the `pprof-address` argument with the\n port you used from the deployment:\n\n 1. Open the deployment in a text editor:\n\n kubectl edit -n alloydb-omni-system deploy local-controller-manager\n\n 2. Remove the port `--pprof-address=:`\u003cvar translate=\"no\"\u003ePORT\u003c/var\u003e line from the\n `args` of the `container` section in template `spec` that you added\n earlier.\n\nWhat's next\n-----------\n\n- [Manage and monitor AlloyDB Omni](/alloydb/omni/current/docs/run-connect)\n- [Generate and diagnose AlloyDB Omni dump files](/alloydb/omni/current/docs/manage-dump-files)\n- [Learn about automatic memory management](/alloydb/omni/current/docs/automatic-memory-management)"]]