- Mais recentes
- Mais votos
- Mais comentários
If your intention is to reduce the number of concurrent lambda invocations to a certain number so you don't open more than a fixed number of connections to your on-prem Oracle database, then you may want to look at reserved concurrency - https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html
Provisioned concurrency helps reduce cold start times because the lambda service keeps that many lambda functions initialized and ready to act on an event, so you don't pay the cold start penalty.
Have you considered using Database Resident Connection Pool (DRCP) on Oracle Database? It provides a connection pool in the database server. You can see the detailed information by the following document. https://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-processes.html#GUID-BB76E57C-3F16-4C85-AEF6-BA14FC1B4777
Yes, someone from aws team recommended this. Have not had a chance to experiment but Thank you for sharing.
You can't really have a connection pool inside Lambda as each Lambda instance is isolated for the others. RDS proxy is an external component that we use to create a connection pool, but it does not support Oracle or on-premises databases.
If you want to actually have a connection pool, you will need to create your own proxy layer, similar to RDS proxy, that Lambda functions connect to, and it connects to the database.
Another option is to limit the number of Lambda function instances so that you do not have too many connections. This is not really a connection pool, but it will protect the database from to many connections. The way to limit number of instances is using Reserved Concurrency. The functions will create the DB connection at Init time and will maintain it open for the life time of the function.
Conteúdo relevante
- AWS OFICIALAtualizada há 2 meses
- AWS OFICIALAtualizada há 3 anos
- AWS OFICIALAtualizada há 2 anos
I don't want every Lambda that inits to open a new connection to database. Like in a typical non-serverless applications you maintain a pool of connections to database and avoid opening a connection prior to issuing the query (or transaction) - much like what RDS Proxy offers. One option I can think of is using provisioned concurrency - since we have a warm pool each one can have one open session but its still inefficient.