[Dovecot] Design: Asynchronous I/O for single/multi-dbox

Jakob Hirsch jh at plonk.de
Tue Mar 16 14:35:46 EET 2010


Stan Hoeppner, 2010-03-16 10:50:

>> AFAIK, KSM is primarily useful for vservers (xen, kvm etc.) running the
>> same software. How would running a single instance of dovecot (or any
>> other daemon) profit by that? AFAICS, "generates many instances of the
>> same data" does not apply to dovecot (or most other deamons).
> You didn't read the paste Jakob.  Or maybe you don't comprehend the
> material?  Also, it seems you're unaware that Dovecot creates at minimum 1

Or maybe your understanding of modern OS's memory handling is just
naive. You should really learn the basics before you jump about The New
Thing.

> code is identical.  If they're all identical, why have 500 copies in memory
> instead of one?

You won't, the code pages are just mapped, just like the shared libs
that the programm uses.
Btw, you can look up the map with pmap. E.g.:

# pmap -d 13465
Address   Kbytes Mode  Offset           Device    Mapping
0061c000     120 r-x-- 0000000000000000 008:00002 ld-2.11.1.so
...
0063e000    1468 r-x-- 0000000000000000 008:00002 libc-2.11.1.so
...
007b0000      12 rw--- 0000000000000000 000:00000   [ anon ]
007e1000      12 r-x-- 0000000000000000 008:00002 libdl-2.11.1.so
...
007e8000      88 r-x-- 0000000000000000 008:00002 libpthread-2.11.1.so
...
00800000       8 rw--- 0000000000000000 000:00000   [ anon ]
00804000      28 r-x-- 0000000000000000 008:00002 librt-2.11.1.so
...
00dd5000       4 r-x-- 0000000000000000 000:00000   [ anon ]
08047000     744 r-x-- 0000000000000000 008:00002 imap
08101000       8 rw--- 00000000000b9000 008:00002 imap
08103000       4 rw--- 0000000000000000 000:00000   [ anon ]
09d27000     456 rw--- 0000000000000000 000:00000   [ anon ]
b780b000     268 r--s- 0000000000000000 008:00005 dovecot.index.cache
b784e000       8 rw--- 0000000000000000 000:00000   [ anon ]
b7859000       4 rw--- 0000000000000000 000:00000   [ anon ]
bfc02000      84 rw--- 0000000000000000 000:00000   [ stack ]
mapped: 3360K    writeable/private: 604K    shared: 268K

Out of the 3360K one of my imap processes has "mapped", only 604K is
"writeable/private".

> It appears from my vantage point as a non programmer

That's the problem here, I guess.

> Fast forward to a threaded Dovecot design, and you still benefit from KSM,
> because all the imap worker threads are duplicate code, probably the same

The same applies here. Furthermore, also the data pages are shared
between processes (or threads, but that's just slightly different) until
a process writes to a pages (see copy-on-write), so the advantage of KSM
would be near zero (or even below).



More information about the dovecot mailing list