Relative Content

Tag Archive for google-cloud-sqlconnection-poolinggoogle-cloud-runpgbouncerpgpool

How to implement a connection pool on Cloud Run and Cloud SQL

I have an application running within the Cloud Run infrastructure. It was built with FastAPI and SQLAlchemy. The database is a Postgres, managed by Cloud SQL.
At a certain point, the database alerts that the maximum number of connections has been exceeded. My suspicion is that I’m using a connection pool of size 5, and when the container in production eventually dies due to inactivity, these connections are not returned to the pool. This continues until all connections are consumed.