[Dovecot] Why dovecot is not multi-threaded?
tss at iki.fi
Mon May 26 22:49:46 EEST 2003
On Mon, 2003-05-26 at 21:08, Ruben Alvarez wrote:
> I'm looking for the most efficient OpenSource IMAP server
> and I am told that Dovecot Server is a good solution.
> Anyway, I have inspected the source code and I think Dovecot is not a
> multi-threaded server, but a forked server. I am surprised about this
> issue, because threads perfomance should be higher than creating a new
> process for each connection....I suppose.
Well, I actually already replied privately to this when it was sent to
imap-list, but here's a more complete answer for everyone:
Threads are useful when you have a lot of data to share across the
threads. For anything else they're not worth the trouble and can
actually be even slower than processes in some cases because of extra
locking it needs. In UNIX that is. In Windows processes are a lot
heavier than threads.
Pretty much the only case in IMAP server when you want to share data is
when a mailbox is opened multiple times by different connections.
Dovecot already shares the data in that case because it's all in the
index files that are mmap()ed.
Processes also provide safety. You can't accidentally read someone
else's mails because of a bug in the server. Or if you happen to learn
how to crash the server, you can kill only your own connection. With
threaded server you would have killed everyone's connections.
> By the other hand, ¿do anybody know any multi-threaded OpenSource IMAP
> server?. I would like test performance of Dovecot server versus a
> multi-threaded one.
Biggest performance differences between IMAP servers is how smartly they
store the message data and how smartly they're able to read it in a way
that IMAP clients want them.
CPU usage is pretty irrelevant in IMAP servers. It's I/O that is going
to be your bottleneck. I optimize CPU usage only when it's clearly
showing somewhere (SEARCH BODY is a lot slower than grepping the files,
I'd have to figure out why some day).
More information about the dovecot