We are bouncing into "Connection refused" errors in our application despite having limit in Cloud SQL high enough.
I found this error in Cloud-run error log:
"Exceeded maximum of 100 connections per instance for CLOUD_SQL_INSTANCE_NAME."
logName: "projects/PROJECT_ID/logs/run.googleapis.com%2Fvarlog%2Fsystem"
Our Cloud SQL (MySQL 8) is being run with this VM: db-n1-standard-1 and it has max_connections variable set 4030 (this is the default) so I guess the restriction is not coming from the database itself.
In documentation there is no mention of any limitation of Cloud SQL connections from Cloud Run side, just the general one enforced by database itself.
Am I missing anything? Is it a bug or undocumented feature? Thanks for any answer!
So I got a response from Cloud SQL Documentation team:
I've learned that Cloud Run uses the same mechanism as App Engine to control connections to Cloud SQL. This mechanism has a max connections limit that is independent of the database setting.
This limit is 100 per instance. That means each instance of the application can have 100 connections, and as it scales the total number of connections per deployment can grow.
The user doesn't have any ability to change this limit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With