Serverless functions with a relational database
WHAT IT TESTS: the connection-storm problem. OUTLINE: concurrent function instances each open connections and exhaust the database's bounded pool; fix with a connection proxy or pooler, init-phase reuse, or capped concurrency. RED FLAG: a connection per call.
WHAT IT TESTS: whether you understand why per-request relational connections break at serverless scale. ANSWER OUTLINE: relational databases support a bounded number of connections, but functions scale to many concurrent instances that each open their own, exhausting the pool and causing errors. Address it with a managed proxy or pooler such as RDS Proxy that multiplexes onto a small backend pool, reuse the client in the init phase, cap reserved concurrency, or use an HTTP data API. RED FLAG: opening a connection per invocation.
Read the original → interview
- #serverless
- #database
- #postgresql
- #rds-proxy
- #scalability
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.