[Dovecot] [Patch] Fix delay on imao-append
Dovecot version: 1.1-rc8, 1.1-rc9 System: Linux-2.6.2x User-Agent: claws-mail-3.3 and 3.4
When appending messages (e.g. copy from mailclient local folder or second server to dovecot imap folder) dovecot answers with: <tag> OK [APPENDUID <n> <m>] Append completed\r\n
This answer often reaches the client as two or more TCP packets, the client (when not using TCP_NODELAY on its socket) ACKs with some delay.
When copying lots of (small) messages this delay has a very negative impact on copy time even though there are lots of network and system resources available.
Sample sniffer output on client host: ... 1 0.0000 claws dovecot IMAP Request: 14639 APPEND "Test" (\Seen) {853} 2 0.0033 dovecot claws IMAP Response: +OK 3 0.0034 claws dovecot IMAP Request: <message> 4 0.0096 dovecot claws IMAP Response: 14639 5 0.0467 claws dovecot TCP 33453 > imap [ACK] 6 0.0481 dovecot claws IMAP Response: OK [APPENDUID 1204729411 2] Append Completed. 7 0.0481 claws dovecot TCP 33453 > imap [ACK] ...
The delay of about 35ms between packet 4 and its ACK in packet 5 causes copies from client to server to be extremely slow. (Client and server on same 100Mb LAN, same result if client and server are on same host)
The attached patch makes dovecot send the whole answer in a single packet, thus not triggering the delay issue.
As far as I found out the delay is generated by Naggle algorithm, this algorithm being used by Linux TCP stack for small packets with the aim of improving payload/overhead share.
Bruno Prémont RESTENA Foundation
On Fri, 2008-06-13 at 11:04 +0200, Bruno Prémont wrote:
The attached patch makes dovecot send the whole answer in a single packet, thus not triggering the delay issue.
Although the patch works for this APPEND case, it probably adds delays when other commands are pipelined, because tagged replies can be sent in the middle of processing multiple commands.
Could you try if the attached patch fixes this also?
On Fri, 13 Jun 2008 Timo Sirainen <tss@iki.fi> wrote:
On Fri, 2008-06-13 at 11:04 +0200, Bruno Prémont wrote:
The attached patch makes dovecot send the whole answer in a single packet, thus not triggering the delay issue.
Although the patch works for this APPEND case, it probably adds delays when other commands are pipelined, because tagged replies can be sent in the middle of processing multiple commands.
Could you try if the attached patch fixes this also?
This patch works for me, it also avoids the delay seen on a different install which produces EXISTS and RECENT messages:
n EXISTS\r\n
n RECENT\r\n <tag> OK [APPENDUID m n] Append completed.\r\n
Here EXISTS was sent in a separate packet, waiting for ACK then finally sending RECENT and end tag in a second packet.
Bruno Prémont RESTENA Foundation
participants (2)
-
Bruno Prémont
-
Timo Sirainen