Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1DaE-0005je-Fh for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2016 14:29: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 1c1DaE-0006QP-2N for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Oct 2016 14:29:06 +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 1c1DaB-0006Ln-Kg for pgsql-hackers@postgresql.org; Mon, 31 Oct 2016 14:29:03 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1c1Da6-0004yM-Gr for pgsql-hackers@postgresql.org; Mon, 31 Oct 2016 14:29:03 +0000 Received: by mail-wm0-x233.google.com with SMTP id a197so23630415wmd.0 for ; Mon, 31 Oct 2016 07:28:58 -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=b3MNoBR+qid8v+TyH9e7oJ69eDm6mNw41rKe0pnihhs=; b=uLlBWTivdQvYrWmxk+0UrWrRwbyf/4sgHVGyq3xhsxPGMRJQfFLwJTV9E0ZETzBak2 5ccqy9jL6ucKLl0cL47X5CUGXj+OgNMdrh98mfC1HqbqRdgim+v+UyBXZ9ZdbycrDaP8 7Gb3eT1g+mDSSNqzu0uHzbm6hC+327Upobim0hLaM1bBtAqF0BvQoB3wzOrg4Qgb0nWt e3lBK+vONpMHH8Sl47VOdQ8CpIeECOjH1nPJhEcmqr4bj6xpft6O0t/HQDLVI3rmJs1x ufBcSLWrV1xBTyRTqBOIB5NH/QrjmhQd26mZo9xKiiAkC655FJ48dvwqerN1wT/e5riF wspw== 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=b3MNoBR+qid8v+TyH9e7oJ69eDm6mNw41rKe0pnihhs=; b=NpMNT173hnBspQI6L9aIwuDIghz3WrFaoqiAvISfdp019MC8twTLdZM15pAZK5poWI rI0CG9NnzDTJeOJqJM1u3fmAYtlUSgxemWg6OPBOpBAPC33nhkAl91LMmS1/3y3Z3JuE /zjkGVSJ9yt0vYcBt+KNR5UEDf3TP+dFDAgBFTYW9XjwqR4uUBQdT9EcfJQXW99Y7yjG bLHBpBpqSGfWJEbqtu1bUHDAkVq177JI8PLfb5YbfZsJ0Gu05rcmqs35X+NZo7ks4C5S UwkR7oAlwMIcGwEo/ebGEunsspse9cVgqSnVfG6c+G91+ZnbBPi/mY9iExTIMRZqE9Dk nZkQ== X-Gm-Message-State: ABUngvf6dl64hkseahKuRLRllacRnfYxZz1D/z3qpFJQ1huc4LhnK5OLMWhopAGH7K7KZP2/BFlI7zupEMJqbLUXNxTGqPP/alFg/aWuJSw+bDwu5OKPg3rRAhLKm4yuL2RSC926+wlAqrwrly++0v6VPuMrBZ0SFEe6Mjeq/r8SFLGWrq1vyiFXiiCLB007/iTpySwJIP8v X-Received: by 10.28.6.203 with SMTP id 194mr6184683wmg.16.1477924137423; Mon, 31 Oct 2016 07:28:57 -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 63sm29267605wmv.1.2016.10.31.07.28.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 07:28:56 -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: <8efd9956-059a-78f3-32ff-f1e1a4dd09c8@2ndquadrant.com> Date: Mon, 31 Oct 2016 15:28:54 +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/31/2016 02:51 PM, Amit Kapila wrote: > On Mon, Oct 31, 2016 at 12:02 AM, Tomas Vondra > wrote: >> Hi, >> >> On 10/27/2016 01:44 PM, Amit Kapila wrote: >> >> I've read that analysis, but I'm not sure I see how it explains the "zig >> zag" behavior. I do understand that shifting the contention to some other >> (already busy) lock may negatively impact throughput, or that the >> group_update may result in updating multiple clog pages, but I don't >> understand two things: >> >> (1) Why this should result in the fluctuations we observe in some of the >> cases. For example, why should we see 150k tps on, 72 clients, then drop to >> 92k with 108 clients, then back to 130k on 144 clients, then 84k on 180 >> clients etc. That seems fairly strange. >> > > I don't think hitting multiple clog pages has much to do with > client-count. However, we can wait to see your further detailed test > report. > >> (2) Why this should affect all three patches, when only group_update has to >> modify multiple clog pages. >> > > No, all three patches can be affected due to multiple clog pages. > Read second paragraph ("I think one of the probable reasons that could > happen for both the approaches") in same e-mail [1]. It is basically > due to frequent release-and-reacquire of locks. > >> >> >>>> On logged tables it usually looks like this (i.e. modest increase for >>>> high >>>> client counts at the expense of significantly higher variability): >>>> >>>> http://tvondra.bitbucket.org/#pgbench-3000-logged-sync-skip-64 >>>> >>> >>> What variability are you referring to in those results? >> >>> >> >> Good question. What I mean by "variability" is how stable the tps is during >> the benchmark (when measured on per-second granularity). For example, let's >> run a 10-second benchmark, measuring number of transactions committed each >> second. >> >> Then all those runs do 1000 tps on average: >> >> run 1: 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000 >> run 2: 500, 1500, 500, 1500, 500, 1500, 500, 1500, 500, 1500 >> run 3: 0, 2000, 0, 2000, 0, 2000, 0, 2000, 0, 2000 >> > > Generally, such behaviours are seen due to writes. Are WAL and DATA > on same disk in your tests? > Yes, there's one RAID device on 10 SSDs, with 4GB of the controller. I've done some tests and it easily handles > 1.5GB/s in sequential writes, and >500MB/s in sustained random writes. Also, let me point out that most of the tests were done so that the whole data set fits into shared_buffers, and with no checkpoints during the runs (so no writes to data files should really happen). For example these tests were done on scale 3000 (45GB data set) with 64GB shared buffers: [a] http://tvondra.bitbucket.org/index2.html#pgbench-3000-unlogged-sync-noskip-64 [b] http://tvondra.bitbucket.org/index2.html#pgbench-3000-logged-async-noskip-64 and I could show similar cases with scale 300 on 16GB shared buffers. In those cases, there's very little contention between WAL and the rest of the data base (in terms of I/O). And moreover, this setup (single device for the whole cluster) is very common, we can't just neglect it. But my main point here really is that the trade-off in those cases may not be really all that great, because you get the best performance at 36/72 clients, and then the tps drops and variability increases. At least not right now, before tackling contention on the WAL lock (or whatever lock becomes the bottleneck). 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