Larry Greenfield writes:
>
>   Date: Sun, 30 Sep 2001 20:12:01 -0500 (CDT)
>   From: [EMAIL PROTECTED]
>
>    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.

Thanks for the suggestion.  I found the problem.  I'm using the
Net::IMAP library, from NetxAP-0.02.  It turned out to be a pathological
case.  It was doing every write in two pieces with syswrite(), first
the string, and next the "\r\n".  I've modified it to do both of them
together.  This reduced the write/read delays from about 0.11 seconds
down to about 0.02 seconds, a huge improvement.  I'll send patches
to the author once I've got the whole thing working.


-- 
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-

Reply via email to