Re: Checkpointer write combining

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Checkpointer write combining
Date: 2026-02-19 23:41:43
Message-ID: CAAKRu_Ygia_e2aVJcnkSksy85wuYwk_WattzwKJSJvcVj72Tuw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 14, 2026 at 6:35 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> Thanks! v13 attached.

I've added background writer write combining and then spent some time
refactoring and benchmarking this over the last few weeks, and I've
realized I won't be able to get it in shape for Postgres 19. I've
attached version 14 here with my WIP code so I can come back to it in
the next release.

0012 is an invasive refactor of GetVictimBuffer() and all the
functions it calls that needs to be split apart into smaller commits
and redistributed throughout the other patches in the set. Other than
that, there are a number of todos both in the code and from a
benchmarking perspective:

- Probe for preceding as well as following blocks when looking for
blocks to combine
- Experiment with different batch sizes
- Enable and test bulkread and vacuum write combining

I also periodically get this troubling warning: "WARNING: invalid
page in block 2 of relation "base/16384/2608_fsm"; zeroing out page".
So clearly there's at least one bug somewhere.

FWIW benchmarks showed a large improvement from backend and bgwriter
write combining, but I'll provide more detailed output from benchmarks
when I post a more reviewable patch set.

0001 and 0002 are completely independent cleanup that should be pushed
anyway, so I might do that, but I didn't want to do so without having
posted on the list at least once.

- Melanie

Attachment Content-Type Size
v14-0001-Make-FlushUnlockedBuffer-use-its-parameters.patch text/x-patch 1.1 KB
v14-0002-Make-ScheduleBufferTagForWriteback-static.patch text/x-patch 2.1 KB
v14-0003-Streamline-buffer-rejection-for-bulkreads-of-unl.patch text/x-patch 5.5 KB
v14-0004-Allow-PinBuffer-to-skip-increasing-usage-count.patch text/x-patch 5.2 KB
v14-0005-Eagerly-flush-bulkwrite-strategy-ring.patch text/x-patch 8.7 KB
v14-0006-Write-combining-for-BAS_BULKWRITE.patch text/x-patch 22.4 KB
v14-0007-Add-database-Oid-to-CkptSortItem.patch text/x-patch 1.9 KB
v14-0008-Implement-checkpointer-data-write-combining.patch text/x-patch 10.9 KB
v14-0009-Remove-SyncOneBuffer-and-refactor-BgBufferSync.patch text/x-patch 9.4 KB
v14-0010-Normal-backend-write-combining.patch text/x-patch 8.2 KB
v14-0011-Add-write-combining-for-background-writer.patch text/x-patch 8.7 KB
v14-0012-WIP-refactor.patch text/x-patch 29.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-02-19 23:55:12 Re: AIX support
Previous Message KAZAR Ayoub 2026-02-19 22:37:00 Re: Speed up COPY FROM text/CSV parsing using SIMD