On 01/22/2010 10:15 AM, Brandon Davidson wrote:
We've thought about enabling IP-based session affinity on the load balancer, but this would concentrate the load of our webmail clients, as well as not really solving the problem for users that leave clients open on multiple systems.
Webmail and IMAP servers are on the same network for us so we don't have to go through the BigIP for this, we just use local round-robin DNS to avoid any sort of clumping. Imapproxy or dovecot proxy local to the webmail server would get around that too.
I've done a small bit of looking at nginx's imap proxy support, but it's not really set up to do what we want, and would require moving the IMAP virtual server off our load balancers and on to something significantly less supportable. Having the dovecot processes 'talk amongst themselves' to synchronize things, or go into proxy mode automatically, would be fantastic.
Though we aren't using NFS we do have a BigIP directing IMAP and POP3 traffic to multiple dovecot stores. We use mysql authentication and the "proxy_maybe" option to keep users on the correct box. My tests using an external proxy box didn't significantly reduce the load on the stores compared to proxy_maybe. And you don't have to manage another box/config. Since you only need to keep users on the _same_ box and not the _correct_ box, if you're using mysql authentication you could hash the username or domain to a particular IP address:
SELECT CONCAT('192.168.1.', ORD(UPPER(SUBSTRING('%d', 1, 1))) AS host, 'Y' AS proxy_maybe, ...
Just assign IP addresses 192.168.1.48-90 to your dovecot servers. Shift the range by adding or subtracting to the ORD. A mysql function would likely work just as well. If a server goes down, move it's IP. You could probably make pairs with heartbeat or some monitoring software to do it automatically.
-David