Dear hackers, I propose "non-volatile WAL buffer," a proof-of-concept new feature. It enables WAL records to be durable without output to WAL segment files by residing on persistent memory (PMEM) instead of DRAM. It improves database performance by reducing copies of WAL and shortening the time of write transactions.
I attach the first patchset that can be applied to PostgreSQL 12.0 (refs/ tags/REL_12_0). Please see README.nvwal (added by the patch 0003) to use the new feature. PMEM [1] is fast, non-volatile, and byte-addressable memory installed into DIMM slots. Such products have been already available. For example, an NVDIMM-N is a type of PMEM module that contains both DRAM and NAND flash. It can be accessed like a regular DRAM, but on power loss, it can save its contents into flash area. On power restore, it performs the reverse, that is, the contents are copied back into DRAM. PMEM also has been already supported by major operating systems such as Linux and Windows, and new open-source libraries such as Persistent Memory Development Kit (PMDK) [2]. Furthermore, several DBMSes have started to support PMEM. It's time for PostgreSQL. PMEM is faster than a solid state disk and naively can be used as a block storage. However, we cannot gain much performance in that way because it is so fast that the overhead of traditional software stacks now becomes unignorable, such as user buffers, filesystems, and block layers. Non-volatile WAL buffer is a work to make PostgreSQL PMEM-aware, that is, accessing directly to PMEM as a RAM to bypass such overhead and achieve the maximum possible benefit. I believe WAL is one of the most important modules to be redesigned for PMEM because it has assumed slow disks such as HDDs and SSDs but PMEM is not so. This work is inspired by "Non-volatile Memory Logging" talked in PGCon 2016 [3] to gain more benefit from PMEM than my and Yoshimi's previous work did [4][5]. I submitted a talk proposal for PGCon in this year, and have measured and analyzed performance of my PostgreSQL with non-volatile WAL buffer, comparing with the original one that uses PMEM as "a faster- than-SSD storage." I will talk about the results if accepted. Best regards, Takashi Menjo [1] Persistent Memory (SNIA) https://www.snia.org/PM [2] Persistent Memory Development Kit (pmem.io) https://pmem.io/pmdk/ [3] Non-volatile Memory Logging (PGCon 2016) https://www.pgcon.org/2016/schedule/track/Performance/945.en.html [4] Introducing PMDK into PostgreSQL (PGCon 2018) https://www.pgcon.org/2018/schedule/events/1154.en.html [5] Applying PMDK to WAL operations for persistent memory (pgsql-hackers) https://www.postgresql.org/message-id/c20d38e97bcb33dad59e...@lab.ntt.co.jp -- Takashi Menjo <takashi.menjou...@hco.ntt.co.jp> NTT Software Innovation Center
0001-Support-GUCs-for-external-WAL-buffer.patch
Description: Binary data
0002-Non-volatile-WAL-buffer.patch
Description: Binary data
0003-README-for-non-volatile-WAL-buffer.patch
Description: Binary data