IMAP very slow

kcackler

Verified User
Joined
Apr 14, 2008
Messages
25
I've got a very lightly loaded server (Usage constantly at .1) and a single user with a 500MB mailbox (Dovecot)

When he is accessing his mailbox, imap slows to a crawl for EVERYONE on the server. Any tips or recommended configurations for dovecot?
 
Relatively low, as this machine is just doing light email serving for a select few people. Not much processor (600MHz guaranteed) and 512MB of ram (1GB burst)

Being as this machine isn't doing much, I would assume those specs would handle a single 500MB mailbox.
 
So this is a VPS then..... It's a little hard to troubleshoot a VPS as other users on the same box can and will effect your performance. Most companies don't tell you this and certainly won't advertise it, but it's true and often is the cause of issues after you have spent days looking for trouble.
 
This is a VPS on a dedicated box of ours. This is also the only VPS on this entire box, so there are no other virtual machines to screw up this machine's performance. That's why I'm a bit curious as to the cause of the slowdown.
 
ahhhhhh I see..... Have you tried emptying out this e-mail box and see if it improves? you can just backup the 500mb of e-mail and then put it back after testing.

I have one customer that loves imap and insist on it... when his box get's on the larger size, it does slow down a little for him, it hasn't effected others, but most use pop3 rather then imap though.
 
Yep, things speed right up as soon as his mailbox is empty. The slowdowns only occur when he is actually connected to the server. As soon as he disconnects, things go back to normal. I don't want to throw more resources at the problem, really, as we have other uses for them...I just thought perhaps there was a configuration change that could be made to dovecot to make things snappier for large mailboxes.
 
If there is I'm interested too.... I wish I had the answer but from my experience this seems to be the norm on large imap boxes.

I will be watching for an answer too :)
 
DirectAdmin Dovecot implementations only run on Maildir.

My first thought would be: Are you sure you're running Dovecot on DirectAdmin with Maildir?

But let's presume you are; you probably know what you're running :).

What happens if you remove the index files used by Dovecot, and then let Dovecot rebuild them the next time the user logs in?

What shows in top when the user is using imap?

It seems a bit unusual that there would be a general slowdown or impact on the server, since while using imap on a Dovecot server running Maildir, messages should only be run one at a time.

Jeff
 
Yes - We are 100% definitely running Dovecot on DirectAdmin with Maildir - No question there.

Deleted the index files - Still slow.

Output of top while user is logged in to roundcube:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 18 0 2060 652 560 S 0.0 0.1 0:04.25 init
1960 dovecot 15 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login
3397 root 15 0 3128 556 448 S 0.0 0.1 0:01.90 da-popb4smtp
5170 root 15 0 22976 10m 3708 S 0.0 1.0 0:01.21 httpd
5674 apache 15 0 28932 14m 3348 S 0.0 1.5 0:00.47 httpd
5675 apache 15 0 26832 13m 3620 S 0.0 1.3 0:00.66 httpd
5687 apache 18 0 27628 14m 3552 S 0.0 1.4 0:00.46 httpd
5688 apache 16 0 27140 13m 3516 S 0.0 1.3 0:01.12 httpd
5757 root 15 -4 2144 520 344 S 0.0 0.0 0:00.00 udevd
5768 root 18 0 7144 1052 656 S 0.0 0.1 0:00.00 sshd
7175 root 16 0 1716 572 484 D 0.0 0.1 0:11.09 syslogd
7215 root 20 0 2716 872 700 S 0.0 0.1 0:00.00 xinetd
7251 apache 15 0 26328 12m 3596 S 0.0 1.2 0:01.25 httpd
7477 mail 15 0 8872 1060 640 S 0.0 0.1 0:01.19 exim
7523 apache 15 0 29272 15m 3512 S 0.0 1.5 0:02.49 httpd
7536 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
7689 ftp 18 0 2660 1260 832 S 0.0 0.1 0:03.10 proftpd
7700 root 18 0 4396 1116 572 S 0.0 0.1 0:10.49 crond
7712 root 18 0 5592 696 424 S 0.0 0.1 0:00.00 saslauthd
7713 root 18 0 5592 436 164 S 0.0 0.0 0:00.00 saslauthd
7793 nobody 15 0 8892 1352 956 S 0.0 0.1 0:00.51 directadmin
7922 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.02 mysqld
9595 named 18 0 71412 3784 2012 S 0.0 0.4 0:18.54 named
9638 root 18 0 10136 2836 2284 S 0.0 0.3 0:00.11 sshd
9652 root 15 0 3744 1556 1272 S 0.0 0.1 0:00.05 bash
9767 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
11324 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
11470 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
11516 apache 18 0 27584 13m 3352 S 0.0 1.3 0:00.25 httpd
11720 dovecot 18 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login
12246 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
13810 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
16380 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
17583 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
17639 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
17644 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
17662 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
17663 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
18159 apache 15 0 26448 13m 4112 S 0.0 1.3 0:02.68 httpd
19459 apache 15 0 28920 14m 3312 S 0.0 1.4 0:00.24 httpd
19462 apache 15 0 25104 12m 3072 S 0.0 1.2 0:00.15 httpd
19522 apache 15 0 26740 14m 3300 S 0.0 1.4 0:00.31 httpd
19747 apache 18 0 29212 15m 3384 S 0.0 1.5 0:00.15 httpd
19766 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
19778 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.00 mysqld
19779 cosafety 16 0 4212 1912 1176 D 0.0 0.2 0:00.01 imap
19791 dovecot 18 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
19803 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.00 mysqld
19804 cosafety 16 0 4212 1924 1192 D 0.0 0.2 0:00.01 imap
19805 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
19814 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.02 mysqld
19979 root 19 0 3608 1312 1148 S 0.0 0.1 0:00.00 mysqld_safe
20001 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.45 mysqld
20002 mysql 15 0 39744 19m 3736 S 0.0 1.9 0:00.62 mysqld
20003 mysql 24 0 39744 19m 3736 S 0.0 1.9 0:00.00 mysqld
20004 mysql 16 0 39744 19m 3736 S 0.0 1.9 0:00.05 mysqld
20005 mysql 17 0 39744 19m 3736 S 0.0 1.9 0:00.00 mysqld
20006 mysql 15 0 39744 19m 3736 S 0.0 1.9 0:00.12 mysqld
20008 mysql 18 0 39744 19m 3736 S 0.0 1.9 0:00.94 mysqld
20009 mysql 15 0 39744 19m 3736 S 0.0 1.9 0:01.35 mysqld
20010 mysql 16 0 39744 19m 3736 D 0.0 1.9 0:00.65 mysqld
20011 mysql 15 0 39744 19m 3736 S 0.0 1.9 0:00.95 mysqld

There is no impact on the server as a whole - Only imap seems to be affected. HTTP, MySQL, etc... all continue running snappily.
 
Oops - Messed up my copy/paste job....New top

top - 21:39:54 up 16 days, 1:58, 1 user, load average: 2.85, 1.86, 2.06
Tasks: 82 total, 1 running, 81 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.1%us, 0.2%sy, 0.0%ni, 96.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048576k total, 241756k used, 806820k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
25660 apache 15 0 24996 12m 3416 S 3.7 1.2 0:00.90 httpd
5321 root 15 0 2188 1064 820 R 0.3 0.1 0:00.02 top
1 root 18 0 2060 652 560 S 0.0 0.1 0:04.25 init
1779 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
3397 root 15 0 3128 556 448 S 0.0 0.1 0:01.93 da-popb4smtp
3934 root 15 0 9980 2828 2284 S 0.0 0.3 0:00.04 sshd
3958 root 15 0 3744 1552 1268 S 0.0 0.1 0:00.01 bash
3996 mysql 18 0 39092 19m 3780 S 0.0 1.9 0:00.00 mysqld
3997 cosafety 16 0 3772 1564 1172 D 0.0 0.1 0:00.02 imap
3998 dovecot 18 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
5170 root 18 0 22976 10m 3708 S 0.0 1.0 0:01.35 httpd
5266 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
5294 mysql 17 0 39092 19m 3780 S 0.0 1.9 0:00.00 mysqld
5295 cosafety 18 0 4196 1908 1168 D 0.0 0.2 0:00.01 imap
5314 dovecot 18 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
5757 root 15 -4 2144 520 344 S 0.0 0.0 0:00.00 udevd
5768 root 18 0 7144 1052 656 S 0.0 0.1 0:00.00 sshd
5980 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
7175 root 15 0 1716 572 484 S 0.0 0.1 0:11.14 syslogd
7215 root 20 0 2716 872 700 S 0.0 0.1 0:00.00 xinetd
7477 mail 18 0 8872 1060 640 S 0.0 0.1 0:01.19 exim
7536 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
7689 ftp 18 0 2660 1260 832 S 0.0 0.1 0:03.10 proftpd
7700 root 21 0 4396 1116 572 S 0.0 0.1 0:10.51 crond
7712 root 18 0 5592 696 424 S 0.0 0.1 0:00.00 saslauthd
7713 root 18 0 5592 436 164 S 0.0 0.0 0:00.00 saslauthd
7793 nobody 15 0 8892 1352 956 S 0.0 0.1 0:00.51 directadmin
7917 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
7919 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
9595 named 18 0 71412 3784 2012 S 0.0 0.4 0:18.57 named
9767 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
11324 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
11470 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
11720 dovecot 18 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login
17737 dovecot 15 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login
19979 root 19 0 3608 1312 1148 S 0.0 0.1 0:00.00 mysqld_safe
20001 mysql 15 0 39092 19m 3780 S 0.0 1.9 0:00.49 mysqld
20002 mysql 15 0 39092 19m 3780 S 0.0 1.9 0:00.69 mysqld
20003 mysql 24 0 39092 19m 3780 S 0.0 1.9 0:00.00 mysqld
20004 mysql 16 0 39092 19m 3780 D 0.0 1.9 0:00.05 mysqld
20005 mysql 17 0 39092 19m 3780 S 0.0 1.9 0:00.00 mysqld
20006 mysql 15 0 39092 19m 3780 S 0.0 1.9 0:00.14 mysqld
20008 mysql 15 0 39092 19m 3780 S 0.0 1.9 0:00.97 mysqld
20009 mysql 18 0 39092 19m 3780 S 0.0 1.9 0:01.42 mysqld
20010 mysql 16 0 39092 19m 3780 S 0.0 1.9 0:00.69 mysqld
20011 mysql 15 0 39092 19m 3780 S 0.0 1.9 0:00.98 mysqld
20279 apache 18 0 27360 13m 3408 S 0.0 1.3 0:01.45 httpd
22431 apache 15 0 25180 12m 3404 S 0.0 1.2 0:00.86 httpd
22452 apache 15 0 28708 15m 4084 S 0.0 1.5 0:00.65 httpd
22453 apache 15 0 27000 13m 3504 S 0.0 1.3 0:00.94 httpd
22476 dovecot 15 0 5040 1928 1592 S 0.0 0.2 0:00.00 imap-login
23726 root 18 0 18480 14m 1732 S 0.0 1.5 0:11.64 lfd
24550 apache 18 0 29172 15m 3676 S 0.0 1.5 0:00.45 httpd
26065 apache 18 0 28416 14m 3384 S 0.0 1.4 0:00.49 httpd
26300 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
26305 dovecot 15 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login
26310 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
26311 nobody 16 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
26312 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
26313 nobody 15 0 8892 580 184 S 0.0 0.1 0:00.00 directadmin
28024 dovecot 15 0 5040 1924 1592 S 0.0 0.2 0:00.00 imap-login
28212 dovecot 18 0 5028 1916 1584 S 0.0 0.2 0:00.00 pop3-login

We're increasing the available RAM and CPU * 4 this evening to see if that solves it. We were hoping to avoid that, but we just need to get it fixed.
 
My first guess is that the bottleneck is the disk access.
You can see it from the load average (note that in linux it includes the processes waiting for I/O transfer to disks and other devices, that is NOT true for UNIX) of the last minute which is more than 1 (2.85): it means that even if the CPU is in idle there was 1.85 processes in average waiting for something. That something may be a CD-ROM device, a printer, an hardware call of any kind... but since you say that only Dovecot is slowed down, it must be the disk.

Check your disks throughput with hdparm and use some low-level tools like iostat to see what's going on, both in the host system and hosted VPS. In my opinion you have some wrong settings (or wrong / not optimal file systems).
 
vmstat shows no swapping going on and nearly 100% cpu idle. I'm not much of a systems administrator (Just trying to take care of this since our normal guy is away right now), but it looks like I'm going to have to wait on him to come back.

Thanks for your help, and if you have any other ideas for me, please let me know.
 
Well the problem appears to have been completely related to roundcube. Switched to Squirrelmail and it is lightning fast. Same with using Outlook IMAP.
 
Of course roundcube is slow always. Its probably poorly written.
 
I wasn't aware of that. I thought the performance issues had been taken care of with it.
 
I dunno about that.... takes about 45-60 secs to login for me vs squirrelmail and atmail being almost instant.

Something has to be wrong with roundcube in my opinion.
 
I guess I should have said, before these little problems, I thought roundcube had been fixed. We're definitely switching to squirrelmail indefinitely, at least until a better alternative comes along.
 
Back
Top