Benchmarking qmail on Linux Filesystems

Critical qmail Operations

A message managed by the typical qmail system goes through either two or three stages.

  1. 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:
    1. queue/pid/PID.TIMESTAMP.1 is created (and queue/pid is implicitly fsync'ed).
    2. queue/pid/PID.TIMESTAMP.1 is linked to queue/mess/#/INODE (and queue/mess/# is implicitly fsync'ed).
    3. queue/pid/PID.TIMESTAMP.1 is unlinked (and queue/pid is implicitly fsync'ed).
    4. The message body is written to queue/mess/#/INODE (opened at stage #1) and explicitly fsync'ed.
    5. queue/intd/INODE is created (and queue/intd is implicitly fsync'ed).
    6. The message envelope is written to queue/intd/INODE and explicitly fsync'ed.
    7. 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.

  2. The message is processed and delivered by qmail-send. The processing stage causes the following disk write operations:
    1. queue/info/#/INODE is created (and queue/info/# is implicitly fsync'ed).
    2. If the message has local recipients, queue/local/#/INODE is created (and queue/local/# is implicitly fsync'ed).
    3. If the message has remote recipients, queue/remote/#/INODE is created (and queue/remote/# is implicitly fsync'ed).
    4. queue/info/#/INODE is written and explicitly fsync'ed.
    5. If the message has local recipients, queue/local/#/INODE is written and explicitly fsync'ed.
    6. If the message has remote recipients, queue/remote/#/INODE is written and explicitly fsync'ed.
    7. queue/intd/INODE is unlinked by qmail-clean (and qmail/intd is implicitly fsync'ed).
    8. queue/todo/INODE is unlinked by qmail-clean (and qmail/todo is implicitly fsync'ed).
    9. if the message has local recipients, queue/local/#/INODE is unlinked (and queue/local/# is implicitly fsync'ed).
    10. if the message has remote recipients, queue/remote/#/INODE is unlinked (and queue/remote/# is implicitly fsync'ed).
    11. queue/info/#/INODE is unlinked (and queue/info/# is implicitly fsync'ed).
    12. 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.

  3. For each local recipient, the message is delivered to a maildir. This stage causes the following disk write operations:
    1. maildir/tmp/PID.TIMESTAMP.HOSTNAME is created (and maildir/tmp is implicitly fsync'ed).
    2. The message is written to the above file and explicitly fsync'ed.
    3. maildir/tmp/PID.TIMESTAMP.HOSTNAME is linked to maildir/new/PID.TIMESTAMP.HOSTNAME (and maildir/new is implicitly fsync'ed).
    4. 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.