Alexandre Ratchov wrote, On 01/19/15 02:44:
On Mon, Jan 19, 2015 at 03:59:34AM +0000, currellbe...@gmail.com wrote:
Hello,
The FAQ[1] states that soft updates result in "a large performance increase
in disk writing performance," and links to a resource[2] which claims that
soft updates, in addition to being a performance enhancement, "can also
maintain better disk consistency." Resource 2 links to several academic
papers[3][4], which while they are a bit above my level, contain discussions
of how soft updates can increase performance and speed recovery on crash.
My question is: what are the downsides of soft updates?
- softdep consumes more cpu in kernel mode, which hurts interactive
programms on very slow machines. It has the reputation of
consuming more memory.
- the softdep code is more complex (likely to have more bugs).
Also, does journaling provide a better data-safety guarantee?
They are not the same. On OpenBSD, softdep makes cerain operations
much faster while ensuring that upon power loss, all
inconsistencies can be automatically fixed by fsck on next boot.
Journaling would write data twice (first in the journal, then in
the filesystem) and would allow last operations to be replayed on
next boot, so no need to run fsck, which in turn makes system boot
fast after a power loss.
In theory, from data safety point of view they are equivalent.
Jeez, I've been misinformed for many years. I do not enable softdep on
my battery-backed production servers thinking it was safer; the whole
idea of running less complex code and fewer lines of it. I figured
backup power would keep the filesystem from crashing, thus consistent,
and therefore no need for softdep.
Plus, IIRC, the default installer doesn't enable softdep either. So I
figured there was a good reason for that.
Coincidently, I was just running benchmarks two days ago for a web
session manager that I wrote. It simply stores session data to file for
each client. I tested it on ffs, ffs+softdep, and tmpfs. Here are the
average total times for creating 2,000 session files, each roughly 200
bytes, randomly distributed across 62 directories:
0.74s tmpfs
0.76s ffs+softdep
1.17s ffs
The FFS is on an Intel SSD.
So softdep can definitely enhance performance. And according to Kirk
McKusick, it also enhances FS consistency. So I think I'll be enabling
softdep on my production servers.
I'm sure all the bugs in that "complex" softdep code have been worked
out by now. ;-)