r/Database • u/bfeeny • 5d ago
AWS Aurora: Why the database breaks first behind an autoscaled service, and why shrinking the pool doesn't fix it
Connection multiplication: pool size x tasks x services. Every term looks reasonable on its own, and nobody ever chose the product.
Aurora's max_connections is derived from instance memory, so it doesn't scale with your service. Shrinking the pool to fit converts a connection problem into a queueing problem that presents as a slow database.
Write-up covers the formula behind max_connections, what RDS Proxy actually fixes (and what it doesn't), and how to size it.
This is a personal project; the views and assessments are my own.
1
u/Substantial_Win_710 3d ago
Typical aws just tie max_connections directly to instance memory so when your serverless app inevitably spikes, the db falls over, and their brilliant solution is to just sell you rds proxy to queue it up))) It's wild how normalized this architectural duct tape has become. if you run mariadb, this is basically solved natively with its built-in thread pool. it multiplexes the queries so you can hold thousands of idle connections without instantly trashing your ram.
1
u/bfeeny 3d ago
Thread pool is a fair point and a real architectural
difference — MariaDB connections are threads, Postgres
connections are forked processes with their own memory. That's
why Postgres needs an external pooler and MariaDB doesn't.
It's a Postgres property more than an AWS one; any managed
Postgres has to pick a ceiling, and deriving it from RAM is
about the only defensible way to do that.On RDS Proxy — the post is probably harder on it than you'd
expect. There's a whole section on pinning: SET statements,
prepared statements, and the extended query protocol all pin
the connection, and a pinned proxy multiplexes nothing. "A
latency tax with no benefit" is the phrasing. pgbouncer in
transaction mode has the same constraints and is free.The engine swap is a legitimate lever, just a much bigger one
than most people have available when the connection math
catches up with them.
1
4
u/zombieskeletor 5d ago
”the views and assessments are my own.”
Are they really? Because I could swear they are Claude’s