Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j03Wx-0004My-Sd for pgsql-general@arkaria.postgresql.org; Fri, 07 Feb 2020 13:18:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j03Ww-0002rx-Hx for pgsql-general@arkaria.postgresql.org; Fri, 07 Feb 2020 13:18:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j03Wv-0002rq-Eo for pgsql-general@lists.postgresql.org; Fri, 07 Feb 2020 13:18:46 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j03Ws-0006fD-3r for pgsql-general@lists.postgresql.org; Fri, 07 Feb 2020 13:18:45 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CEDE621FE9; Fri, 7 Feb 2020 08:18:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 07 Feb 2020 08:18:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=withers.org; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=mesmtp; bh=e1+KEpgcqhgmdbrNXQ0d5NG5 moU7KW5d+3ozEv2CClE=; b=b+2Dv/uS3YY8I+zvgFWb0qQK0kGTctfBq4q/FhBR lXxmpT4do/0rNc48t4DCA34DM/sjJXgzU8V4y8YYxfjhhypdSdhPL6pUmEOSw5bz nB6vJemk25kqua7H5po8DM4devFu6uu+LiXq2HDLT+BA41Y2T69Z/UM3lpriPa9H 89A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=e1+KEp gcqhgmdbrNXQ0d5NG5moU7KW5d+3ozEv2CClE=; b=a5BTX9459iix3Svf283+Yy iBVmn19/Zfxsa4YV4AqBvj/2BsAeIg5Z/sWAS2d4Ehta6SPWuPWLH+LNXlv07gm3 A6gWO0Alsv0OmNWb6TzfaWrn5WBZFHYWy0mg0anmB/sWpebhxaiOIPKdM+A7XFpI rXAPGKmBC+KTn6tRv5duW+/m3ZnFknL3ckQ0r13+AjYQ/aFYphSmCfMnorCd801L 3wYV9z7N0D8irBcLCBfZk46FloOK/PARw2YAbdcAEojN81h8CsMOWf+H5Y2oGsrA VEMgL9mbrTmjE2t4lLe7eMGhg68CMA3VdBPjkODRzWrWbbry2gDbA5LUIQFZ6TyQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrheehgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgesrgdtreertdefjeenucfhrhhomhepvehhrhhishcu hghithhhvghrshcuoegthhhrihhsseifihhthhgvrhhsrdhorhhgqeenucfkphepudekrd dufedtrddufeekrdejudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegthhhrihhsseifihhthhgvrhhsrdhorhhg X-ME-Proxy: Received: from [172.16.59.250] (ec2-18-130-138-71.eu-west-2.compute.amazonaws.com [18.130.138.71]) by mail.messagingengine.com (Postfix) with ESMTPA id E2B253280060; Fri, 7 Feb 2020 08:18:38 -0500 (EST) Subject: Re: Fwd: sensible configuration of max_connections To: Chris Ellis , pgsql-general@lists.postgresql.org References: From: Chris Withers Message-ID: Date: Fri, 7 Feb 2020 13:18:38 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:73.0) Gecko/20100101 Thunderbird/73.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------17017A3AA6F84EB42B39FFD4" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------17017A3AA6F84EB42B39FFD4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------17017A3AA6F84EB42B39FFD4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit 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.
--------------17017A3AA6F84EB42B39FFD4--