On Mon, 2006-09-25 at 17:10 -0700, Tony Kay wrote:
Hi,
We are using Dovecot with maildir, and the mail client requests flags, internaldate, and uid for all messages on folder open, which on average takes 3 seconds, but for large folders is much longer.
It seems like I want mail_cache_fields to include "flags", but which date corresponds to internaldate? date.received?
Is UID always cached for messages, or does it have to read through the directory to get them? Are there other optimizations I can do that will improve the speed of folder opens?
It's not really necessary to change mail_cache_fields since it's only used initially before the client has done any requests. After client has once fetched the internaldate Dovecot remembers that and keeps it cached.
UID and flags are always stored in dovecot.index file.
I can think of two reasons why it's slow for you:
Maildir has changed, so Dovecot resyncs it. I don't think readdir() should take all that much time, but maybe it does with you?
internaldate isn't actually taken from dovecot.index.cache but each file is stat()ed separately.
I'd guess 2) is the problem, but I can't think of why it would happen. You can anyway verify this by running the imap process through strace and checking from its output if it does the stat() calls. If not, check with strace -tt where exactly it's spending all its time (assuming you're running Linux).