Re: fallocate / posix_fallocate for new WAL file creation (etc...)

From: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Jim Nasby <jim(at)nasby(dot)net>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Davis <pgsql(at)j-davis(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Date: 2013-05-15 21:26:15
Message-ID: CAKuK5J151q9viPA1L3C=7DopApN3HZNpg+Ze5JEyGyPSxjDH5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 14, 2013 at 9:43 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, May 13, 2013 at 9:54 PM, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> wrote:
>> Pertinent to another thread titled
>> [HACKERS] corrupt pages detected by enabling checksums
>> I hope to explore the possibility of using fallocate (or
>> posix_fallocate) for new WAL file creation.
>>
>> Most modern Linux filesystems support fast fallocate/posix_fallocate,
>> reducing extent fragmentation (where extents are used) and frequently
>> offering a pretty significant speed improvement. In my tests, using
>> posix_fallocate (followed by pg_fsync) is at least 28 times quicker
>> than using the current method (which writes zeroes followed by
>> pg_fsync).
>>
>> I have written up a patch to use posix_fallocate in new WAL file
>> creation, including configuration by way of a GUC variable, but I've
>> not contributed to the PostgreSQL project before. Therefore, I'm
>> fairly certain the patch is not formatted properly or conforms to the
>> appropriate style guides. Currently, the patch is based on 9.2, and is
>> quite small in size - 3.6KiB.

I have re-based and reformatted the code, and basic testing shows a
reduction in WAL-file creation time of a fairly significant amount.
I ran 'make test' and did additional local testing without issue.
Therefore, I am attaching the patch. I will try to add it to the
commitfest page.

--
Jon

Attachment Content-Type Size
0001-enhance-GUC-and-xlog-with-wal_use_fallocate-boolean-.patch application/octet-stream 5.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-05-15 21:34:45 Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Previous Message Dev Kumkar 2013-05-15 21:22:11 Re: "on existing update" construct