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.