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 1lN3x3-0003zd-JD for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Mar 2021 01:29:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lN3x0-0007DU-Gs for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Mar 2021 01:29:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lN3x0-0007DN-9i for pgsql-hackers@lists.postgresql.org; Fri, 19 Mar 2021 01:29:18 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lN3wt-00055S-30 for pgsql-hackers@postgresql.org; Fri, 19 Mar 2021 01:29:16 +0000 Received: by mail-ej1-x62c.google.com with SMTP id b7so7023448ejv.1 for ; Thu, 18 Mar 2021 18:29:10 -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=X87r8GQUz0jHp15q5tAnD2I1I26+pHkG4/YR/zONuH4=; b=001ooD5FDS7g2B5DhAe0O9WwmySJAya4T/7wVt2cCsRLIYmpoP+l8QQgC5DFofr4ui pC2KKbb0rlw2ClXoQg58ExFnTQflZDLAZcjawIAZnCXqRs4NU3mbxTiRNhr+mStexJiY p1N+5Y5Z78M4hhgR+H9uQZmZWA+rpNj9Bxa1K1qDcznsp/kiAsoaxIuYxETA8lo4LtAQ uKdDKNPnkNbp6Gr+JABf2LieIxTrsfG7KVAgrCrG8RbdAB0zf8D5C4X09PyTvH+5HhIt SROlRGX3VO6BM78Fa49nZZlY6+u82M5ybIbS10nYY5Ii7Ei3XI80kNMESlMcJRoJogTK nv6A== 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=X87r8GQUz0jHp15q5tAnD2I1I26+pHkG4/YR/zONuH4=; b=WXoZ5k0sgAGZk7BeoHrNPY7jG+SQnWY4zQmy/B1+fPJHCWmtORKg18NO+1IYmX1MXE avwhq2/cfGag+o6oMydPbba2q9JEN1r29Xdj64kxy3fsdMXlgI1AB3UritbCQFO2wgJM YAwXGGaeMoj81zAOBzoiJzjJ/fhr50SPl31zWRyVcC1GT+s6dBRg6aJXyjiQLJ8hwVy8 TDXSIgsmoFp18gwwh15JAj4Y+Erv5Z0WSYJ91YLTX5mZ+7aXHbMe18ZQGHEnxj68Olxz AwT6a5vTgz87YFJ8UWNkKvMFhMO6ri7xfgl/FY09DKrBIzhxlg58H0hBRXe89H6JySEY lV/w== X-Gm-Message-State: AOAM5306eSFa2Bd0KfB9TTM11KVHn0qRd486T4rXWjjgj1IbtyNYDLzE rrf44yudSi1y07xljtMNejcD124Ru4ryv4xIWZDMJNsyLP3SVnsBefXxRpNfmFItfHqs2N7+4tH vNTLdyPR1FAZiesVZddOTl2wklL7PPkA7tAu7wwtDTq5Y9w38x0E1OIhhwfRb9B7y8IReXuRaLS 99ZG/8+u8l++gfdvdi8/k+S4ynVgxmN7HjLrsKoVMamiWdY/RZg+fa2ME7RlcEUlFt9RhDEAgPO BepbXunYyiYZourAhPLEPOLpyk+WiapEgikiw== X-Google-Smtp-Source: ABdhPJweD20mtimNh1V7LiBQWRstIrqQeLYLOIzqjjWm5BHJPe7HgsE9ai1QIjbE0JfsJbKdHe8ymg== X-Received: by 2002:a17:906:53d7:: with SMTP id p23mr1649039ejo.140.1616117348888; Thu, 18 Mar 2021 18:29:08 -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 u24sm2774835ejr.34.2021.03.18.18.29.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 18:29:08 -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> From: Tomas Vondra Message-ID: <8dd2dcc2-0b6b-a4ab-c1b3-032c0a5ab1c3@enterprisedb.com> Date: Fri, 19 Mar 2021 02:29:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 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 3/18/21 1:54 AM, Thomas Munro wrote: > On Thu, Mar 18, 2021 at 12:00 PM Tomas Vondra > wrote: >> On 3/17/21 10:43 PM, Stephen Frost wrote: >>> Guess I'm just not a fan of pushing out a change that will impact >>> everyone by default, in a possibly negative way (or positive, though >>> that doesn't seem terribly likely, but who knows), without actually >>> measuring what that impact will look like in those more common cases. >>> Showing that it's a great win when you're on ZFS or running with FPWs >>> disabled is good and the expected best case, but we should be >>> considering the worst case too when it comes to performance >>> improvements. >>> >> >> Well, maybe it'll behave differently on systems with ZFS. I don't know, >> and I have no such machine to test that at the moment. My argument >> however remains the same - if if happens to be a problem, just don't >> enable (or disable) the prefetching, and you get the current behavior. > > I see the road map for this feature being to get it working on every > OS via the AIO patchset, in later work, hopefully not very far in the > future (in the most portable mode, you get I/O worker processes doing > pread() or preadv() calls on behalf of recovery). So I'll be glad to > get this infrastructure in, even though it's maybe only useful for > some people in the first release. > +1 to that >> FWIW I'm not sure there was a discussion or argument about what should >> be the default setting (enabled or disabled). I'm fine with not enabling >> this by default, so that people have to enable it explicitly. >> >> In a way that'd be consistent with effective_io_concurrency being 1 by >> default, which almost disables regular prefetching. > > Yeah, I'm not sure but I'd be fine with disabling it by default in the > initial release. The current patch set has it enabled, but that's > mostly for testing, it's not an opinion on how it should ship. > +1 to that too. Better to have it disabled by default than not at all. > I've attached a rebased patch set with a couple of small changes: > > 1. I abandoned the patch that proposed > pg_atomic_unlocked_add_fetch_u{32,64}() and went for a simple function > local to xlogprefetch.c that just does pg_atomic_write_u64(counter, > pg_atomic_read_u64(counter) + 1), in response to complaints from > Andres[1]. > > 2. I fixed a bug in ReadRecentBuffer(), and moved it into its own > patch for separate review. > > I'm now looking at Horiguchi-san and Heikki's patch[2] to remove > XLogReader's callbacks, to try to understand how these two patch sets > are related. I don't really like the way those callbacks work, and > I'm afraid had to make them more complicated. But I don't yet know > very much about that other patch set. More soon. > OK. Do you think we should get both of those patches in, or do we need to commit them in a particular order? Or what is your concern? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company