Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axGE0-0003fD-J5 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2016 15:57:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1axGE0-0003OJ-5T for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2016 15:57:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1axGDy-0003NZ-VC for pgsql-hackers@postgresql.org; Mon, 02 May 2016 15:57:31 +0000 Received: from [66.111.4.29] (helo=out5-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1axGDw-00013F-2j for pgsql-hackers@postgresql.org; Mon, 02 May 2016 15:57:29 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 313F12089B for ; Mon, 2 May 2016 11:57:07 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 02 May 2016 11:57:07 -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=AfSOu+ugiBWvRjYrCka+o8lDxwI=; b=iI7mP ooWIuc2Hrwvi6ugIzFU6ht94gWLe5Qlc6+6nb5YPehFNnQ9CsvJemZsbkLr4CXHt n3qYpRq1K/lBO6b6KUiR6DcGkrScADgk9ZegZff1Cjr2czCjkVseCMPWtVCdaVSA QvnDgldGKwq37ZmMutKoXt+NvwjxcoKCGums5s= X-Sasl-enc: NLUKyfCufxiG6fWLRzUmZOXRu0/HcsM0fPnpT6eIU5Z3 1462204626 Received: from intern.anarazel.de (unknown [192.77.237.104]) by mail.messagingengine.com (Postfix) with ESMTPA id BBF23C00012; Mon, 2 May 2016 11:57:06 -0400 (EDT) Date: Mon, 2 May 2016 08:57:05 -0700 From: Andres Freund To: Ants Aasma Cc: Robert Haas , Kevin Grittner , Amit Kapila , Noah Misch , "pgsql-hackers@postgresql.org" Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < Message-ID: <20160502155705.dzvwnnjlah3a63td@alap3.anarazel.de> References: <171569342.34745.1461078735421@RIA> <1837416819.81786.1461248181440@RIA> <500986603.206741.1462198885924@RIA> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.29 (deferred) X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-05-02 18:15:40 +0300, Ants Aasma wrote: > On Mon, May 2, 2016 at 5:21 PM, Andres Freund wrote: > > On 2016-05-02 09:03:19 -0400, Robert Haas wrote: > >> On Fri, Apr 29, 2016 at 6:08 PM, Kevin Grittner wrote: > >> > Now to continue with the performance benchmarks. I'm pretty sure > >> > we've fixed the problems when the feature is disabled > >> > (old_snapshot_threshold = -1), and there are several suggestions > >> > for improving performance while it is on that need to be compared > >> > and benchmarked. > >> > >> If anyone thinks that the issue with the feature disabled is NOT > >> fixed, please speak up! I'm moving the corresponding open item to > >> CLOSE_WAIT status, meaning that it will be closed if nobody shows up > >> to say that there is still an issue. > > > > Well, I don't agree that the feature is in a releaseable state. The > > datastructure is pretty much non-scalable, and maintained on the wrong > > side (every read, instead of once in writing writing xacts). There's no > > proposal actually addressing the scalability issues. > > Unless I'm missing something fundamental the feature only requires > tracking an upper bound on xmin observed by snapshots between clock > ticks. I'm not saying that there's no datastructure that can make the whole thing efficient - just that current datastructure doesn't look viable and that I've not seen that point addressed seriously. > The simplest way to do this would be a periodic process that > increments a clock counter (32bit counter would be plenty) and then > calculates xmin for the preceding range. With this scheme > GetSnapshotData would need two atomic fetches to get current LSN and > the timestamp. Test for old snapshot can also run completely lock free > with a single atomic fetch of threshold timestamp. The negative side > is that we need to have a process running that runs the clock ticks > and the ticks may sometimes be late. Giving something like autovacuum > launcher this task doesn't seem too bad and the consequence of falling > behind is just delayed timing out of old snapshots. That'd be one way, yes. I suspect it'd even be sufficient to move maintaining the map around GetNewTransactionId(); so only writers pay the overhead. Given that writes obviously are slower than reads that might make the problem disappear for a long while. > As far as I can see this approach would get rid of any scalability > issues, but it is a pretty significant change and requires 64bit > atomic reads to get rid of contention on xlog insert lock. Yea. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers