10

Having a microservices architecture, multiple services speak to my PostgresSQL database. If I now want to deploy parts of my application as AWS Lambda functions, how can I avoid running out of connections?

Reading a couple of articles [1], [2], [3] I realized PgBouncer may be a good fit for my microservice architecture.

Do I need a "microservice" in front of my database? How to set this up with AWS Lambda?

1 Answer 1

6

According to this thread on AWS developer forum, AWS Lambda try to reuse old process when it's possible, which offers possiblity to use a client connection pooling.

In my opininon, use a dedicated connection pooler in front of your database is always a good idea. With it, you minimize open connection on your database, which can be an resource consumer. You can find more information, for Postgresql, on this blog post

As far as I am aware, AWS doesn't offer a dedicated service for connection pooling. You can use a dedicated instance for this. For Postgresql, PgBouncer is a good option. It doesn't need a heavly cpu or large amount of memory, but you still prefere a network optimized instance. And be careful, with only on instance of PgBouncer, you introduce a spof in your architecture.

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

3 Comments

With all the services they offer and they do not offer a connection pooler as a service... it's a shame.
Let's hope Aurora Serverless fixes that
For those reading this, AWS now offers a RDS Proxy - which is sort of like "connection pooler as a service"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.