What I now know about HAproxied Django DB connections, and wish I'd known sooner
summary
If Django talks to a Galera MySQL/MariaDB cluster through HAProxy the default timeout client = 50s often causes MySQL error 2013 “Lost connection to MySQL server during query” for long Celery tasks while MySQL’s wait_timeout defaults to 28800s (8h). Fixes that work: close Django connections after the initial read, add retries with tenacity around DB updates, or set HAProxy’s timeout server/client to match MySQL (watch HAProxy’s ms/s units).
AI-written summary · about
chapters (5)
- 0:00Intro
- 2:20Setting the stage
- 14:14Real world applications
- 16:48Making it robust
- 21:11Fixing HAproxied configuration
related talks
37mScale MySQL beyond limits with ProxySQL
50m#ProxySQL Use Case Scenarios
35mMySQL HA, Recovery and Load Balancing
55mProxySQL Use Case Scenarios
48mMySQL Load Balancers - MaxScale, ProxySQL, HAProxy, MySQL Router & nginx - a close up look
08mMySQL as a Layered Service: How to use Proxy SQL to Control Traffic and Scale Out
30mFrom 15,000 Database Connections to under 100—A Tech Debt Tale
24mFrom Expensive Queries to Smart Caching: A DBA’s Guide for Rails
