Re: [PoC] Non-volatile WAL buffer

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>, Takashi Menjo <takashi(dot)menjo(at)gmail(dot)com>
Cc: Takashi Menjo <takashi(dot)menjou(dot)vg(at)hco(dot)ntt(dot)co(dot)jp>, "Deng, Gang" <gang(dot)deng(at)intel(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PoC] Non-volatile WAL buffer
Date: 2021-01-22 03:27:57
Message-ID: a48b0c10-1b17-ffc1-f87a-580a649549ca@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Let me share some numbers from a few more tests. I've been experimenting
with two optimization ideas - alignment and non-temporal writes.

The first idea (alignment) is not entirely unique to PMEM - we have a
bunch of places where we align stuff to cacheline, and the same thing
does apply to PMEM. The cache lines are 64B, so I've tweaked the WAL
format to align records accordingly - the header sizes are a multiple of
64B, and the space is reserved in 64B chunks. It's a bit crude, but good
enough for experiments, I think. This means the WAL format would not be
compatible, and there's additional overhead (not sure how much).

The second idea is somewhat specific to PMEM - the pmem_memcpy provided
by libpmem allows specifying flags, determining whether the data should
go to CPU cache or not, whether it should be flushed, etc. So far the
code was using

pmem_memcpy(..., PMEM_F_MEM_NOFLUSH);

following the idea that caching data in CPU cache and then flushing it
in larger chunks is more efficient. I heard some recommendations to use
non-temporal writes (which should not use CPU cache), so I tested that
switching to

pmem_memcpy(..., PMEM_F_NON_TEMPORAL);

The experimental patches doing these things are attached, as usual.

The results are a bit better than for the preceding patches, but only by
a couple percent. That's a bit disappointing. Attached is a PDF with
charts for the three WAL segment sizes as before.

It's possible the patches are introducing some internal bottleneck, so I
plan to focus on profiling and optimizing them next. I'd welcome some
feedback with ideas what might be wrong, of course ;-)

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
PMEM2.pdf application/pdf 153.8 KB
patches.tgz application/x-compressed-tar 63.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2021-01-22 03:34:42 RE: libpq debug log
Previous Message Greg Nancarrow 2021-01-22 02:58:50 Re: Parallel INSERT (INTO ... SELECT ...)