Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aq3Un-0000qV-Uh for pgsql-committers@arkaria.postgresql.org; Tue, 12 Apr 2016 18:57:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aq3Un-0005CC-0r for pgsql-committers@arkaria.postgresql.org; Tue, 12 Apr 2016 18:57:05 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aq3UZ-0004iX-CZ for pgsql-committers@postgresql.org; Tue, 12 Apr 2016 18:56:51 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aq3UR-0000vA-PG for pgsql-committers@postgresql.org; Tue, 12 Apr 2016 18:56:51 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3BC222101E for ; Tue, 12 Apr 2016 14:56:42 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Tue, 12 Apr 2016 14:56:42 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=vCDWFuvinXdZS7UoFbn5iV78u5E=; b=J83L/ Ig8boEYmc0GF0kTr9wFcrmDp20lw1whwhi/vF0miuD91DFY/QGGDlsNqxo/kacFW GLacetvf9K3ylfJOyBXs063LrYZSLAULy9uoyM0FVAI5t5o9JAAFN+HdxXsTXEUG PSWDNM6U75ie4evOPfiVSI7WvNMotlTGyIqfo0= X-Sasl-enc: czHWzru3by3yE0kCAq8DAancWioHTmJbMpmleM0n2RnR 1460487401 Received: from intern.anarazel.de (unknown [184.23.178.130]) by mail.messagingengine.com (Postfix) with ESMTPA id D8932C0001B; Tue, 12 Apr 2016 14:56:41 -0400 (EDT) Date: Tue, 12 Apr 2016 11:56:25 -0700 From: Andres Freund To: Kevin Grittner Cc: Kevin Grittner , "pgsql-hackers@postgresql.org" , "pgsql-committers@postgresql.org" Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160412185625.g7ixnlpwaqvsqt7v@alap3.anarazel.de> References: <20160412173856.6jumsz7es5zac42o@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2016-04-12 13:44:00 -0500, Kevin Grittner wrote: > On Tue, Apr 12, 2016 at 12:38 PM, Andres Freund wrote: > > On 2016-04-12 16:49:25 +0000, Kevin Grittner wrote: > >> On a big NUMA machine with 1000 connections in saturation load > >> there was a performance regression due to spinlock contention, for > >> acquiring values which were never used. Just fill with dummy > >> values if we're not going to use them. > > > > FWIW, I could see massive regressions with just 64 connections. > > With what settings? You mean pgbench or postgres? The former -M prepared -c 64 -j 64 -S. The latter just a large enough shared buffers to contains the scale 300 database, and adapted maintenance_work_mem. Nothing special. > With or without the patch to avoid the locks when off? Without. Your commit message made it sound like you need unrealistic or at least unusual numbers of connections, and that's afaics not the case. > > I'm a bit scared of having an innoccuous sounding option regress things > > by a factor of 10. I think, in addition to this fix, we need to actually > > solve the scalability issue here to a good degree. One way to do so is > > to apply the parts of 0001 in > > http://archives.postgresql.org/message-id/20160330230914.GH13305%40awork2.anarazel.de > > defining PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY and rely on that. Another > > to apply the whole patch and simply put the lsn in an 8 byte atomic. > > I think that we are well due for atomic access to aligned 8-byte > values. That would eliminate one potential hot spot in the > "snapshot too old" code, for sure. I'm kinda inclined to apply that portion (or just the whole patch with the spurious #ifdef 0 et al fixed) into 9.6; and add the necessary checks in a few places. Because I really think this is likely to hit unsuspecting users. FWIW, accessing a frequently changing value from a significant number of connections, at a high frequency, isn't exactly free without a spinlock either. But it should be much less bad. Greetings, Andres Freund -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers