3 ms·
In my experience, many high-scale MySQL configurations use a global max_connections in the single-digit thousands (4000-5000 is common at social networks doing
by evanelias 8y ago
In my experience, many high-scale MySQL configurations use a global max_connections in the single-digit thousands (4000-5000 is common at social networks doing high-volume OLTP), and an aggressive wait_timeout (~10 seconds) to kill idle conns from misbehaving/stalled clients.
I've never seen a max_connections configured anywhere near 100k. That would be an extreme edge-case, and is generally unwise unless there's some very specific unusual reason that you need that. My assumption would be something is very wrong at the application architecture level if this is needed.
What "scan of all connected sessions" are you referring to? I've never heard anything about this, and never seen general performance issues purely related to high idle connection count, but I've also never configured max_connections to such an insanely high value.
As for other databases, I don't see how Postgres would be able to handle 100k connections (without a proxy) either, given that means 100k OS processes in Postgres.
> always make a new session for each transaction, which will lead to huge other set of performance issues because establishing new sessions is pretty expensive
Fire-and-forget (connection per web request) is somewhat common in MySQL, especially with languages like PHP. Establishing a connection is relatively low overhead on the server side in MySQL, since it just involves spawning a thread. Usually the bigger issue is network latency, especially if cross-region SSL connections are involved. In this case, a client-side connection pool or proxy certainly makes sense, and that is true regardless of what DB technology is used.
It sounds like you have a lot of application servers maintaining connection pools to a single database. In this case it is generally beneficial to tune the connection pools to aggressively prune idle connections, or use proxies that multiplex connections (ProxySQL is great), and then set max_connections to a more sane value as a circuit-breaker.