Skip to content

How to increase invocations & scaling when calling Lambda from RDS?

0

Hi there,

as per the docs here, I have successfully set up everything to invoke a Lambda function from within RDS.

In doing so, I, of course, want to return data, so am using the synchronous mode.

In experimenting with Lambda settings as well as RDS Postgres instance size (t3.micro and m5.large) it seems no normal performance parameters have any impact on the execution time as the extension is executing the Lambda sequentially per row and maxes out at approx. 900 invocations per minute.

Max connections tweaking does not do anything, Lambda concurrency is practically not used and Lambda Memory has no impact. This is the only Lambda active in my account globally, so no limit to concurrency up to the 1k default.

In my scenario, I would want to process tens of thousands of Postgres rows as fast as possible and under three minutes. Right now I'm looking at 50k items with an average of 14 reqs/s resulting in just under 1 hour - both for t3.micro as well as m5.large and an overprovisioned Lambda.

Is there any way on how to achieve this using this functionality other than flipping the ETL and making it pull based vs. push based? Basically massively increase Lambda invocations from the RDS side.

EDIT: It just so happens that the - unchangeable - limit for GetPolicy API reqs/s is at 15 for Lambda.

Is each invocation via the RDS extension invoking this API endpoint?

1 Answer
0

Hello,

To massively increase Lambda invocations and improve processing time for Postgres rows:

  1. Batch Processing: Process multiple rows in each Lambda invocation.
  2. Parallel Execution: Split the workload and invoke multiple Lambdas in parallel.
  3. Asynchronous Invocation: Switch to asynchronous mode for higher concurrency.
  4. ETL Adjustment: Consider a pull-based model where Lambda pulls data from RDS.
  5. Optimize Lambda: Ensure the function is optimized for performance.
  6. Review API Limits: Check if the GetPolicy API limit is a bottleneck and optimize its usage.

You can reach out to me if you have any questions.

EXPERT

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.