3

I'm fairly new when it comes to building and managing the back-end architecture of an application.

I'm hosting a Ruby on Rails application through AWS and one of the services I'm using is AWS RDS.

I've recently come across an issue where I reached the limit on the number of database connections I can make on my DB instance (seemingly as a result of Elastic Beanstalk deployments connecting to my DB when running the DB migrations, and not closing (?) the connections after it's done), and don't know how to best go about addressing it and managing it.

For anyone that has had experience using Amazon RDS with a PostgreSQL DB, what resources/services do I need to setup in order to make sure I manage my database connections correctly (so that I avoid the limit as much as possible)?

I have heard of PGBouncer for managing Database Connections, but I was wondering if there were other resources/services that anyone else can share so that I can make a more informed decision on what to use.

1 Answer 1

1

Had a similar issue myself awhile back. You can look into the Rails Reaper as well to see if that suits your purposes, but it was PGBouncer that ended up fixing my issue

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Rocco for your answer! Glad to see someone who had a similar issue; any idea if using PGBouncer will close very stale database connections also? Or will it just keep all my existing connections open for any connecting client to use?
No problem! It should close connections that remain unused for too long as well (it has for me at least), but let me know if you have any issues
Thanks! By chance, do you have a specific tutorial you bookmarked on how to setup PGBouncer? If not it's fine, I have one but I wanted to compare in case you have a different resource
No but the setup wasn't too bad. I just followed the instructions on their git page and everything worked fine

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.