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 1n8e79-0003Jw-BW for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Jan 2022 08:08:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8e78-0008FJ-8a for pgsql-hackers@arkaria.postgresql.org; Sat, 15 Jan 2022 08:08:42 +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 1n8e77-0008Ax-Uy for pgsql-hackers@lists.postgresql.org; Sat, 15 Jan 2022 08:08:41 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n8e75-0000AR-Ck for pgsql-hackers@lists.postgresql.org; Sat, 15 Jan 2022 08:08:41 +0000 Received: by mail-pl1-x631.google.com with SMTP id g5so15019166plo.12 for ; Sat, 15 Jan 2022 00:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z7B/X4lrLip0w5qvK2VWHle/mAFLZ1r0LDPUVErBu6A=; b=Uh3HSrelJAPLoI80/3n3kDHIZux7Id+dWbhlMxtj/Ch8cR6dXATG316o8dMUYfIxL6 Ovt1VDwPQgk6wdo9aWCajFhDBXAXXbzwW5D+praVLRHSAfnb0E8GfmqWTP1pMvarudL4 xbdK8vrxLGwqa6yTKdD0xUI8YSvkuWHd/+1j8R9VvN6Dzvb1LTePDRB6PwSLUyADsUGi Z7NQkSK5tTpLFfqP2lFD2rs9U15F01pC2Dis2mOOApu4JmLekhyGdQ2g7nX7lKrC+Czt NQDKYbrrRYyjWxBO39YMeetWMEqAo7dPfS8bFPXNqBJ03O0Q0aTiFjf/AeaK50HFdNHh TniQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z7B/X4lrLip0w5qvK2VWHle/mAFLZ1r0LDPUVErBu6A=; b=FN6ifalq4mT5k72T6UjRUKbJAXVOnams/tg2GYhrptAFouyHehRZW6JasbYvSXAEXK j59bmwvpswS2M3cQcL48PZsCTgI5kZWu2eAr7gM8gsbC6gJakvMDT6y7LyW6kZEQqmyd 1EzwwQx6hxTlMwDp+KAJd+NkPcCAv2CIIE7fS2Wp7q84ta3NN/dm59MEcLFlJNIjM+hz O6EonqTL+YcqLvCn+XFB4ajzVazcDCzKnNjzHZdJhWb5R0eDWgwqjLMSJDLSEoOtMbDo yAtflCA748rKa9vTgMjagSZckU3sSaAruv72Q+X+20yAGMUMa3Lk6SfBjKu90TDzo7wN SviQ== X-Gm-Message-State: AOAM530mjr1ezfSBW9TLjpwio43X1Onw+D+ZdVGaWGwXTKNvvlsI79nr HwDMu70FNSI/F/LXgzOAHZmoTmxGDDLzV++SCCektz/z75I= X-Google-Smtp-Source: ABdhPJwTRYPIJKZjv3NKxW9I9GmzpzNoauyBgfAOHwCATb051535iVZMIFVZZ39eEE4XssLoL/C9BhETEz0fo+qmJE4= X-Received: by 2002:a17:90a:6288:: with SMTP id d8mr5680111pjj.199.1642234116578; Sat, 15 Jan 2022 00:08:36 -0800 (PST) MIME-Version: 1.0 References: <20201225200953.jjkrytlrzojbndh5@alap3.anarazel.de> <51BAAB3B-9D3C-4155-B125-42E4F06DCDF4@amazon.com> <163352276350.15435.3988688227048304232.pgcf@coridan.postgresql.org> In-Reply-To: From: Bharath Rupireddy Date: Sat, 15 Jan 2022 13:38:26 +0530 Message-ID: Subject: Re: Pre-allocating WAL files To: "Bossart, Nathan" Cc: Maxim Orlov , Pavel Borisov , Maxim Orlov , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jan 15, 2022 at 1:36 PM Bharath Rupireddy wrote: > > On Thu, Jan 6, 2022 at 3:39 AM Bossart, Nathan wrote: > > > > On 12/30/21, 3:52 AM, "Maxim Orlov" wrote: > > > I did check the patch too and found it to be ok. Check and check-world are passed. > > > Overall idea seems to be good in my opinion, but I'm not sure where is the optimal place to put the pre-allocation. > > > > > > On Thu, Dec 30, 2021 at 2:46 PM Pavel Borisov wrote: > > >> I've checked the patch v7. It applies cleanly, code is good, check-world tests passed without problems. > > >> I think it's ok to use checkpointer for this and the overall patch can be committed. But the seen performance gain makes me think again before adding this feature. I did tests myself a couple of months ago and got similar results. > > >> Really don't know whether is it worth the effort. > > > > Thank you both for your review. > > It may have been discussed earlier, let me ask this here - IIUC the > whole point of pre-allocating WAL files is that creating new WAL files > of wal_segment_size requires us to write zero-filled empty pages to > the disk which is costly. With the advent of > fallocate/posix_fallocate, isn't file allocation going to be much > faster on platforms where fallocate is supported? IIRC, the > "Asynchronous and "direct" IO support for PostgreSQL." has a way to > use fallocate. If at all, we move ahead and use fallocate, then the > whole point of pre-allocating WAL files becomes unnecessary? > > Having said above, the idea of pre-allocating WAL files is still > relevant, given the portability of fallocate/posix_fallocate. Adding one more point: do we have any numbers like how much total time WAL files allocation usually takes, maybe under a high-write load server? Regards, Bharath Rupireddy.