On Apr 21, 2017, at 4:43 AM, dave@evilcigi.eu wrote:
Hi everyone,
I'm running dovecot with quite a lot of users and lots of active imap connections (like 20'000). I'm using different user IDs for users, so I need to have imap {service_count=1} - i.e. I have a lots of imap processes running.
Everything works fine, until I reload dovecot configuration. When that happen, every client is forced to relogin in the same time and that causes a huge system load spike (2-3000 5 min load).
I was thinking that it would be great, if dovecot wouldn't kick all the users in the same time during reload, but somehow gradually, during specified interval. I'm aware of the shutdown_clients directive that could help, but I don't like it - I do want the clients get disconnected on dovecot shutdown and also I want them to relogin in reasonably short time after reload.
You could run a Dovecot IMAP proxy in a Docker container on your server and run a separate Dovecot IMAP server in another container. Once both containers are up and running, enable the Dovecot IMAP proxy to start sending IMAP sessions to the IMAP server. When the time comes to change the Dovecot configuration, deploy another instance of Dovecot IMAP server with the new configuration. Once the new container is up and running, configure Dovecot IMAP proxy to direct a few specific test users to the new Dovecot IMAP server. When satisfied that the new server can handle new user sessions, configure Dovecot IMAP proxy to direct all new sessions to the new instance. After everything seems to be working fine for a period of time, start kicking users on the old Dovecot IMAP server off (at a comfortable pace) so they will reconnect to the new Dovecot IMAP server. When the old Dovecot IMAP server is no longer managing any sessions, it can be removed from the server (that is, the Docker container stopped and eventually removed completely).
Since all containers are running on the same host server, the old and new Dovecot containers will be configured to access the same Dovecot mail storage by mounting the host storage to both containers.
I think Docker containers are the easiest way to manage Dovecot in production.
Kevin