Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXIeC-0005Bd-HU for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 00:12:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YXIeB-0006Hx-Vi for pgsql-performance@arkaria.postgresql.org; Mon, 16 Mar 2015 00:12:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YXIeA-0006Hq-Pt for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 00:12:42 +0000 Received: from mout.kundenserver.de ([212.227.17.10]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YXIe7-00010m-Fh for pgsql-performance@postgresql.org; Mon, 16 Mar 2015 00:12:41 +0000 Received: from anarazel.de ([93.220.92.168]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0MA5UH-1YibAw08jZ-00BLcT; Mon, 16 Mar 2015 01:12:35 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 6FCA510042C; Mon, 16 Mar 2015 01:12:34 +0100 (CET) Date: Mon, 16 Mar 2015 01:12:34 +0100 From: Andres Freund To: "michael@sqlexec.com" Cc: Tomas Vondra , pgsql-performance@postgresql.org Subject: Re: MusicBrainz postgres performance issues Message-ID: <20150316001234.GG29732@awork2.anarazel.de> References: <20150315135022.GC19792@alap3.anarazel.de> <20150315172048.GG9324@alap3.anarazel.de> <20150315174646.GH9324@alap3.anarazel.de> <20150315224756.GE29732@awork2.anarazel.de> <550618C2.3030802@2ndquadrant.com> <55061BEB.5070209@sqlexec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55061BEB.5070209@sqlexec.com> X-Provags-ID: V03:K0:7+o3kaUUBpG9m5uM3kFTL54RnxdSGLK1rIST8renOHMqdZtLlvG l7Ssf67ksmTkVnWOV1Wp9NM4gLd2swwWw1gDgja9q7vP9SyxWPtAjHYNpMG3tIJC0u6gtwA ZzNuccc3FEYjxdgIwvTKaEUjwhoHOdsFxHPPPNBzFDHhGYV9RY15pV8XCgAe72aRnsInk5v 67bAbGeyR9eLdg7C+imRg== X-UI-Out-Filterresults: notjunk:1; X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org (please quote properly) On 2015-03-15 19:55:23 -0400, michael@sqlexec.com wrote: > Why is 500 connections "insane". We got 32 CPU with 96GB and 3000 max > connections, and we are doing fine, even when hitting our max concurrent > connection peaks around 4500. At a previous site, we were using 2000 max > connections on 24 CPU and 64GB RAM, with about 1500 max concurrent > connections. So I wouldn't be too hasty in saying more than 500 is asking > for trouble. Just as long as you got your kernel resources set high enough > to sustain it (SHMMAX, SHMALL, SEMMNI, and ulimits), and RAM for work_mem. It may work acceptably in some scenarios, but it can lead to significant problems. Several things in postgres things in postgres scale linearly (from the algorithmic point of view, often CPU characteristics like cache sizes make it wors) with max_connections, most notably acquiring a snapshot. It usually works ok enough if you don't have a high number of queries per second, but if you do, you can run into horrible contention problems. Absurdly enough that matters *more* on bigger machines with several sockets. It's especially bad on 4+ socket systems. The other aspect is that such a high number of full connections usually just isn't helpful for throughput. Not even the most massive NUMA systems (~256 hardware threads is the realistic max atm IIRC) can process 4.5k queries at the same time. It'll often be much more efficient if all connections above a certain number aren't allocated a full postgres backend, with all it's overhead, but use a much more lightweight pooler connection. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance