IMAP performance dies on huge folders (>50k messages). Dovecot's index files keep it sane.
Index location (10-mail.conf):
mail_location = mdbox:/var/mail/vhosts/%d/%n:INDEX=/var/indexes/%d/%n
Putting indexes on fast local SSD while mailboxes live on slower bulk storage is the single best IMAP tuning trick.
Useful per-protocol limits:
service imap-login {
service_count = 1
process_min_avail = 4
vsz_limit = 256M
}
service imap {
vsz_limit = 1G
process_limit = 1024
}
process_min_avail = 4keeps 4 idle pre-auth workers ready so login latency is consistent.vsz_limitcaps memory per process — protects against pathological clients.
Enable IMAP IDLE forever: imap_idle_notify_interval = 2 mins. Most clients (iOS Mail, Thunderbird) rely on IDLE for push.
Sign in to keep track of what you have read.