Using DocumentDB with Lambda: connection pooling

0

I would like to implement a modern web app with serverless compute using AWS Lambda and Amazon DocumentDB. How can I manage efficiently connections to the DB? Is there a connection pool mechanism, like the one you have when using Amazon RDS Proxy, to avoid opening and closing connections from every Lambda execution?

Thanks a lot!

AWS
gefragt vor 3 Jahren3376 Aufrufe
1 Antwort
1
Akzeptierte Antwort

Best practices are similar to what you would do when connecting to another data store: declare the variable holding the connection to the database outside your handler so it can be re-utilized by subsequent invocations of your function.

You can find a good example here: https://docs.atlas.mongodb.com/best-practices-connecting-to-aws-lambda.

AWS
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen