pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: linuxhippy@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9161: wal_writer_delay is limited to 10s
Date: Sun, 09 Feb 2014 12:14:06 -0500
Message-ID: <15612.1391966046@sss.pgh.pa.us> (raw)
In-Reply-To: <20140209122404.26449.49425@wrigleys.postgresql.org>
References: <20140209122404.26449.49425@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

linuxhippy@gmail.com writes:
> It seems wal_writer_delay is limited to 10s without any technical reason.

The "technical reason" is that values much larger than that would be a
performance and reliability disaster for typical installations.

> I am using postgresql in an embedded system and writing every 10s
> burns flash at an amazing rate (a 32GB SDHC card survived 4 days with
> only a few GB written) - I've now switched from ext4 to nilfs2 which is able
> to distribute writes more evenly - but I am still not confident this setup
> would last longer than a few weeks/months.

> A wal_writer_delay of arround ~1h would be a lot more efficient and solve
> this issue.

It's not apparent to me what usage pattern that would actually help with.
If the system is idle then it doesn't matter whether the WAL writer wakes
up or not.  But if you're generating WAL, it's going to get written anyway
whenever a transaction commits.  You could forestall that with fsync=off,
perhaps, but if you do that then the WAL writer won't fsync either, so
it shouldn't matter how often it wakes up.  Checkpoints will force WAL
output more often than once per hour by default, too.  So I'm wondering
exactly what combination of other settings you envision using this with,
and what's the workload of the database server.

While it could certainly be argued that the limit of 10s is a bit too
tight, allowing values as large as 1h would be a large-caliber foot gun
for most people.  So I'm very hesitant to raise it that far without a
more convincing argument that useful behavior can be had there.

The bigger picture is that if you allow WAL to not reach disk for 1h,
that's up to 1h worth of data that you lose irretrievably in a crash.
So even if this adjustment allowed you to get that behavior, it's not
very attractive behavior.  If you actually are OK with such little data
security, maybe you should consider other approaches.  Perhaps you could
keep the whole database on a RAM disk (tmpfs) and rsync it to flash every
hour, or some variant of that?

Also, if I understand your problem correctly, it's not so much that
you'd like the WAL writer to not write often as that you'd like it
to not write partial blocks.  We might be willing to accept a patch
that added a setting and some logic to control things that way.
But I'm pretty dubious that just changing the upper limit of
wal_writer_delay is going to have useful results, even in your scenario.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (15+ messages)  latest in thread

Message-ID: <15612.1391966046@sss.pgh.pa.us>
Permalink:  ../15612.1391966046@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15612.1391966046@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, linuxhippy@gmail.com
  Subject: Re: BUG #9161: wal_writer_delay is limited to 10s
  In-Reply-To: <15612.1391966046@sss.pgh.pa.us>
  References: <20140209122404.26449.49425@wrigleys.postgresql.org> <15612.1391966046@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox