Subject: [Imap-uw] iowait when opening a mailbox?

From: "Tom Cooper" <[email-masked]>
Date: Wed, 17 Aug 2005 10:59:28 -0400 (EDT)

I'm using imapd-2002d on CentOS 3.4 (binary equivalent to RH ES 3)

This is my home server on a box with 640MB RAM, of which 540 MB is
consistently disk cache.

I am running apache 2.0.46 and squirrelmail 1.4 to provide webmail
service, and what I'm finding is that when I connect to the server there
are significant delays in opening my mail folders.

As I've investigated, I see that when imapd starts the system is in iowait
state for quite a while.  In this case, quite a while can be 30-60
seconds.  Since the overall load average on the box averages ~0.5-0.8, and
so much of the RAM is cache, I'm stumped as to why there seems to be so
much io going on.

My mail folders are mbox format on an ext3 partition.  The main mail
folder (file) is about 200M.   What can I do to increase performance?  (I
operate under the assumption that since I'm addicted to email that my mail
file is included in the dick cache.)

I'd appreciate any advice that can be provided.

Thanks in advance!

Regards,
Tom Cooper

_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: Mark Crispin <[email-masked]>
Date: Wed, 17 Aug 2005 08:32:16 -0700 (PDT)

The first thing that you should do is update your software.  imap-2002d is 
an older version.  The current release version is imap-2004e.

In traditional UNIX mailbox format, it is necessary to read every byte of 
the file as part of startup.  A 200MB mailbox is a lot to read.  It may 
also be necessary to do some rewriting to assign UIDs and status to 
newly-delivered messages.  I agree though that your 540MB disk cache 
should keep this from happening.

One step to do if you consistantly have a mailbox of that size is to 
switch to the mbx format.  It greatly reduces the number of reads when the 
mailbox is opened, as well as the number of writes to update the mailbox. 
To get started on mbx format, read the following FAQ:
 	http://www.washington.edu/imap/IMAP-FAQs/index.html#4.5

Next, you need to investigate if the I/O wait isn't due to something else. 
For example:
  (1) imapd does a reverse DNS lookup on the client's IP address to get its
      name.
  (2) the c-client library attempts to launch IMAP-via-rsh to avoid the
      need to negotiate authentication.  Unfortunately, rsh tends to block
      for a minute if the rsh attempt is refused rather than quit
      immediately.
If either of these are the problem, it will show up even with small 
mailboxes.

Finally, does the problem happen with an IMAP client such as Pine?  I 
don't know whether squirrelmail does this, but many webmail programs 
literally make a separate IMAP connection on a per-click basis.  This puts 
a tremendous I/O load on the IMAP server.  Only a few very well-written 
webmail programs maintain a static IMAP connection in webmail.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw