Optimiser les instances Cloud SQL avec un grand nombre d'événements de saturation de la mémoire
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
MySQL | PostgreSQL | SQL Server
Cette page décrit l'recommender d'optimisation des instances Cloud SQL pour mémoire insuffisante (OOM), qui vous aide à détecter les instances qui présentent un grand nombre d'événements OOM au cours des sept derniers jours.
Cet outil de recommandation détecte les instances qui présentent un grand nombre d'événements OOM. Il vous fournit ensuite des recommandations sur l'optimisation de ces instances et l'amélioration des performances. Les recommandations sont générées quotidiennement.
Afin de pouvoir afficher les recommandations et les insights, procédez comme suit :
Pour obtenir les autorisations permettant d'afficher et d'utiliser les insights et les recommandations, assurez-vous de disposer des rôles IAM (Identity and Access Management) requis.
Tasks
Rôles
Afficher les recommandations
L'un des rôles suivants : recommender.cloudsqlViewer ou cloudsql.viewer.
Appliquer les recommandations
L'un des rôles suivants : recommender.cloudsqlAdmin, cloudsql.editor ou cloudsql.admin.
Répertorier les recommandations d'optimisation OOM pour une instance
Vous pouvez répertorier les recommandations d'optimisation OOM pour une instance à l'aide de la console Google Cloud, de gcloud CLI ou de l'API Recommender.
Console
Procédez comme suit pour lister les recommandations relatives aux performances des instances à l'aide de la
Cliquez sur Développer les détails dans la bannière Améliorez l'état de l'instance en analysant les problèmes et en agissant sur la base des recommandations.
Cliquez sur Performances dans la fiche Toutes les recommandations.
CLI gcloud
Pour répertorier les recommandations d'optimisation OOM pour une instance à l'aide de gcloud CLI, exécutez la commande gcloud recommender recommendations list comme suit :
LOCATION : région où se trouvent vos instances, par exemple us-central1.
API
Pour répertorier les recommandations d'optimisation OOM pour une instance à l'aide de l'API Recommendations, appelez la méthode recommendations.list comme suit :
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Si l'outil de recommandation détecte des instances avec des événements OOM fréquents, il les répertorie dans une table. Chaque ligne indique le nom de l'instance, une brève recommandation, le type de machine actuel, le type de machine recommandé, l'emplacement et la date de la dernière actualisation.
Afficher les insights et les recommandations détaillées
Vous pouvez afficher les insights et les recommandations détaillées pour les instances nécessitant une optimisation OOM à l'aide de la console Google Cloud, de gcloud CLI ou de l'API Recommender.
Console
Effectuez l'une des opérations suivantes :
Sur la page Recommandations de performances, cliquez sur la fiche Recommandations de performances, puis sur Bonnes pratiques concernant les manques de mémoire fréquents. Le panneau de recommandations s'affiche. Il contient des insights et des recommandations détaillées pour l'instance.
Sur la page Instances, cliquez sur Bonnes pratiques concernant les manques de mémoire fréquents. La liste n'affiche que les instances pour lesquelles la recommandation s'applique.
CLI gcloud
Pour afficher les insights et les recommandations détaillées sur les instances nécessitant une optimisation OOM, exécutez la commande gcloud recommender insights list comme suit :
LOCATION : région où se trouvent vos instances, par exemple us-central1.
API
Pour afficher les insights et les recommandations détaillées sur les instances nécessitant une optimisation OOM, utilisez l'API Recommendations, appelez la méthode insights.list comme suit:
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Appliquer la recommandation
Étudiez attentivement la recommandation et effectuez l'une des opérations suivantes :
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/08 (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/08 (UTC)."],[],[],null,["# Optimize Cloud SQL instances with high number of out-of-memory events\n\n\u003cbr /\u003e\n\nMySQL \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| You can process personal data for this feature as outlined in the\n| [Cloud Data Processing\n| Addendum](/terms/data-processing-addendum), subject to the obligations and restrictions described in the agreement under\n| which you access Google Cloud.\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes the Cloud SQL instance out-of-memory (OOM) optimization [recommender](/recommender/docs/overview) which helps you detect instances that have a high number of OOM events within the last seven days.\n\nThis recommender detects instances that have\na high number of OOM events. It then provides recommendations on how to optimize such\ninstances and improve performance. Recommendations are generated daily.\n\nPricing\n-------\n\nThe Cloud SQL OOM optimization recommender is in the *Standard*\n[Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n================\n\nBefore you can view recommendations and insights, do the following:\n\n- To get the permissions to view and work with insights and recommendations, ensure that you have the required [Identity and Access Management (IAM) roles](/sql/docs/mysql/project-access-control#roles).\n\n For more information about IAM roles, see [IAM basic and predefined roles reference](/iam/docs/understanding-roles) and [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n-\n\n\n Enable the Recommender API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=recommender.googleapis.com)\n\nList OOM optimization recommendations for an instance\n-----------------------------------------------------\n\nYou can list OOM optimization recommendations for an instance\nusing the Google Cloud console, [gcloud CLI](/sdk/gcloud), or the Recommender API. \n\n### Console\n\nTo list recommendations about instance performance by using the\n\nGoogle Cloud console, follow these steps:\n\n1. Go to the **Cloud SQL Instances** page.\n\n[Go to Cloud SQL Instances](https://console.cloud.google.com/sql/instances)\n\n1. Click **Expand Details** on the **Improve instance health by investigating issues and acting on recommendations** banner.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub** . See also [Find and apply recommendations with the Recommendations](/recommender/docs/recommendation-hub/identify-configuration-problems).\n\n2. Click **Performance** in the **All recommendations** card.\n\n### gcloud CLI\n\nTo list OOM optimization recommendations for an instance using gcloud CLI, run the\n[`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list)\ncommand as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.PerformanceRecommender \\\n--filter=recommenderSubtype=MYSQL_FREQUENT_OUT_OF_MEMORY_BEST_PRACTICE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\n### API\n\nTo list OOM optimization recommendations for an instance using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`recommendations.list`](/recommender/docs/reference/rest/v1/projects.locations.recommenders.recommendations/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nIf the recommender detects instances with frequent OOM events, it lists them in a table. Each row shows the instance name, a brief recommendation, the current machine type, the recommended machine type, the location, and the last refresh date.\n\nView insights and detailed recommendations\n------------------------------------------\n\nYou can view insights and detailed recommendations for instances\nthat require an OOM optimization using the Google Cloud console,\n[gcloud CLI](/sdk/gcloud), or the Recommender API. \n\n### Console\n\nDo one of the following:\n\n- On the **Performance Recommendations** page, click **Performance recommendations** card, click **Frequent Out-of-Memory Best Practice**. The recommendation panel appears, which contains insights and detailed recommendations for the instance.\n\n- On the **Instances** page, click **Frequent Out-of-Memory Best Practice**. The list of instances displays only those instances for which the recommendation applies.\n\n### gcloud CLI\n\nTo view insights and detailed recommendations about instances that require an OOM optimization, run the\n[`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list)\ncommand as follows: \n\n```\ngcloud recommender insights list \\\n--project=PROJECT-ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.PerformanceInsight \\\n--filter=insightSubtype=MYSQL_FREQUENT_OUT_OF_MEMORY\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\n### API\n\nTo view insights and detailed recommendations about instances that require an OOM optimization, use the\n[Recommendations API](/recommender/docs/using-api), call the\n[`insights.list`](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nApply recommendation\n--------------------\n\nEvaluate the recommendation carefully and do any of the following:\n\n- For more information, see [Optimize instance high memory usage](/sql/docs/mysql/optimize-high-memory-usage).\n- To dismiss the recommendation so that it's de-emphasized and appears dimmed, click **Dismiss**.\n- To close the panel without applying or dismissing the recommendation, click **Cancel**.\n\nWhat's next\n-----------\n\n- [Google Cloud recommenders](/recommender/docs/recommenders)\n- [About database observability](/sql/docs/mysql/observability)"]]