Author Topic: Problems: sorting and slow performance  (Read 5186 times)

Offline javiaw

  • Newbie
  • *
  • Posts: 7
Problems: sorting and slow performance
« on: July 10, 2008, 06:16:10 AM »
Hi,

   I've had some problems when an account has a huge amount of emails, I use IMAP server (courier) and RC 0.1.1 . I've been reading the forum looking for solutions and the changes I've applied work sometimes fine, but not perfectly:

- First I set the DISABLE_THREAD_SORT as true in the imap configuration, because the sorting was being made by the server, and it took too long to read  every message in a folder. It seemed to improve the RC load, but the server's load increased excessively (don't know why) and sometimes the sorting didn't work.

- Maybe the problem was that RC didn't know that server wasn't sorting, so I removed the option SORT from the IMAP capabilities (setting DISABLE_THREAD_SORT as false to avoid overload). Then the load was really quick and server didn't overload, but as it happened before, sorting didn't work in some cases.

- Then I remembered I had disabled the $rcmail_config['enable_caching'] option in config/main.inc.php. I thought enabling it again could solve the sorting problem, but I was wrong, the only that happens is that the cache table in the RC database is filled (as it's supposed to do)

- In the accounts where the sort doesn't work, their files were migrated, so there was a change in the date and time information (of the files) and I guess that's the problem.

   Maybe sort functionality is not supported (or not in all cases), checking the alpha version I realized that is possible to sort by different fields but doesn't work properly. I wonder if the RC team is aware of these problems and if they are improving it.

I hope this information will be useful.
Thanks,
    Javi

Offline tjm74

  • Jr. Member
  • **
  • Posts: 10
hack-solution
« Reply #1 on: August 07, 2008, 02:52:00 PM »
I can't turn off threadsort or stop advertising sort in my IMAP server since I have other IMAP clients that depend on this.

Instead, I headed into program/lib/imap.inc
on line 849 (or thereabouts, in function iil_C_Sort)

and changed this line
Code: [Select]
       $command  = 's ' . $is_uid . 'SORT (' . $field . ') ';

to this:
Code: [Select]
       if ($field == 'DATE' [B]&& !$add[/B]) {
            /* courier sends back headers sorted by date already - but if you ask it to sort by date it gets sloooow */
            $command  = 's ' . $is_uid;
        } else {
            $command  = 's ' . $is_uid . 'SORT (' . $field . ') ';
        }


(new version 3/6/2009 restores filtering functionality in 0.2-stable)

So now if the default sort-by-date is requested, the SORT command isn't passed to courier at all.  Suddenly my RoundCube is blazing fast (unless I sort by something else, like size... but that I can live with).

If any developers are reading this thread, it would be nice to add a config option for this.
 -tom
« Last Edit: March 06, 2009, 02:15:05 PM by tjm74 »

Offline javiaw

  • Newbie
  • *
  • Posts: 7
Good hack
« Reply #2 on: August 26, 2008, 10:13:28 AM »
Nice hack tom ;) it works pretty fine.
I support your suggestion to add a configuration option.

Offline kuzb

  • Newbie
  • *
  • Posts: 1
Works well
« Reply #3 on: September 11, 2008, 05:19:21 PM »
We too were having excessive speed problems - most noticeable for people with very large inboxes.  Using this has sped up the initial load time of roundcube substantially.

Our admins are currently looking in to the SORT command issue here to see if there is a better way to make the request to the IMAP server.  Will post back if we find anything.

Offline tjm74

  • Jr. Member
  • **
  • Posts: 10
switch to dovecot
« Reply #4 on: March 06, 2009, 02:47:14 PM »
I have since switched to dovecot. I was fed up with slow search performance from courier.

The transition was surprisingly painless. I strongly recommend it to anyone that is still using courier imap.

To really take advantage of dovecot's auto-indexing, I am on the lookout for a good advanced search plugin for rc.