Lambda Is Exhausting Your RDS Connections. Raise the Limit?

Under load, Lambda functions fail with too many connections to RDS. A teammate wants to bump max_connections. Defend the real fix.

intermediate12 min5 roundsAWSDatabases

Answer key reviewed by Branko Petric

Read first: AWS Databases: RDS and DynamoDB

Your decision

During traffic spikes your Lambda functions start failing with too many connections errors against RDS. A teammate says just raise max_connections on the database. Do you agree, and what do you do instead?

The situation

Your API is backed by Lambda functions that read and write an RDS database. Normal traffic is fine, but during spikes a wave of invocations starts returning errors that the database has too many connections, and requests fail.

Context

The functions open a fresh database connection at the start of each invocation. At peak the platform runs hundreds of concurrent invocations. RDS is a single instance sized for steady load. A teammate has opened the parameter group and wants to raise max_connections to make the errors stop.

More: AWS scenario interview questions