Inert Ramblings

Add more Courier-IMAP connections under Plesk

Posted in Gnus, IDTENT by Sciri on September 22, 2006

By default, UNIX-based servers running Plesk and the Courier-IMAP e-mail server drastically limit the number of inbound connections to prevent users from opening up too many concurrent sessions. Unfortunately, this artificially-low restriction can impact legitimate users who have multiple computers connecting to the Courier-IMAP server from behind a firewall or a single computer that runs an IMAP client that takes advantage of mailbox caching.

Plesk comes configured with a limit of 4 connections per IP address and a limit of 40 connections total. Modern IMAP clients such as Mozilla Thunderbird use mailbox caching to open up multiple connections to increase performance. In the case of Thunderbird, it opens up 5 connections by default which is already 1 connection more than Courier-IMAP’s default restriction. Add another few family or corporate computers behind a firewall and those additional users won’t be able to connect at all since a single Thunderbird client is already utilizing all 4 connections.

To increase this restriction, modify the /etc/courier-imap/imapd configuration file and change MAXDAEMONS and MAXPERIP to a more sane number. In the case of my configuration, I changed MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40. This allows all the machines behind my home firewall to connect to multiple accounts on the e-mail server with mailbox caching enabled.

But even those numbers may be too low for a corporate colocated server that services an entire company. Tweak those numbers based on your employee base; if 50 employees are connecting to the e-mail server from behind the same firewall then MAXPERIP could need to go as high as 250 (50 employees times 5 cached mailbox connections). Add e-mail clients of people working from home and MAXDAEMONS could go as high as 300 or 400.

Obviously, the connection limits are to prevent the Courier-IMAP server from using too many memory and CPU resources on the machine. Tweak the numbers based on the memory footprint of each daemon process and how much memory you have.

27 Responses

Subscribe to comments with RSS.

  1. Joel said, on October 11, 2006 at 10:36 am

    I was not aware of Plesk’s oddly low default settings. I mean until I started getting errors in Thunderbird about connection caching and then googled this post ;) Thanks for the great post!

    -Joel

  2. [...] BTW, here’s the fix for increasing Plesk’s default Courier-IMAP connections. I was receiving the following error in Thunderbird 1.5.0.7 on XP: [...]

  3. [...] from: http://www.inertramblings.com/2006/09/22/add-more-courier-imap-connections-under-plesk/ Plesk comes configured with a limit of 4 connections per IP address and a limit of 40 connections total. Modern IMAP clients such as Mozilla Thunderbird use mailbox caching to open up multiple connections to increase performance. In the case of Thunderbird, it opens up 5 connections by default which is already 1 connection more than Courier-IMAP’s default restriction. Add another few family or corporate computers behind a firewall and those additional users won’t be able to connect at all since a single Thunderbird client is already utilizing all 4 connections. [...]

  4. Oscar said, on January 9, 2007 at 7:25 am

    Thanks a lot for the tip! Apple Mail.app has severe problems with just 4 connections, so this saved my day!

  5. Central-B said, on January 11, 2007 at 4:05 pm

    It also makes sense to check the authdaemonrc options. Too few daemons can be another bottleneck–but of course, when configuring settings, tweak and balance for the particular system’s resources and other services.

  6. VC said, on May 16, 2007 at 4:32 pm

    Thanks a ton for the info! I found it pretty strange that the settings weren’t working for me at work, since relatively few people are using IMAP here. Things make a lot more sense after looking at the configuration file that’s set so low.

  7. [...] In principe heeft plesk een limiet van 4 imap connecties, dus 2 zou ook goed moeten gaan (tenzij outlook ze niet goed afsluiten of open houdt). Je kan bij wijze van test dit aantal ophogen om te kijken of dit het probleem is? linkje. [...]

  8. Ben Vallack said, on September 15, 2007 at 5:34 am

    What a great post – thanks. I just got a (dv) hosting account from Media Temple and was wondering why Apple Mail was throwing lots of errors. I think for this to work though I had to restart the courier server with:
    /etc/init.d/courier-imap restart

    Thanks
    Ben

  9. [...] Google und joelmama.com stiess ich auf inertramblings.com auf dessen die Lösung für mein Problem [...]

  10. IMAP und Outlook - Server Support Forum said, on October 16, 2007 at 12:47 pm

    [...] permalink Falls es noch akut ist, hatte auch das Problem. Das hier hat geholfen: Inert Ramblings » Blog Archive » Add more Courier-IMAP connections under Plesk [...]

  11. houserocker said, on January 25, 2008 at 7:28 am

    Thanks for the infos… hope this will help me too… Got the problem now since a long time and it’s making me sick!!

  12. Nick said, on March 14, 2008 at 10:45 pm

    You just stopped me from pulling all my hair out. Thanks!

  13. Max said, on April 13, 2008 at 11:20 pm

    Very useful post. Thanks!

  14. Joe said, on April 27, 2008 at 1:57 am

    Thank you so much for figuring this out. I want to love Plesk, but I keep bumping into these kind of stupid issues with their software.

  15. Boris said, on June 19, 2008 at 11:22 am

    This saved my day, too – Apple Mail was driving me insane. ;-)

  16. mark brown said, on June 30, 2008 at 2:02 pm

    great tip. Works. God knows why tech support at theplanet did not tell me this. They said to add a gig of ram, which surprise surprise did not work, but costs $20 a month extra.

  17. online shopping said, on July 24, 2008 at 5:22 am

    Also wasn’t aware of the low default settings. The above poster shows how little calldesks ever know. They tend to just dish out advice from sucking their thumb, but they never do their research. If they (at least) Googled the problem they probably would have found this post or details about the default settings. Rather, they just opted for the easy option. Quite typical of calldesks.

  18. imapper said, on October 2, 2008 at 2:04 pm

    Eggggscelent

  19. Chris Lawrence said, on October 6, 2008 at 5:47 pm

    You sir are a genius!

    This problem was absolutely killing me!

  20. Damien said, on October 29, 2008 at 6:29 pm

    Thank you very much for this tip. I was getting nervous while Mail.app was hanging.

    Thanks so much

  21. fine art said, on November 11, 2008 at 7:27 am

    What more can I say? Everybody else had said what I wanted you guys to know. Very simple post, but very effective. Keep it up!!!

  22. [...] interesante que leí en este Inertramblings.com, es que, Thunderbird por defecto, abre cinco conexiones contra el servidor de correo, por tanto, el [...]

  23. [...] interesante que leí en Inertramblings.com sobre Thunderbird que por defecto, abre cinco conexiones contra el servidor de correo, por tanto, [...]

  24. [...] habe gerade noch was gefunden. Inert Ramblings » Blog Archive » Add more Courier-IMAP connections under Pleskscheint besser zu laufen… mal schauen wie es sich die nächsten tage [...]

  25. Matthias said, on February 5, 2009 at 7:03 am

    Thanks, this note helped a lot!

  26. Shannon said, on March 6, 2009 at 2:51 pm

    Hope this does the trick. Errors from my Plesk IMAP account have been annoying me forever. Thanks!

  27. Lu Vencl said, on May 16, 2009 at 10:49 pm

    WOW!! That is all I can say.
    I have been troubleshooting IMAP problems for days and wondered why this only happened on a client that had two IPHONES, two laptops and three accounts.. Do the math and you can see what this has been hell after migrating from CPANEL to Plesk. Thanks!!!


Leave a Reply