Cloud SQL Proxy connection pool exhaustion and metric visibility
0 reputation · 04 Apr 2021, 13:51 UTC
Connection Pool Management
The Cloud SQL Proxy manages a per-process connection pool to limit TCP connections to a Cloud SQL instance. While the --max_connections flag allows for pool size adjustments, the proxy does not dynamically synchronize these limits with the instance's internal max_connections setting.
Observability Constraints
In environments where client libraries (such as JDBC or Go) implement their own pooling layers, a double-layered limit is created. This architecture can lead to intermittent connection refusals when the proxy pool is exhausted, yet the proxy does not natively export real-time pool usage metrics to Cloud Monitoring (Stackdriver).
Given these constraints, how can current pool utilization be monitored without relying solely on retrospective log analysis for "connection pool exhausted" entries? Additionally, what is the recommended strategy for aligning client-side pool sizes with the proxy's --max_connections limit to prevent silent exhaustion?