IntersectMBO / govtool

🔩 GovTool and utilities monorepo.
https://gov.tools
Apache License 2.0
14 stars 9 forks source link

Add connection pooling for database on preview #2342

Open bosko-m opened 2 weeks ago

bosko-m commented 2 weeks ago

Database check (Preview / Database) is added to the health status page for GovTool on Preview. https://status.gov.tools/status/preview-gov-tools

We need to add connection pooling in order to avoid scenario where health status page consume all db connection.

Consider using pgpool or pgbouncer.

bosko-m commented 2 weeks ago

CC @spannercode

stepa-ict commented 2 weeks ago

In this env, we have AWS RDS. It is managed through the Qovery platform, which means that we have limited possibilities to edit and customize the RDS config. However, in AWS, connection pooling can be achieved by using Amazon RDS Proxy which is another component that stands in front of AWS RDS instances. AWS Proxy can be added directly via AWS console (our team doesn't have direct access to AWS console) but since the RDS instance is added via Qovery, this manual editing on Console can lead to configuration drift, as Qovery says on their platform. image

spannercode commented 1 week ago

As I cannot contribute to the solution on this issue, I'm un-assigning myself. So far, the preview environment seems stable on the health checks.

bosko-m commented 1 week ago

@spannercode we do need to take a look at intermittent failures though

aaboyle878 commented 3 days ago

I agree with @stepa-ict we could potentially use RDS Proxy or an alternative could be to add PostgRest as was discussed a while back however this might require some effort as qovery does not natively support a connection pooling solution.

However when setting up DB-Sync I allowed 200 max connections and looking at the activity dashboard on PGAdmin it only ever seems to use a max of 9 at any given time