On 3. Feb 2025, at 20.18, Anatoliy Zhestov via dovecot <dovecot@dovecot.org> wrote:
Are you sure the problem is authentication / pgsql? You could test with looping "doveadm auth lookup $user" rapidly. Of course for different users to avoid them coming from cache. Or if you can reproduce it that way, try if the same happens for repeating the same user so it does come from cache.
i test in condition when 90% of imap connection is already established. auth cache is enabled so i guess tests with the same user are not relevant.
-------- less loaded server ps waux|grep imap-login|wc -l 24977
Oh, somehow I missed that you have this many concurrent connections.
echo "13285 / 343" |bc 38 (per second)
So with this speed 24977 users would take 11 minutes to login back, which is a bit slow.
Some ideas:
If pgsql is the bottleneck, try multiple pgsql connections: Add maxconns=4 (or whatever) to the dovecot-sql.conf.ext's connect line.
In your Dovecot proxy (assuming you have one?) you can configure it to spread over disconnections over a long time, if the issue is that backend disconnects everyone at once. login_proxy_max_disconnect_delay setting does this.
With that many connections and to make logins faster, you'd be better off using https://doc.dovecot.org/2.3/admin_manual/login_processes/#high-performance-m...
To optimize login performance, it would be best to get rid of the post-login script. Also:
service imap { service_count = 1000 process_min_avail = 10 }
- auth_cache_size is rather small. Likely could be increased much larger.