Mailserver Limits

Hi, here is few tips for Mai-in-a-Box under heavy load. I have about 30 mail accounts and some limit adjustments are needed for better user expirience.

Solve problem with failed login to IMAP.

# cat /var/log/syslog | grep drop

mx dovecot: master: Warning: service(imap-login): process_limit (100) reached, client connections are being dropped

Add higher limit.

# nano /etc/dovecot/conf.d/10-master.conf

service imap-login {
  process_limit = 500
  process_min_avail = 2

Limit max_user_instances for dovecot

# cat /var/log/mail.log | grep exceeded

mx dovecot: imap( Warning: Inotify instance limit for user 8 (UID mail) exceeded, disabling. Increase /proc/sys/fs/inotify/max_user_instances

Set bigger limit

# nano /etc/sysctl.conf

fs.inotify.max_user_instances = 1024
1 Like

What are the specs of the machine you’re using (e.g. the output of nproc)? Maybe we can set these automatically based on the machine specs?

Hi, from my observations process_limit is more
about usecase(number of mail accounts) than power of server.

Typical end user which uses imap thrue client (Thunderbird, …) whole day (8h or more) have 1-10 (mainly 2-5) connections (checked with “doveadm who”).

Some mail account can be shared between more users or user can have more devices connected in one time.

So with 30 mail accounts connected, current limit (100) can be reached quickly.

I think that solution can be based on planned/real number of mail accounts.

Second limit (max_user_instances) seems to be related to this post:

Few details about my configuration:

Supermicro server (16 cores, 64GB RAM) with KVM/libvirt virtualization (Debian).
Mail-in-a-Box guest machine (for now: 2 cores and 4GB RAM (412MB used)).

Okay, great. The next update will set better defaults for these. For the process limit, it will set default_process_limit (rather than the imap-specific process limit, but I think this applies to that too) to 250 time the number of machine cores. That will result in 500 for you still. I also added the inotify setting that you suggested. A reboot will be required (and not automatically performed) to pick up that setting though.