#1486126 closed Bugs (duplicate)
slow SORT command (25sec+) with Courier (remote server), also on startup
| Reported by: | vonsachermasoch | Owned by: | |
|---|---|---|---|
| Priority: | 3 | Milestone: | 0.3.1 |
| Component: | IMAP connection | Version: | 0.3-stable |
| Severity: | major | Keywords: | imap speed sort courier |
| Cc: |
Description
upon logging in, RC seems to automatically request a SORT to the remote server, in my case running some old version of Courier on a remote machine.
this slows down the login process and it takes about 20 - 30 secs to enter in a mailbox with approx 1500 msgs, just fetching the first 40 msgs.
relevant log lines follow:
[14-Sep-2009 17:17:53 +0200]: C: s SORT (DATE) US-ASCII ALL
[14-Sep-2009 17:18:22 +0200]: S: * SORT 1 2 3 [etc, to 1000+]
[14-Sep-2009 17:18:22 +0200]: S: s OK SORT done.
[14-Sep-2009 17:18:22 +0200]: C: FH12 FETCH 1105,1106,1107,1108,1109,1110,1111,1
112,1113,1114,1115,1116,1117,1118,1120,1119,1121,1122,1123,1124,1125,1126,1127,1
128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1
144 (UID RFC822.SIZE FLAGS INTERNALDATE BODY.PEEK[HEADER.FIELDS (DATE FROM TO SU
BJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE
-ID REFERENCES DISPOSITION-NOTIFICATION-TO X-PRIORITY)])
[the rest of the server-side process is immediate]
since I assume the Courier IMAP server already replies date sorted list of messages by default, why not directly fetch just the first X (40?) msgs upon startup (if date-sort is the default and initial sorting method requested)? and just use SORT in case the user requires it from the UI?
cannot reproduce problem/bug with thunderbird, outlook or other IMAP client.
thank you for your attention.
Change History (5)
comment:1 Changed 4 years ago by alec
- Resolution set to duplicate
- Status changed from new to closed
comment:2 Changed 4 years ago by vonsachermasoch
I thank the dev team for the immediate and appreciated reply.
By the way, the question is that different webmail (such as the ol' good Squirrel and the like) do handle pretty well this issue, resulting in an almost immediate access to the mailbox.
I was wondering why can't our beloved RC benefit from the same performances.
Thank you very much for the attention
comment:3 Changed 4 years ago by roederja
This needs to be changed, with the Microsoft IMAP server and 3500 e-mails logging in takes several minutes which is completely unacceptable.
comment:4 Changed 4 years ago by vonsachermasoch
By the way, I tried to solve the problem or, well, at least to enhance performance.
In realized that the remote Courier server I am forced to use (I have no control therein, third party service) I considerably faster if asked to sort by ARRIVAL rather than by DATE.
In most scenarios, ARRIVAL and DATE sorting should coincide or, at least, not create significant discrepancies.
I therefore slightly amended line 870 in program/libs/imap.inc (iil_C_Sort method) as follows:
if ($field == 'INTERNALDATE' || $field == 'DATE') {
$field = 'ARRIVAL';
}
I know. Horrible hack. Anyway, it works for me pretty well.
At least know the all thing is usable.
hope this may help someone.
Thanks for your attention.
comment:5 Changed 3 months ago by larrymcp
vonsachermasoch: Thank you so much for posting this.
Your "horrible hack" has saved the day here: we were seeing very slow performance when sorting by date. (We use hMailServer, which like Courier is much faster when sorting by ARRIVAL rather than DATE.)
I applied the same patch to our own Roundcube installation, and now all is well.
For the benefit of others: in the current version of Roundcube, the code in question now resides in the following file:
program/include/rcube_imap_generic.php

Messages in mailbox aren't sorted by date, but by message index, so only solution to speed up this is changing IMAP server (to e.g. dovecot) or wait until we implement sorting by message iondex. See #1485936