Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUTwX-0002Ei-TW for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Apr 2021 12:39:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTwV-0006Dw-Qj for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Apr 2021 12:39:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUTwV-0006Dp-F7 for pgsql-hackers@lists.postgresql.org; Thu, 08 Apr 2021 12:39:27 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lUTwR-0005OP-Qe for pgsql-hackers@postgresql.org; Thu, 08 Apr 2021 12:39:26 +0000 Received: by mail-ej1-x62f.google.com with SMTP id v6so1520984ejo.6 for ; Thu, 08 Apr 2021 05:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Rk8wB7SaV0u0ynIpnGgI/OJ4jokbhSY5ZdbwqxUxKIQ=; b=vFcgTYRiAtlqQOVyk6vb6gSa7VpUy4yS3QVj1IynxR9p+j89+0Us4O2HuSzlE4+WoN sUd7cWpjd1Gv5DqQE10/6EWXI1KeSuajbq/c8rt0HRwSuNqlkPeP28tnhL67fIJrM1ou BAANH2xF13ecC9x5ZX8GdV6qvXyZ/pVtxHNiWAQcFobuhsfGTmx7+vaQ7jEBMcvoixzo GcROhwpdDwg/2aSPWo6oaWbHY5dksAhXNJwEpPqimL2kz6wiixPhvZEWSK2+oUFCYzM0 jdSHPfja62L4qCyRiA22CHD5TILvxID1b6cmGM4Ep4irCsIxEe7wxYYfHs6aL5LAPD2g x5ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Rk8wB7SaV0u0ynIpnGgI/OJ4jokbhSY5ZdbwqxUxKIQ=; b=pDpjuzKs66PGTRXWZU6xVhbVFb58XF8IB9xLBvHLBEnwykxuMYPC5noy/x1VxZV62D BuXjsgDMSvY9wM2OkkM76Y5wAYt6gIOFHXZobenMr+fiYCIhplLAAy9UmdFd0aGa4U2j eALDF3rCGpDTYaYC8WT537beffSbJ1KmTig5scr/6crn9DHOqA+bSuZCrehI7u7mqgTX 8qU5SjfmExqBC3z4qE6CbX3N5xVdAFLPyUWPHa63RnaSP6EJ53Ds1pSU2UYd0EnTdNPE kznLHhioe8rd3p6scUTByvXOUGOv7mP+WIZet2RLUMcKR2wJ4M/OSprRNhrZ10FWRVVg wkcQ== X-Gm-Message-State: AOAM533CINWzZTGfp80h/wr+PIQyptlT7Q0jiKU5mP6r3Ue61AG5Or2w HAfSShKW0exn+csU02cEbWrYczim7HJV2ik2HEd2qOSI6Gi7lakyeuVFLDzqNiE/xJcmmLuiOto csBWVUS+G+8LxtuG6iqYC9P1cvz+Qj2b94r8qJq1HJCtJ4ezfgovhdFCnYI99oQhg1nNXY3u5NM Fg2RlwWkUygeL2wAvFzhLk1LmX3KSHvHqrLWaN5gOnAbaKs2XWGrojZOHDoRaetaud3NuMUQtbz CT7maGkOP22Q32h9cwn5/Zh8edPi4MlJQ1p9A== X-Google-Smtp-Source: ABdhPJyqXHKPI8bZvp8AltzgNDPiARZXAjDfATl5JiZsyeFwXEmEXSGsNRBTP6DHZVmKtVCD6xp+sw== X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr9876976ejc.403.1617885561242; Thu, 08 Apr 2021 05:39:21 -0700 (PDT) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id h20sm7856121ejk.110.2021.04.08.05.39.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 05:39:20 -0700 (PDT) Subject: Re: WIP: WAL prefetch (another approach) To: Thomas Munro Cc: Stephen Frost , Andres Freund , Jakub Wartak , Alvaro Herrera , Tomas Vondra , Dmitry Dolgov <9erthalion6@gmail.com>, David Steele , pgsql-hackers References: <20210210215033.GA27507@tamriel.snowman.net> <103ec76d-8bbc-09e1-460c-8785751431b5@enterprisedb.com> <20210212044614.5wqjkjbcmbwzever@alap3.anarazel.de> <20210213213930.GM27507@tamriel.snowman.net> <20210214231815.GO27507@tamriel.snowman.net> <17b3f450-048c-f3a6-7086-259523f33cbc@enterprisedb.com> <20210317214331.GF20766@tamriel.snowman.net> <28c3352e-5388-6410-aae7-05907079e6c9@enterprisedb.com> <8dd2dcc2-0b6b-a4ab-c1b3-032c0a5ab1c3@enterprisedb.com> From: Tomas Vondra Message-ID: Date: Thu, 8 Apr 2021 14:39:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/8/21 1:46 PM, Thomas Munro wrote: > On Thu, Apr 8, 2021 at 3:27 AM Tomas Vondra > wrote: >> On 4/7/21 1:24 PM, Thomas Munro wrote: >>> I made one other simplifying change: previously, the prefetch module >>> would read the WAL up to the "written" LSN (so, allowing itself to >>> read data that had been written but not yet flushed to disk by the >>> walreceiver), though it still waited until a record's LSN was >>> "flushed" before replaying. That allowed prefetching to happen >>> concurrently with the WAL flush, which was nice, but it felt a little >>> too "special". I decided to remove that part for now, and I plan to >>> look into making standbys work more like primary servers, using WAL >>> buffers, the WAL writer and optionally the standard log-before-data >>> rule. >> >> Not sure, but the removal seems unnecessary. I'm worried that this will >> significantly reduce the amount of data that we'll be able to prefetch. >> How likely it is that we have data that is written but not flushed? >> Let's assume the replica is lagging and network bandwidth is not the >> bottleneck - how likely is this "has to be flushed" a limit for the >> prefetching? > > Yeah, it would have been nice to include that but it'll have to be for > v15 due to lack of time to convince myself that it was correct. I do > intend to look into more concurrency of that kind for v15. I have > pushed these patches, updated to be disabled by default. I will look > into how I can run a BF animal that has it enabled during the recovery > tests for coverage. Thanks very much to everyone on this thread for > all the discussion and testing so far. > OK, understood. I'll rerun the benchmarks on this version, and if there's a significant negative impact we can look into that during the stabilization phase. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company