← Graph

Connection Pool Contention from External Calls

concept 1 connections

Performance pattern Caio Almeida debugged during Brazil's 2022 elections project at Meedan. A Rails API connected to a WhatsApp channel was calling an external Python (AWS Lambda) machine-learning service synchronously. Rails wrapped the controller action in a transaction which held a DB connection open for the entire duration of the HTTP call — even though no database activity was happening. Under load the connection pool filled up with idle-but-open connections waiting on the external service, causing contention. Other requests couldn't acquire connections. Fix: release/close the DB connection around external HTTP calls that don't touch the database.

category
pattern
about
Connection Pool Contention from External Calls concept
Caio's Brazil 2022 elections war story about Rails holding DB connections during synchronous Lambda calls.

Provenance

Created in
Performance Panel at wroclove.rb 2024 2026-04-17 23:20
Read by
1 extraction