[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: slow courierpop3d



On Tue, Mar 29, 2005 at 05:26:28PM +0200, Marek Podmaka wrote:
>   I have a problem with courierpop3d accessing Maildir. For folder
>   "cur" with ~300 messages with total size of 120 MB it takes more
>   than 5 seconds - I see that in "top".

300 messages should be fast. total size shouldn't make much difference,
Maildir imap/pop doesn't need to scan the entire message the way it has
to with mbox files.

>   Maildirs are on ext2 partition.

this is probably where your problem lies. ext2 is no good when it comes
to having lots of files in a directory. definitely not recommended for
Maildir spools or news spools or anything else that has that usage
pattern.

>   Kernel is 2.4.26, proc 1.2 GHz, 1 GB RAM... Firstly I
>   thought it was because of number of files in that maildir... but
>   using info in /proc/pid/fd I figured out the directory and there
>   were only ~300 files. Why does does courier spend so much time
>   reading that maildir?

there may have been more than 300 messages in that directory in the
past. did it ever have, say, thousands of messages in it at once? if so,
then the directory will always be slow from that point on, even if all
the files that were in it have since been deleted.

you can test whether this is the case by running 'ls -l' in the Maildir.
if it takes a long time just to get a listing, then the directory itself
is huge and slow.

once a directory gets bloated like this, i've found that the only way to
"speed up" the directory again is to delete it and re-create it. do this
by renaming the old directory to Maildir.OLD, create the new dir with
the right ownership/perms, and then mv the files that are in the old dir
to the new one. then you can delete Maildir.OLD

or, better yet, don't use a filesystem for Maildir which is known to be
crappy when you have lots of files in a directory (i.e. don't use ext2
or ext3). use xfs or reiserfs instead.

reiserfs probably offers slightly better performance than xfs for
Maildir (it excels at lots-of-files-in-a-dir), but xfs is a better
general purpose fs and has been in production use and tested for much
longer. it's also stable (as in doesn't change or add new features or
get redesigned/rewritten - i.e. finished product), whereas reiserfs is
something of a moving target, still under heavy & rapid development. 

i use both, depending on the application, but my default is xfs unless i
have a very good reason/need to use reiser.

craig

-- 
craig sanders <cas@taz.net.au>           (part time cyborg)



Reply to: