Skip to content

Mail server tuning for 10K+ accounts on one cPanel node

How to tune Exim, Dovecot, and the underlying filesystem on a cPanel server that hosts thousands of mailboxes so concurrency does not become the bottleneck before mail volume does.

A cPanel host with under a thousand mailboxes rarely needs tuning beyond cPanel’s defaults. At 10,000+ mailboxes, the defaults bite: Exim queue runners step on each other, Dovecot processes hit OS-level limits on open files, the filesystem (especially ext4 with default journaling) chokes on maildir small-file IO. Tuning here is not optional — it’s the difference between a server that handles its base and one that’s perpetually backlogged.

What’s happening

cPanel’s default Exim configuration sets queue_run_max to a modest number, which is fine for hundreds of mailboxes and inadequate for tens of thousands. Dovecot’s default process limits, mailbox indexes, and connection handling assume a smaller deployment. The Linux kernel’s open-file and inotify limits — nofile, fs.inotify.max_user_watches — were chosen for desktops. Each of these caps you hit before mail volume actually requires it.

How to verify

Audit the current limits and live usage:

ulimit -n
sysctl fs.inotify.max_user_watches
exim -bP | grep -E "(queue_run_max|smtp_accept_max)"
doveconf | grep -E "(process_limit|client_limit|service_count)"
ss -s
df -i /var

The last command shows inode usage — maildir storage can exhaust inodes long before bytes if many small files accumulate.

The fix

  1. Raise file descriptor limits in /etc/security/limits.conf and the systemd unit overrides for Exim and Dovecot:

    exim soft nofile 65535
    exim hard nofile 65535
    dovecot soft nofile 65535
    dovecot hard nofile 65535

    Verify with cat /proc/$(pgrep -f exim)/limits | grep "Max open files".

  2. Tune Exim’s queue concurrency. queue_run_max = 20 is reasonable for 10K accounts; raise to 50 if the host has the CPU and the queue is consistently backlogged. Also raise smtp_accept_max to 200+.

  3. Tune Dovecot processes. Raise process_limit and client_limit in /etc/dovecot/conf.d/10-master.conf for the imap-login and pop3-login services. For 10K mailboxes with active clients, 1000+ processes is normal.

  4. Choose filesystem features that suit maildir. ext4 with noatime and dir_index is fine; XFS handles small-file IO better at scale. If on ext4, ensure noatime is mounted to avoid every read updating access times.

  5. Move heavy mailbox storage to dedicated volumes. A single disk holding root + mail at high IO is a contention point; split mail to a separate physical or virtual disk.

  6. Monitor the actual bottleneck. iostat -xz 1, vmstat 1, and Dovecot’s doveadm stats show what’s actually constrained. Tune what the data points at, not what you assume.

For cPanel deployments crossing the 10K-mailbox threshold, Stack Harbor handles the tuning and the ongoing monitoring as part of environment management.