Re: Fwd: sensible configuration of max_connections

Chris Withers <chris@withers.org>

From: Chris Withers <chris@withers.org>
To: Chris Ellis <chris@intrbiz.com>, pgsql-general@lists.postgresql.org
Date: 2020-02-07T13:18:38Z
Lists: pgsql-general
On 07/02/2020 12:49, Chris Ellis wrote:
> What's "too much" for max_connections? What happens when you set it to
>
>     high? What factors affect that number?
>
>
> When sizing max_connections you need to trade off how many connections 
> your application will use at peak vs how much RAM and CPU you have.
>
> Each connection is capable of allocating work_mem and has a stack etc.
>
> As such you don't want max_connections to be able to run your system 
> out of RAM.
Sure, but that's where I'm trying to find out what's sensible. The box 
has 196GB memory, most of that in hugepages, 18 core Intel Skylake with 
HT on giving 36 cores and tonnes of SSD for storage. How would I turn 
that spec into a sensible number for max_connections? As that number 
grows, what contention points in postgres will start creaking (shared 
memory where the IPC happens?)

In case I forgot to say, this is PostgreSQL 11...

Chris

PS: definitely thinking of pg_bouncer, but still trying to figure out 
what to sensibly set for max_connections.