# Mailserver Limits

**URL:** <https://discourse.mailinabox.email/t/mailserver-limits/228>\
**Category:** Improvements\
**Created:** [December 29, 2014, 2:16pm UTC](https://discourse.mailinabox.email/t/mailserver-limits/228 "2014-12-29T14:16:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![radek](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@radek](https://discourse.mailinabox.email/u/radek)\
**Post date:** [December 29, 2014, 2:16pm UTC](https://discourse.mailinabox.email/t/mailserver-limits/228/1 "2014-12-29T14:16:46Z")

</div>

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(user@domain.cz): 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
```

---

<div class="post-metadata">

**Author:** ![JoshData](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/joshdata/32/2153_2.png) [@JoshData](https://discourse.mailinabox.email/u/JoshData)\
**Post date:** [December 29, 2014, 6:36pm UTC](https://discourse.mailinabox.email/t/mailserver-limits/228/2 "2014-12-29T18:36:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![radek](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@radek](https://discourse.mailinabox.email/u/radek)\
**Post date:** [December 29, 2014, 11:32pm UTC](https://discourse.mailinabox.email/t/mailserver-limits/228/3 "2014-12-29T23:32:02Z")

</div>

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: [http://www.dovecot.org/pipermail/dovecot/2013-March/088834.html](http://www.dovecot.org/pipermail/dovecot/2013-March/088834.html)

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)).

---

<div class="post-metadata">

**Author:** ![JoshData](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/joshdata/32/2153_2.png) [@JoshData](https://discourse.mailinabox.email/u/JoshData)\
**Post date:** [January 2, 2015, 11:27pm UTC](https://discourse.mailinabox.email/t/mailserver-limits/228/4 "2015-01-02T23:27:36Z")

</div>

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.

Thanks.
