Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1Cio-0003YH-Bi for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2016 13:33:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c1Cin-0005Jd-Ue for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2016 13:33:53 +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 1c1ChP-0003iw-G0 for pgsql-hackers@postgresql.org; Mon, 31 Oct 2016 13:32:27 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1c1ChL-0003wa-Qk for pgsql-hackers@postgresql.org; Mon, 31 Oct 2016 13:32:26 +0000 Received: by mail-wm0-x232.google.com with SMTP id p190so147602834wmp.1 for ; Mon, 31 Oct 2016 06:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=QfnGGkjGCY32Cj2syDvkwCIxeUbtw64VLMDuGyo2dIM=; b=l7wcEGLpqWgXDn48xEHNnWMxMKqeEec6/VmaK7yocjIKEYjnEB4ykRjPTtd/gOYsQp 7U7fNv+vFjSJ0kB1scTiQKMS6MZESNd8u9lrgf5swPFwF01uMQFChEd/TUcb3nv9KhQ2 cC8uVtjDlA6oEB5qDrdxt1GhKuTeGOSNv86n4LD5+LZcDme2LkI0mTW6ab02a9FdW8XU V1rdPDUpNWfrBthvFmJvJHjbUBvNRGuL+0qbPleOraPBTAL8npGnIu0/Rr7rePpJ74rS bDe3URVckgskGTpgzAbbhC1sLLJIFBfujcgg+41BaJwwrkcZmFN1dWYPQoakIkbya6O1 08GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=QfnGGkjGCY32Cj2syDvkwCIxeUbtw64VLMDuGyo2dIM=; b=dZosPkbpu2MwRPgDnlvwW8yeh1bd8WXTKDOFWulYEI1T3RqKWOy2yZmNsBxKzXpAqb x89xbaGDmJ7MUI8CxsM5SkUpQCEigZq2vPvPjqMekpR2ns7OWEzy7zR7iFLZhIwzOZ86 tEmSBFuzQhAaU5u24xfgMkbmYk6G3VSqp5a91bC8TgDlNAOqLo7+YDVbJDATR/26sorl hod0lUa4cSCKz5byysh06urNRVHul1O2242Z9JoY+pDLt6zy+1CQJoJc7Pp0Q1rAYzVk XQNrKkiLZBKUKi9hHESX3sLGRR4XCcso9kEtngbhr84GDH9nS2KbNl2XRn0Hq1iRVKy0 qsoA== X-Gm-Message-State: ABUngvfapIGrhHgan/TmBdPk2byT8+28hVRX/2p3S5gUgUoW7KHlr/zcTCqEdtNQBQ1B6QQAhwvyrhf2ROFMP9thtDbyYeJrJue78uOeXEtLJ8/bndHM3+dUxeytSP4qBJYBljHlVgXhZNJ+yGPpuw4O5ZAi/b0DQPJwzuEV7zWZFrp9/beMxuJpAjhutALIg1nwh0rrWCix X-Received: by 10.28.143.13 with SMTP id r13mr9821836wmd.61.1477920742930; Mon, 31 Oct 2016 06:32:22 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-44-58.net.upcbroadband.cz. [89.177.44.58]) by smtp.gmail.com with ESMTPSA id k17sm24771960wmd.8.2016.10.31.06.32.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 06:32:21 -0700 (PDT) Subject: Re: Speed up Clog Access by increasing CLOG buffers To: Amit Kapila References: <65f47a46-f1b2-aee1-d56d-b67de49e3a3b@2ndquadrant.com> <09275f4d-f78d-dd69-22de-57c784dc410e@2ndquadrant.com> <4a52a34f-57fa-7bcf-d34c-c15db40f0361@2ndquadrant.com> Cc: Dilip Kumar , Robert Haas , Andres Freund , pgsql-hackers From: Tomas Vondra Message-ID: <5960ada5-98f5-dacf-903f-6e153aed76ce@2ndquadrant.com> Date: Mon, 31 Oct 2016 14:32:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 10/30/2016 07:32 PM, Tomas Vondra wrote: > Hi, > > On 10/27/2016 01:44 PM, Amit Kapila wrote: >> On Thu, Oct 27, 2016 at 4:15 AM, Tomas Vondra >> wrote: >>> >>> FWIW I plan to run the same test with logged tables - if it shows >>> similar >>> regression, I'll be much more worried, because that's a fairly typical >>> scenario (logged tables, data set > shared buffers), and we surely can't >>> just go and break that. >>> >> >> Sure, please do those tests. >> > > OK, so I do have results for those tests - that is, scale 3000 with > shared_buffers=16GB (so continuously writing out dirty buffers). The > following reports show the results slightly differently - all three "tps > charts" next to each other, then the speedup charts and tables. > > Overall, the results are surprisingly positive - look at these results > (all ending with "-retest"): > > [1] http://tvondra.bitbucket.org/index2.html#dilip-3000-logged-sync-retest > > [2] > http://tvondra.bitbucket.org/index2.html#pgbench-3000-logged-sync-noskip-retest > > > [3] > http://tvondra.bitbucket.org/index2.html#pgbench-3000-logged-sync-skip-retest > > > All three show significant improvement, even with fairly low client > counts. For example with 72 clients, the tps improves 20%, without > significantly affecting variability variability of the results( measured > as stdddev, more on this later). > > It's however interesting that "no_content_lock" is almost exactly the > same as master, while the other two cases improve significantly. > > The other interesting thing is that "pgbench -N" [3] shows no such > improvement, unlike regular pgbench and Dilip's workload. Not sure why, > though - I'd expect to see significant improvement in this case. > > I have also repeated those tests with clog buffers increased to 512 (so > 4x the current maximum of 128). I only have results for Dilip's workload > and "pgbench -N": > > [4] > http://tvondra.bitbucket.org/index2.html#dilip-3000-logged-sync-retest-512 > > [5] > http://tvondra.bitbucket.org/index2.html#pgbench-3000-logged-sync-skip-retest-512 > > > The results are somewhat surprising, I guess, because the effect is > wildly different for each workload. > > For Dilip's workload increasing clog buffers to 512 pretty much > eliminates all benefits of the patches. For example with 288 client, > the group_update patch gives ~60k tps on 128 buffers [1] but only 42k > tps on 512 buffers [4]. > > With "pgbench -N", the effect is exactly the opposite - while with > 128 buffers there was pretty much no benefit from any of the patches > [3], with 512 buffers we suddenly get almost 2x the throughput, but > only for group_update and master (while the other two patches show no > improvement at all). > The remaining benchmark with 512 clog buffers completed, and the impact roughly matches Dilip's benchmark - that is, increasing the number of clog buffers eliminates all positive impact of the patches observed on 128 buffers. Compare these two reports: [a] http://tvondra.bitbucket.org/#pgbench-3000-logged-sync-noskip-retest [b] http://tvondra.bitbucket.org/#pgbench-3000-logged-sync-noskip-retest-512 With 128 buffers the group_update and granular_locking patches achieve up to 50k tps, while master and no_content_lock do ~30k tps. After increasing number of clog buffers, we get only ~30k in all cases. I'm not sure what's causing this, whether we're hitting limits of the simple LRU cache used for clog buffers, or something else. But maybe there's something in the design of clog buffers that make them work less efficiently with more clog buffers? I'm not sure whether that's something we need to fix before eventually committing any of them. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers