Questa pagina descrive cos'è il pooling di connessioni gestito e come utilizzarlo per ottimizzare
la gestione delle connessioni al database per le tue istanze Cloud SQL utilizzando il pooling.
Il pooling delle connessioni gestito consente di scalare i carichi di lavoro ottimizzando l'utilizzo delle risorse
e la latenza di connessione per le istanze Cloud SQL utilizzando il pooling.
Il pool di connessioni gestito crea un pool di thread per gestire
le richieste in entrata. Ciò offre miglioramenti significativi delle prestazioni, soprattutto per le connessioni scalate, assorbendo picchi improvvisi di connessione senza sovraccaricare il server con un aumento del numero di thread.
Per utilizzare il pool di connessioni gestito, la tua istanza deve soddisfare i seguenti requisiti:
L'istanza deve essere un'istanza Cloud SQL Enterprise Plus.
Il pool di connessioni gestito richiede un numero di versione di manutenzione
minimo di MYSQL_$version.R20250531.01_10. Per saperne di più sull'esecuzione della manutenzione self-service, consulta Eseguire la manutenzione self-service.
L'opzione max_pool_size controlla il livello di concorrenza per il pool di connessioni gestito.
Il valore predefinito dipende dal numero di core vCPU nella configurazione della macchina dell'istanza.
Limitazioni
Quando utilizzi il pool di connessioni gestito con le istanze Cloud SQL Enterprise Plus, tieni presente
queste limitazioni:
L'attivazione del pool di connessioni gestito su un'istanza esistente comporta
il riavvio del database.
Quando il pool di connessioni gestito è abilitato per l'istanza, il valore della metrica
thread_cache_size
è impostato su 0 per impostazione predefinita.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Managed Connection Pooling overview\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/managed-connection-pooling \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\n|\n| **Preview\n| --- [Managed Connection Pooling](/sql/docs/mysql/managed-connection-pooling)**\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 what Managed Connection Pooling is and how to use it with your\nCloud SQL instances.\n\nManaged Connection Pooling lets you scale your workloads by optimizing resource utilization\nand connection latency for your Cloud SQL for MySQL instances using pooling.\nManaged Connection Pooling creates a pool of threads to handle\nincoming requests. This delivers significant performance improvements,\nespecially for scaled connections, by absorbing sudden connection spikes without\noverloading the server with a growth in the number of threads.\n\n\nWhile you can use Managed Connection Pooling for any transactional workloads,\nManaged Connection Pooling provides the most throughput and latency benefit with applications\nthat contain short-lived connections, or applications that result in a\nconnection surge.\n\nFor long-lived connections, the connection performance using\nManaged Connection Pooling can be slightly lower than when using a direct\nconnection. In this case, Managed Connection Pooling provides connection\nscaling when the number of connections is very high. However, for\napplications that typically establish long-lived connections, you might use\ndirect connections to your instance instead.\n\nFor more information on how to enable Managed Connection Pooling, see\n[Configure Managed Connection Pooling](/sql/docs/mysql/configure-mcp).\n\nRequirements\n------------\n\nTo use Managed Connection Pooling, your instance must meet the following requirements:\n\n- Your instance must be a Cloud SQL Enterprise Plus edition instance.\n- Managed Connection Pooling requires a minimum maintenance version number of `MYSQL_$version.R20250304.00_01`. For more information, see [Perform self-service maintenance](/sql/docs/mysql/self-service-maintenance).\n\nPorts used by Managed Connection Pooling for Cloud SQL instances\n----------------------------------------------------------------\n\nWhen you enable Managed Connection Pooling, the ports used by Cloud SQL instances to serve database traffic change. Managed Connection Pooling changes how MySQL handles connections, but the port numbers remain the same. The ports used by Managed Connection Pooling are as follows:\n\n- **TCP port 3306** : used for direct connections by the MySQL database server. This is the default port number used when [directly connecting using mysql client](/sql/docs/mysql/connect-admin-ip#connect).\n- **TCP port 3307**: used for the Cloud SQL Auth Proxy only connections by the Managed Connection Pooling server. When you use Cloud SQL Auth Proxy to connect to Managed Connection Pooling server, this port number is configured with the Cloud SQL Auth Proxy client and can't be changed.\n\nAvailable configuration options\n-------------------------------\n\nYou can [customize Managed Connection Pooling](/sql/docs/mysql/configure-mcp#modify-mcp) by using the following configuration parameters:\n\n\u003cbr /\u003e\n\n- `max_pool_size`: the amount of concurrency for MCP. The default value is number of cores in your database.\n\nLimitations\n-----------\n\nConsider the following limitations when using Managed Connection Pooling with\nyour Cloud SQL Enterprise Plus edition instances:\n\n- Enabling Managed Connection Pooling on an existing instance results in a database restart.\n- When you use the Cloud SQL API to enable, disable, or configure Managed Connection Pooling, the `instance.update` API can't contain any other instance configuration updates.\n\nWhat's next\n-----------\n\n- [Create an instance](/sql/docs/mysql/create-instance)\n- [Configure Managed Connection Pooling](/sql/docs/mysql/configure-mcp)"]]