Lambda connecting to on-prem oracle

0

What would be a good connection pooling strategy for Lambda connecting to on-prem Oracle? Assume the network connectivity has been established. Should I use provisioned concurrency?

4 Answers
0

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.

profile pictureAWS
EXPERT
answered 2 years ago
  • 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.

0

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

AWS
answered 2 years ago
  • Yes, someone from aws team recommended this. Have not had a chance to experiment but Thank you for sharing.

0

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.

profile pictureAWS
EXPERT
Uri
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions