Tuning performance for Zarafa
-----------------------------------

When installing a Linux server with Zarafa, it is imperative that you
correctly configure MySQL to achieve maximum performance on your server;
almost all performance bottlenecks are within the database access itself, so
getting your SQL queries to run as quickly as possible is very important.

For large installations, it is also a good idea to tune Zarafa's cache
parameters as well; These are normally set quite low to make sure that
Zarafa can run on relatively low-end servers, but in anything but the
smallest installations, these defaults needs to be upped. Any installation
with 50 or more users should definitely tune the cache parameters for
maximum performance.

Memory usage
============

It is very difficult to predict what the optimal memory usage distribution
is for a given server, as data access patterns vary wildly from server to
server. There are basically 4 large parts of your server setup that use
server memory:

- Zarafa's sortkey cache (caches the sort keys for tables) 
- Zarafa's cell cache (caches individual cell data within a table view)
- MySQL's buffer size (caches reads and writes from the ibdata file)
- MySQL's query cache (caches exactly repeated SQL queries)

Zarafa's SortKey cache (cache_sortkey_size)
===========================================

The Zarafa sortkey cache is used to cache the sorting keys in tables. This
means that when you sort a table 'by date', the dates of the items in that
view can be retrieved from a cache, instead of from the SQL engine. This
makes loading table much quicker, as a normal table load requires the
reading of all 'sorted' columns, and for the other columns, only the rows
that are in the current view. As the sortkey cache doesn't use vast amounts
of memory, a setting of around 1MB per logged-on user should be fine.

Zarafa's Cell Cache (cache_cell_size)
=====================================

Data that is actually shown to the user in table views, passes through the
'cell cache'. This means that any view of a table in Outlook will only
retrieve the information from the database of the cells that are not already
in the cache. The cache lifetime is as long as the entire server lifetime,
so opening an inbox twice in succession should result in 0 disk accesses. It
is a good idea to set the cell cache as high as you can manage, usually
about the same size as the MySQL bufffer size.

MySQL innodb_buffer_size
========================

The MySQL buffer is used to cache reads and writes to the ibdata file. In a
dedicated MySQL machine, this would be anywhere between 50% to 80% of the
physical RAM size in your machine. When you are running MySQL on the same
machine as Zarafa, it is recommended to be around 25% of physical RAM size
(so that Zarafa's Cell Cache can also be set to this value)

MySQL query_cache
=================

The MySQL query cache is normally disabled. Enabling the query_cache can
cause a small performance increase, but increasing it to more than a few MB
of memory isn't any use, as most recurring SQL queries are rather small.
