Mail server scalability

What problems do we come across?

Linear password files

On some systems, every mail delivery and pop3 connection requires a scan through the whole /etc/passwd file.

Linear mbox files

If a user keeps their mail on the server, every POP3 or IMAP connection and every mailbox change requires the POP3 daemon to read the entire mail file. 30,000 messages is a 500MB mailbox file that takes 30 seconds to scan.

Maildir is an alternative which stores each message in its own file:

Too many files in one directory

CPU limits

Disk performance

Separate SMTP (smarthost) and POP3/IMAP services separate

Separating SMTP and POP3/IMAP on separate machines is an easy way to scale your mail service. Plan for it by using separate hostnames (e.g. pop3 and smtp) that may initially point to the same machine.

pop3.example.com does not relay, accepts incoming SMTP for delivery to local mailboxes only
smtp.example.com relays, has no local mailboxes

There is an additional advantage: mail routing works correctly even if one of your customers leaves (moves their domain's MX records to point somewhere else) without telling you.