Benchmarking qmail on Linux
Filesystems
Critical qmail Operations
A message managed by the typical qmail system goes through either
two or three stages.
- The message is either generated locally or received from a
remote system and added to the queue. This stage causes the following
disk write operations:
- queue/pid/PID.TIMESTAMP.1 is created (and
queue/pid is implicitly fsync'ed).
- queue/pid/PID.TIMESTAMP.1 is linked to
queue/mess/#/INODE (and queue/mess/# is implicitly
fsync'ed).
- queue/pid/PID.TIMESTAMP.1 is unlinked (and
queue/pid is implicitly fsync'ed).
- The message body is written to queue/mess/#/INODE
(opened at stage #1) and explicitly fsync'ed.
- queue/intd/INODE is created (and
queue/intd is implicitly fsync'ed).
- The message envelope is written to queue/intd/INODE and
explicitly fsync'ed.
- queue/intd/INODE is linked to
queue/todo/INODE (and queue/todo is implicitly
fsync'ed).
In total, there are 7 synchronous disk operations done during
the injection process. Of those, the synchronicity of operations 1,
3, and 5 is not required for reliability.
- The message is processed and delivered by qmail-send.
The processing stage causes the following disk write operations:
- queue/info/#/INODE is created (and
queue/info/# is implicitly fsync'ed).
- If the message has local recipients,
queue/local/#/INODE is created (and queue/local/#
is implicitly fsync'ed).
- If the message has remote recipients,
queue/remote/#/INODE is created (and
queue/remote/# is implicitly fsync'ed).
- queue/info/#/INODE is written and explicitly fsync'ed.
- If the message has local recipients,
queue/local/#/INODE is written and explicitly fsync'ed.
- If the message has remote recipients,
queue/remote/#/INODE is written and explicitly fsync'ed.
- queue/intd/INODE is unlinked by qmail-clean
(and qmail/intd is implicitly fsync'ed).
- queue/todo/INODE is unlinked by qmail-clean
(and qmail/todo is implicitly fsync'ed).
- if the message has local recipients,
queue/local/#/INODE is unlinked (and queue/local/#
is implicitly fsync'ed).
- if the message has remote recipients,
queue/remote/#/INODE is unlinked (and
queue/remote/# is implicitly fsync'ed).
- queue/info/#/INODE is unlinked (and
queue/info/# is implicitly fsync'ed).
- queue/mess/#/INODE is unlinked by qmail-clean
(and queue/mess/# is implicitly fsync'ed).
In total, there are 6, 9, or 12 synchronous disk operations done
during the queue processing stage, depending on if the message had
local or remote recipients.
- For each local recipient, the message is delivered to a
maildir. This stage causes the following disk write operations:
- maildir/tmp/PID.TIMESTAMP.HOSTNAME is created (and
maildir/tmp is implicitly fsync'ed).
- The message is written to the above file and explicitly
fsync'ed.
- maildir/tmp/PID.TIMESTAMP.HOSTNAME is linked to
maildir/new/PID.TIMESTAMP.HOSTNAME (and
maildir/new is implicitly fsync'ed).
- maildir/tmp/PID.TIMESTAMP.HOSTNAME is unlinked (and
maildir/tmp is implicitly fsync'ed).
In total, there are 4 synchronous disk operations done during
maildir delivery. Of those, the synchronicity of the first and last
stages is not required for reliability.