[systemd-devel] [PATCH] [Up: 1h default] Add sync timer to journal server
kay at vrfy.org
Sat Mar 16 07:11:09 PDT 2013
On Sat, Mar 16, 2013 at 2:01 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Sat, Mar 16, 2013 at 12:43:09PM +0200, Oleksii Shevchuk wrote:
>> Sync journal with fdatasync every 1h (by default). Interval configured
>> via SyncInterval option at journal.conf. Manual sync can be performed
>> via sending SIGALRM.
> I think that this is at the same time both too much and not enough:
> syncing at fixed time intervals will be either a strain on resources,
> or rare enough not to make a difference. I would be better to setup
> the timer when data is received, and put if off whenever more data is
> received before it fires, and then sync when there's a quite period.
> Also, the file should be marked as clean, so that in case of sudden
> reboot it is known to be OK.
Right, I think we ideally never wake up when nothing has happened, not
even once every hour.
The sync should probably just happen right after a short period of
time after the last write, which is probably closer to 10-30 seconds
than an hour. And at that time the journal should be "soft closed" and
marked as clean, so that kill -9 of the journal daemon will not cause
a forced rotation of the journal file.
It might be sensible to force a flush after a certain amount of
messages too, so we are sure we push stuff to disk, even when the
logging frequency is larger than the idle timeout?
For the sync logic, I'm not sure, but I can imagine that we need to
msync() all mapping too, before we flush the stuff to the filesystem.
More information about the systemd-devel