Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
MySQL | PostgreSQL | SQL Server
Bei Datenbankinstanzen, die mit einer zu niedrigen oder zu hohen Arbeitsspeicherzuweisung ausgeführt werden, können Leistungsprobleme auftreten. Manchmal kann es bei Instanzen zu Problemen mit unzureichendem Arbeitsspeicher kommen.
Das Flag max server memory (mb) begrenzt die Menge an Arbeitsspeicher, die Cloud SQL für die internen Pools zuweisen kann. Sie können einen Wert für dieses Flag manuell festlegen oder das Flag weglassen. In diesem Fall verwaltet Cloud SQL die Speicherlimits automatisch für Sie.
Wenn Sie das Flag nicht aktivieren, verwaltet Cloud SQL die Arbeitsspeicherlimits der Instanz automatisch anhand der RAM-Größe Ihrer Instanz.
Wenn Sie das Flag aktivieren und manuell einen Wert dafür festlegen und die Größe der Instanz später ändern, deaktiviert Cloud SQL das Flag, überschreibt den zuvor angegebenen Wert und verwaltet die Arbeitsspeicherlimits der Instanz automatisch für Sie, bis ein neuer max server memory (mb)-Wert angegeben wird.
Unzureichende Werte für das Flag können zu Leistungsproblemen führen, während eine Überzuweisung zu Instabilität, Leistungseinbußen und Datenbankabstürzen führen kann.
Wir empfehlen Nutzern dringend, die Speicherlimits der Instanz von Cloud SQL verwalten zu lassen.
Prüfen Sie, ob Sie die erforderlichen IAM-Rollen (Identity and Access Management) haben, um die Berechtigungen zum Aufrufen und Verwenden von Informationen und Empfehlungen zu erhalten.
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations
Ersetzen Sie Folgendes:
PROJECT_ID: Ihre Projekt-ID.
LOCATION: Eine Region, in der sich Ihre Instanzen befinden, z. B. us-central1.
Informationen und detaillierte Empfehlungen anzeigen
So rufen Sie Statistiken und detaillierte Empfehlungen auf:
Console
Führen Sie einen der folgenden Schritte aus:
Klicken Sie auf der Seite Leistungsempfehlungen auf die Karte Leistungsempfehlungen und dann auf Indexe erstellen oder Joineinstellungen neu konfigurieren. Der Bereich „Empfehlung“ wird angezeigt. Dieser enthält Informationen und detaillierte Empfehlungen für die Instanz.
Klicken Sie auf der Seite Instanzen auf Indexe erstellen oder Join-Einstellungen neu konfigurieren.
In der Liste der Instanzen werden nur die Instanzen angezeigt, für die die Empfehlung gilt.
LOCATION: eine Region, in der sich Ihre Instanzen befinden, z. B. us-central1
INSIGHT_SUBTYPE: Der Untertyp, der verwendet wird, um zu prüfen, ob der zugewiesene Arbeitsspeicher zu niedrig oder zu hoch ist. Zulässige Werte sind SQLSERVER_MAX_SERVER_MEMORY_TOO_LOW und SQLSERVER_MAX_SERVER_MEMORY_TOO_HIGH.
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights
Ersetzen Sie Folgendes:
PROJECT_ID: Ihre Projekt-ID.
LOCATION: Eine Region, in der sich Ihre Instanzen befinden, z. B. us-central1.
Empfehlung anwenden
Console
So implementieren Sie diese Empfehlung:
Suchen Sie nach der Instanz mit der Empfehlung Serverarbeitsspeicher falsch konfiguriert.
Klicken Sie auf die Empfehlung, um sie zu öffnen.
Klicken Sie im Empfehlungsfenster auf Instanz bearbeiten.
Suchen Sie im Abschnitt Flags und Parameter nach dem Flag Max server memory (mb) und löschen Sie es. Wenn Sie das Flag entfernen, kann Cloud SQL die Arbeitsspeicherlimits für Instanzen für Sie verwalten.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Optimize maximum server memory usage\n\n\u003cbr /\u003e\n\nMySQL \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\nDatabase instances running with an allocation of memory that's either too low or\ntoo high might experience performance issues. Instances can sometimes run into\nout-of-memory (OOM) issues.\n\nThe [`max server memory (mb)`](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/server-memory-server-configuration-options)\nflag limits the amount of memory that Cloud SQL can allocate for its\ninternal pools. You can manually set a value for this flag, or omit the flag\nand let Cloud SQL manage memory limits for you automatically.\n\n- If you don't enable the flag, then Cloud SQL manages the instance's\n memory limits for you automatically, based on the size of the RAM for your\n instance.\n\n- If you enable the flag and manually set a value for it, and later resize the\n instance, then Cloud SQL disables the flag, overrides the value\n previously given, and automatically manages the memory limits of the instance\n for you until a new `max server memory (mb)` value is provided.\n\nInsufficient values for the flag can cause performance issues, while\nover-allocation can lead to instability, performance degradation, and database\ncrashes.\n\nUsers are strongly encouraged to let Cloud SQL manage the instance's\nmemory limits.\n\nFor more information, see\n[SQL Server settings](/sql/docs/sqlserver/best-practices#sqlserver_settings_global).\n\nPricing\n-------\n\nThe **Maximum server memory** recommender is in the\n*Standard* [Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n----------------\n\n[Enable the Recommender API](/recommender/docs/enabling).\n\n### Required roles and permissions\n\nTo get the permissions to view and work with insights and recommendations,\nensure that you have the required [Identity and Access Management (IAM) roles](/sql/docs/sqlserver/project-access-control#roles).\n\nFor 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\u003cbr /\u003e\n\nList the recommendations\n------------------------\n\nTo list the recommendations, follow these steps: \n\n### Console\n\nTo list recommendations about instance performance, 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. On the **Improve instance health by investigating issues and acting on\n recommendations** banner, click **Expand Details**.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub** . See also [Find and applyrecommendations with the Recommendations](/recommender/docs/recommendation-hub/identify-configuration-problems).\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n2. In the **All recommendations** card, click **Performance** .\n\n### gcloud\n\nRun the [`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list) command as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.PerformanceRecommender \\\n--filter=RECOMMENDER_SUBTYPE=SQLSERVER_USE_AUTOMATIC_MAX_SERVER_MEMORY_MANAGEMENT\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\nCall the [`recommendations.list`](/recommender/docs/reference/rest/v1/projects.locations.recommenders.recommendations/list) method 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\nView insights and detailed recommendations\n------------------------------------------\n\nTo view insights and detailed recommendations, follow these steps: \n\n### Console\n\nDo one of the following:\n\n- On the **Performance Recommendations** page, click the **Performance\n recommendations** card and then click **Create indexes or\n reconfigure join settings**. The recommendation panel appears, which\n contains insights and detailed recommendations for the instance.\n\n- On the **Instances** page, click **Create indexes or reconfigure join settings**.\n The list of instances displays only those instances for which the\n recommendation applies.\n\n### gcloud\n\nRun the [`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list) command as follows: \n\n```\n\ngcloud recommender insights list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.PerformanceInsight \\\n--filter=INSIGHT_SUBTYPE=INSIGHT_SUBTYPE\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- \u003cvar translate=\"no\"\u003eINSIGHT_SUBTYPE\u003c/var\u003e: the subtype used to verify whether allocated memory is too low or too high. Acceptable values include `SQLSERVER_MAX_SERVER_MEMORY_TOO_LOW` and `SQLSERVER_MAX_SERVER_MEMORY_TOO_HIGH`.\n\n### API\n\nCall the [`insights.list`](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/list) method as follows: \n\n```\n\nGET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights\n\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 the recommendation\n------------------------\n\n### Console\n\nTo implement this recommendation, do the following:\n\n- Locate the instance with the recommendation **Server memory misconfigured**.\n Click the recommendation to open it.\n\n- In the recommendation window, click **Edit instance**.\n\n- In the **Flags and parameters** section, locate and delete the\n **Max server memory (mb)** flag. Removing the flag lets Cloud SQL\n manage instance memory limits for you.\n\nWhat's next\n-----------\n\n- [Google Cloud recommenders](/recommender/docs/recommenders)"]]