From: Lawrence Greenfield (leg plus at andrew dot cmu dot edu)
Date: Mon Oct 01 2001 - 12:48:48 EDT
Date: Sun, 30 Sep 2001 20:12:01 -0500 (CDT)
From:
I'm testing a perl script that runs on a Solaris 8 mail server to read
Unix mailbox files and append the messages to Cyrus mailboxes. I need
to do this for 17000 mailboxes, and it's way too slow. The server is
pretty much idle. Neither the perl script nor the imapd process are
CPU or I/O bound. When I truss the two processes, both have long
delays were nothing is happening.
In the case of the perl script, there is about a tenth of a second
delay between the time it sends a command to the IMAP server and
gets a response back:
1.5735 write(6, " 1 1 7 a p p e n d u".., 39) = 39
1.5738 write(6, "\r\n", 2) = 2
1.6709 read(6, " + g o a h e a d\r\n", 8192) = 12
This is the classic Nagle-algorithm problem. Nagle's algorithm
attempts to coalesce short TCP packets into a single one by delaying
small writes for a short amount of time. It works well for telnet,
which sends out each keystroke as an individual packet.
If you change your script to write the \r\n at the same time as the
append you'll probably notice drastically better performance.
(Generally, you don't want to do a write unless you're about to read
OR you're writing a large amount of data.)
Larry
|
|
|