I just read this blog: 
https://mrotaru.wordpress.com/2013/10/10/scaling-to-12-million-concurrent-connections-how-migratorydata-did-it/
 
<https://mrotaru.wordpress.com/2013/10/10/scaling-to-12-million-concurrent-connections-how-migratorydata-did-it/>
 about scaling to 12 Million Concurrent Connections on a single server and it 
got me thinking.

Would it be possible to scale Dovecot IMAP server to 10 Million IMAP sessions 
on a single server?

I think the current implementation of having a separate process manage each 
active IMAP session (w/ the possibility of moving idling sessions to a single 
hibernate process) will never be able to deploy a single server managing 10 
Million IMAP sessions.

But, would it be possible to implement a new IMAP server plugin that uses a 
fixed configurable pool of “worker” processes, much like NGINX or PHP-FPM does. 
These servers can probably scale to 10 Million TCP connections, if the server 
is carefully tuned and has enough cores/memory to support that many active 
sessions.

I’m thinking that the new IMAP server could use some external database (e.g., 
Redis or Memcached) to save all the sessions state and have the “worker” 
processes poll the TCP sockets for new IMAP commands to process (fetching the 
session state from the external database when it has a command that is waiting 
on a response). The Dovecot IMAP proxies could even queue incoming commands to 
proxy many incoming requests to a smaller number of backend connections (like 
ProxySQL does for MySQL requests). That might allow each Dovecot proxy to 
support 10 Million IMAP sessions and a single backend could support multiple 
front end Dovecot proxies (to scale to 100 Million concurrent IMAP connections 
using 10 proxies for 100 Million connections and 1 backend server for 10 
Million connections).

Of course, the backend server may need to be beefy and have very fast NVMe SSDs 
for local storage, but changing the IMAP server to manage a pool of workers 
instead of requiring a process per active session, would allow bigger scale up 
and could save large sites a lot of money.

Is this a good idea? Or, am I missing something?

Kevin

Reply via email to