# Nginx IMAP/POP3 Proxy Connection Pooling

**URL:** <https://www.ruby-forum.com/t/nginx-imap-pop3-proxy-connection-pooling/203318>\
**Category:** NGINX\
**Created:** [February 17, 2011, 6:15pm UTC](https://www.ruby-forum.com/t/nginx-imap-pop3-proxy-connection-pooling/203318 "2011-02-17T18:15:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 17, 2011, 6:15pm UTC](https://www.ruby-forum.com/t/nginx-imap-pop3-proxy-connection-pooling/203318/1 "2011-02-17T18:15:25Z")

</div>

We’re going to be using nginx to do imap and pop3 proxying. As some of  
you know, we are the the mercy of the mail client as to the number of  
connections that we will see from a user’s client. In extreme cases, if  
a user has 40 Folders, their client will create 1 connection for each  
folder. In this situation, we’ll see 10s of connections for just 1  
user.

I couldn’t find any config settings to setup server-side (backend)  
connection pools. I’d love to set up nginx so that I get 1000s of  
incoming/client connections, but only a fraction of that to the backend  
mail servers. My goal is to avoid the 1:1 ration of connections.

Any help is greatly appreciated!  
-James

Posted at Nginx Forum:

> **[Nginx IMAP/POP3 Proxy Connection Pooling](https://forum.nginx.org/read.php?2,176215,176215#msg-176215)**
>
> We're going to be using nginx to do imap and pop3 proxying. As some of you know, we are the the mercy of the mail client as to the number of connections that we will see from a user's client. In extreme cases, if a user has 40 Folders, their client...

---

<div class="post-metadata">

**Author:** ![JamesR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9a28c/32.png) [@JamesR](https://www.ruby-forum.com/u/JamesR)\
**Post date:** [February 17, 2011, 7:50pm UTC](https://www.ruby-forum.com/t/nginx-imap-pop3-proxy-connection-pooling/203318/2 "2011-02-17T19:50:06Z")

</div>

Hello!

On Thu, Feb 17, 2011 at 12:14:13PM -0500, JamesR wrote:

> We’re going to be using nginx to do imap and pop3 proxying. As some of  
> you know, we are the the mercy of the mail client as to the number of  
> connections that we will see from a user’s client. In extreme cases, if  
> a user has 40 Folders, their client will create 1 connection for each  
> folder. In this situation, we’ll see 10s of connections for just 1  
> user.

Actually, you should say “thanks” to the protocols, not to the  
mail clients.

> I couldn’t find any config settings to setup server-side (backend)  
> connection pools. I’d love to set up nginx so that I get 1000s of  
> incoming/client connections, but only a fraction of that to the backend  
> mail servers. My goal is to avoid the 1:1 ration of connections.

The problem is that imap is statefull protocol, so this is not  
really possible. At least not without re-implementing large parts  
of real imap server in nginx and using backends as some sort of  
storage (periodically polling for changes on backends and so on,  
including requirement for backends to support RFC4551 to make sure  
re-sync won’t consume to many resources).

Maxim D.
