Menu

1 / 5

Why does my Lambda function hit "Too many connections" on Amazon RDS?

DEV Community: postgres·Aniket Abhishek Soni·about 21 hours ago
#u9unL8ui
#devtopostgresql#devto#dev#proxy#connection
Reading 0:00
15s threshold

Consider a hypothetical pipeline where a set of AWS Lambda functions processes incoming event streams from an Amazon Data Firehose delivery stream. Each time a record arrives, the Lambda function spins up, opens a new TCP connection to an Amazon RDS for PostgreSQL instance, executes a small INSERT query, and closes the connection. During steady state, this works fine. However, during a traffic spike, the number of concurrent Lambda executions exceeds the database's max_connections parameter, causing the database to reject new connections. The system starts failing with connection timeout errors, leading to data loss in the ingestion layer.

This article explains how to mitigate connection exhaustion by introducing Amazon RDS Proxy between your serverless compute and your relational database.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.