Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxUP6-0000MN-1q for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Oct 2016 07:38:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bxUP5-0003vZ-Kx for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Oct 2016 07:38:11 +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 1bxUP4-0003uv-AH for pgsql-hackers@postgresql.org; Fri, 21 Oct 2016 07:38:10 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bxUP0-00010e-QU for pgsql-hackers@postgresql.org; Fri, 21 Oct 2016 07:38:09 +0000 Received: by mail-lf0-x235.google.com with SMTP id b81so125181267lfe.1 for ; Fri, 21 Oct 2016 00:38:06 -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=eSiy2YJmA2vib1S00uC0/IfsT21uIzHPZ9ieZklLKEc=; b=cQwzMqQC71Jh3B3HFi6hKZQeecD3RzSSv6qaAD8QofTtDxF2Vpfe1ZA1yNilK0GJQD mNoeLyLXE+nOQbJE/30npmHnAM32ZBhpT6lkkI/zYDSyB1iw+zHZvW4cw88H/Y23kvF0 vWUTosRTQ8ZcD8eivQgKJzmbo9aNKpvU1oLiCkLTYP8a1+AMHrBV/w01UsHtjPqWDkXI AvGnubMdgl3GvmjCZ05f4+Wf2wFIP2TtQ7Ht2qVI92sv4wNhmssuggXRR/uIzUllr6E2 Q9Rp19ykh/Fhajt7gyTq+mvrhZdvssJsU98Cm/Bb9oYRnfLJnRcd6+11vLbLwLSDGO08 bo4A== 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=eSiy2YJmA2vib1S00uC0/IfsT21uIzHPZ9ieZklLKEc=; b=bOsmpwfqTAEChDj6TzskHS4GTm9CRNRciHCm/Dub5oBbinGfIGsM/ivIdUDRZADNDq DTjIwYSeqr/zRLPPph3E11P3FWbckK2J+cQ0UwNCjnhn9rQHD92OBICwqmquV3qyeQiC 8a5o9FwIREXghAnHYKJ9DDFtgDXzj4iirSBotKiFuiJnxSpnTc+lU3dI8D963Ld5kOgH gUVvAH3uFYmWsdLdFCHF0jBr9vBav3rEkpHyM/Bnl2+XtS2LuxJ6WaYIlu9pzM/3YT65 blVon/pip5NzOeWpvXzB61hC1rTifuvd0V0K+fEHSbYfN4aHa3g+ndeVhdF9vwEr6gwX wwgQ== X-Gm-Message-State: AA6/9RlzNpeoZeN9PH7E7Rp0muWE761ovFOUb0oAVg2Kfkjua9uVeVcocWu8GvOz+Enridz3RsNqdPtujO6nJP9cFZo7FhTreB9cBtSQDI516kFjn68ostkYGjRxHzkTs7H1T0rAfryvaVSpugPK+79ZAo5NdXcqYeCS2CUOjMH/jah1pQjcGL1u6Oz+DK0JxjKSuABAHKuO X-Received: by 10.28.227.4 with SMTP id a4mr8780437wmh.84.1477035483546; Fri, 21 Oct 2016 00:38:03 -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 f17sm2705791wmf.10.2016.10.21.00.38.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Oct 2016 00:38:02 -0700 (PDT) Subject: Re: Speed up Clog Access by increasing CLOG buffers To: Amit Kapila , Robert Haas References: <3cc206fa-7d36-f020-3856-12ed405e2535@2ndquadrant.com> <65f47a46-f1b2-aee1-d56d-b67de49e3a3b@2ndquadrant.com> <09275f4d-f78d-dd69-22de-57c784dc410e@2ndquadrant.com> Cc: Dilip Kumar , Andres Freund , pgsql-hackers From: Tomas Vondra Message-ID: <730786b4-0eaf-4c33-b7da-e018cf35c208@2ndquadrant.com> Date: Fri, 21 Oct 2016 09:37:59 +0200 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/21/2016 08:13 AM, Amit Kapila wrote: > On Fri, Oct 21, 2016 at 6:31 AM, Robert Haas wrote: >> On Thu, Oct 20, 2016 at 4:04 PM, Tomas Vondra >> wrote: >>>> I then started a run at 96 clients which I accidentally killed shortly >>>> before it was scheduled to finish, but the results are not much >>>> different; there is no hint of the runaway CLogControlLock contention >>>> that Dilip sees on power2. >>>> >>> What shared_buffer size were you using? I assume the data set fit into >>> shared buffers, right? >> >> 8GB. >> >>> FWIW as I explained in the lengthy post earlier today, I can actually >>> reproduce the significant CLogControlLock contention (and the patches do >>> reduce it), even on x86_64. >> >> /me goes back, rereads post. Sorry, I didn't look at this carefully >> the first time. >> >>> For example consider these two tests: >>> >>> * http://tvondra.bitbucket.org/#dilip-300-unlogged-sync >>> * http://tvondra.bitbucket.org/#pgbench-300-unlogged-sync-skip >>> >>> However, it seems I can also reproduce fairly bad regressions, like for >>> example this case with data set exceeding shared_buffers: >>> >>> * http://tvondra.bitbucket.org/#pgbench-3000-unlogged-sync-skip >> >> I'm not sure how seriously we should take the regressions. I mean, >> what I see there is that CLogControlLock contention goes down by about >> 50% -- which is the point of the patch -- and WALWriteLock contention >> goes up dramatically -- which sucks, but can't really be blamed on the >> patch except in the indirect sense that a backend can't spend much >> time waiting for A if it's already spending all of its time waiting >> for B. >> > > Right, I think not only WALWriteLock, but contention on other locks > also goes up as you can see in below table. I think there is nothing > much we can do for that with this patch. One thing which is unclear > is why on unlogged tests it is showing WALWriteLock? > Well, although we don't write the table data to the WAL, we still need to write commits and other stuff, right? And on scale 3000 (which exceeds the 16GB shared buffers in this case), there's a continuous stream of dirty pages (not to WAL, but evicted from shared buffers), so iostat looks like this: time tps wr_sec/s avgrq-sz avgqu-sz await %util 08:48:21 81654 1367483 16.75 127264.60 1294.80 97.41 08:48:31 41514 697516 16.80 103271.11 3015.01 97.64 08:48:41 78892 1359779 17.24 97308.42 928.36 96.76 08:48:51 58735 978475 16.66 92303.00 1472.82 95.92 08:49:01 62441 1068605 17.11 78482.71 1615.56 95.57 08:49:11 55571 945365 17.01 113672.62 1923.37 98.07 08:49:21 69016 1161586 16.83 87055.66 1363.05 95.53 08:49:31 54552 913461 16.74 98695.87 1761.30 97.84 That's ~500-600 MB/s of continuous writes. I'm sure the storage could handle more than this (will do some testing after the tests complete), but surely the WAL has to compete for bandwidth (it's on the same volume / devices). Another thing is that we only have 8 WAL insert locks, and maybe that leads to contention with such high client counts. 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