Gracefully Scaling to 10k PostgreSQL Connections for $35/mo, Part Two
articles.fti.bi
articles.fti.bi
Citation needed :P
Unless you're using a large shared_buffers setting without configuring huge pages, you should see smaller overhead. Obviously depends on what you're doing in each connection - if you consider accessing 10k tables in each session part of the connection overhead, sure, it'll be bigger.
> introduces additional coordination overhead on queries.
It's not really the established connection that matters. The number of in-progress transactions matters considerably (a snapshot is O(#active-transactions)). There's some influence of the maximum number of possible connections.
There are plenty of citations out there, but Craig wrote most of them.
Like?
consider having 10 upstream connections per transaction pool and 10000s of connections to applications. pgbouncer can handle that and every application would only be assigned to a real database if a transaction/query happens and after that the upstream connection would be deassigned.
This was my exact situation at a previous position. We needed up to 20k connections to a single pgsql master. Even the most monster postgres server falls over around ~600 connections (up to 1k depending on usage).
Using a pgbouncer-per-webserver we easily got to 20k.
I will say this was with 9.3 though, things may have changed on that front. Nowadays I use pgsql primarily for analytics, so there's only ever 20-30 connections tops, albeit doing quite heavy querying.
Besides the old stalwart pgBouncer, Yandex recently released Odessey as well https://github.com/yandex/odyssey
https://medium.com/futuretech-industries/ten-thousand-high-a...