[RCD] performance tips

A.L.E.C alec at alec.pl
Mon Oct 12 19:58:45 CEST 2009

Hi! I've written a quick manual about Roundcube configuration and 
performance. You can extend this or comment it here. But it would be 
nice if someone will reformat this and add to our wiki.


There are many configuration options with inpact on performance
in Roundcube. As Roundcube installation administrator you can.
set them to some defaults and disable possibility of change by your 
users using 'dont_override' option.

Here's the list of options with impact on performance:

- 'index_sort', 'message_sort_col':
Messages listing is a main task of a mail client. Sorting is expensive.
First of all you should use IMAP server with SORT capability. If 
messages list displaying is still too slow you should set 
'message_sort_col' to 'date' and enable 'index_sort'.
The order (ASC/DESC) is not important.

'max_pagesize' (and 'pagesize')
To display messages subjects/senders/dates/etc Roundcube fetches the 
headers. So, to increase performance don't set 'pagesize' too high.

'min_keep_alive' ('keep_alive')
To keep session Roundcube is sending a request to server every 
'keep_alive' seconds. If you're already in mail task window Roundcube 
will also check for new mail using this interval. To decrease load don't 
set it too low.

This really slows things down. With 'skip_deleted' enabled Roundcube 
needs every time to check messages status, when displaying the list, 
counting messages, etc. E.g. to count all messages in a folder we must 
call SEARCH ALL UNDELETED instead of simple SELECT. The same with 
messages listing, SEARCH instead of faster SORT or even direct FETCH 

Roundcube searches for recent messages in INBOX. You can configure it to 
check all folders, but e.g. if you you have many folders, enable also 
'skip_deleted' and your IMAP server isn't using indexing this could be 
realy expensive operation.

Displaying a message in preview_pane is less expensive, because in "full 
window" mode Roundcube will need to update page controls and message 
counters on every page load (if it isn't already cached by browser).

With enabled caching Roundcube stores message counters, folders list and 
message headers in database. You should consider enabling this if access 
to your DB server is faster than access to IMAP. The caching is not 
always faster, also cache operations are expensive if mailbox cache is 
not complete (cache is "dirty").

If with enabled caching your database is growing too fast, you can lower
lifetime to not store old messages.

'imap_auth_type', 'smtp_auth_type'
If you know what type of authorization your servers are using, you can 
speed up connection process setting type directly. E.g. if 
'imap_auth_type' is set to 'check' (default) Roundcube will detect auth 
method, then will try to authorize using CRAM-MD5 if supported and 
finally using PLAIN. As you see, you can skip two steps if your server 
allows PLAIN login (for security you should do this only on the
same host or using secure connection).

If your server is heavy loaded you should probably disallow doing clean 
up on every logout.


- Disable SSL for IMAP/SMTP

If your SMTP/IMAP servers are on the same host or are connected with 
secure network, would be better to not use SSL connections.

- Disable TLS for SMTP connections (on the same host)

It is not possible in Roundcube to force plain connection with SMTP 
server. If server returns STARTTLS capability TLS connection will be 
established. If you're on the same host, disabling TLS is safe and will 
improve performance. In Postfix 2.2 or later you can do this with 

Add in /etc/postfix/main.cf file:
smtpd_discard_ehlo_keyword_address_maps = hash:/etc/postfix/discard_ehlo
and in /etc/postfix/discard_ehlo file: starttls,silent-discard

Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252
LAN Management System Developer http://lms.org.pl
Roundcube Webmail Developer http://roundcube.net
List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list