Reconfigure connection settings Stay organized with collections Save and categorize content based on your preferences.
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. You can process personal data for this feature as outlined in theCloud Data Processing Addendum, subject to the obligations and restrictions described in the agreement under which you access Google Cloud. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This page describes how to manage databases with a high number of simultaneousclient connections and a high number of database connection threads. Thisrecommender is calledReconfigure connection settings.
Every day, this recommender analyzes metrics for the following:
The peak number of database connections by tracking the value ofthe
max_used_connectionsflag. If the maximum number of connections sincethe server restarted is 80% of the valuemax_connections,Reconfigureconnection settings recommends that you increase the value ofmax_connections.For more information on increasing the value of
max_connections, seeMaximum concurrent connections.The number of new database connection threads compared to the number ofexisting database connection threads. If more than 50% of connections resultin new threads instead of reusing cached ones, or if the value of
thread_cache_sizeis set to 0, thenReconfigure connection settingsrecommends that you increase the value ofthread_cache_size.For more information on increasing the value of
max_connections, seeOptimize high CPU utilization in instances.This feature is inPreview.
Pricing
TheReconfigure connection settings recommender is in theStandardRecommender pricing tier.
Before you begin
Required roles and permissions
To get the permissions to view and work with insights and recommendations, ensure that you have the requiredIdentity and Access Management (IAM) roles.
| Task | Role |
|---|---|
| View recommendations | recommender.cloudsqlViewer orcloudsql.admin. |
| Apply recommendations | cloudsql.editor orcloudsql.admin. |
List the recommendations
To list the recommendations, follow these steps:
Console
To list recommendations about instance performance, follow these steps:
- Go to theCloud SQL Instances page.
- On theImprove instance health by investigating issues and acting onrecommendations banner, clickExpand Details.
Alternatively, follow these steps:
Go to theActive Assist. See alsoFind and apply recommendations with the Recommendations.
In theAll recommendations card, clickPerformance .
gcloud
Run thegcloud recommender recommendations list command as follows:
gcloud recommender recommendations list \--project=PROJECT_ID \--location=LOCATION \--recommender=google.cloudsql.instance.PerformanceRecommender \--filter=recommenderSubtype=MYSQL_RECONFIG_CONNECTIONS
Replace the following:
- PROJECT_ID: your project ID
- LOCATION: a region where your instances are located, such as
us-central1
API
Call therecommendations.list method as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations
Replace the following:
- PROJECT_ID: your project ID
- LOCATION: a region where your instances are located, such as
us-central1
View insights and detailed recommendations
To view insights and detailed recommendations, follow these steps:
Console
Do one of the following:
On thePerformance Recommendations page, click thePerformancerecommendations card and then clickReconfigure connection settings.The recommendation panel appears, which contains insights and detailedrecommendations for the instance.
On theInstances page, clickReconfigure connection settings.The list of instances displays only those instances for which therecommendation applies.
gcloud
Run thegcloud recommender insights list command as follows:
gcloud recommender insights list \--project=PROJECT_ID \--location=LOCATION \--insight-type=google.cloudsql.instance.PerformanceInsight \--filter=insightSubtype=INSIGHT_SUBTYPE
Replace the following:
- PROJECT_ID: your project ID
- LOCATION: a region where your instances are located, such as
us-central1 - INSIGHT_SUBTYPE: set this parameter to one of the following:
MYSQL_HIGH_NUMER_OF_CONNECTIONS: display insights forthe number of database connections for your instanceMYSQL_HIGH_THREAD_CACHE_MISS_RATE: display insights forthe number of new database connection threads without using thethread cache for your instance
API
Call theinsights.list method as follows:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights
Replace the following:
- PROJECT_ID: your project ID
- LOCATION: a region where your instances are located, such as
us-central1
Apply the recommendation
To implement this recommendation, do one of the following:
To apply the recommendation for the connection thread cache size, do one ofthe following:
If the value of
thread_cache_sizeis set to 0, then enable the threadcache by setting this flag to a value greater than 0.If the value of
thread_cache_sizeis greater than 0, then increase thevalue of this flag.thread_cache_sizeshould be equivalent to the averagenumber of connections to the database. Increase the value ofthread_cache_sizeif the number of new threads is higher than the currentsetting.
To apply the database connection recommendation, increase the value of the
max_connectionsflag. The recommendation is updated daily, so after youincrease the value of this flag, wait for 24 hours before checking the recommendation again. For more information onincreasing the value ofmax_connections, seeMaximum concurrent connections.
thread_cache_size andmax_connections requires more memory.After increasing these flags, monitor the memory usage.What's next
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.