How can we help?

Watch this space: Upcoming Help Centre Migration


Performance Improvements

Stewart -

A myriad of options exist to further improve the performance of Atmail. While the base software is fully capable, customization options exist for the technically able - allowing you to maximize the performance of your Atmail installation.


  • On-Premise Server + WebMail Installations: Version 6.0 > Current Version
  • Webmail Only Installations: Version 6.0 > Current Version


  • Higher performance required


Core improvements

These improvements can be made to the core Atmail software.

Setting the maximum RAM usage

Open up '''/usr/local/atmail/webmail/bootloader.php''' . You can find this line:

ini_set('memory_limit', -1);

Change this to:

ini_set('memory_limit', 256M);

This will limit memory usage to 256M.

Basic Apache tuning

By default Apache ships with minimal tuning, especially for modern-day systems with sufficient RAM and CPU resources.

Firstly, enable KeepAlive, which allows persistent connections (more than one request per connection via HTTP) which will vastly improve Webmail performance.

KeepAlive On

Next, tune the default number of Apache processes and threads that start, if your system has over 4-8GB RAM specify 16 StartServers and MinSpareServers at 12. This will improve Webmail, ActiveSync and CalDAV/CardDAV transactions to the Atmail server.

<IfModule prefork.c>
StartServers       16
MinSpareServers    12
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
<IfModule worker.c>
StartServers         8
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0

Installing Memcache

Memcache is a free & open source, high-performance, distributed memory object caching system. By default Atmail uses the filesystem to store temporary files for mail indexes, messages, calendar requests, temporary files and more. Memcache support can replace the default filesystem cache and speedup Atmail dramatically for a large userbase system.

How to install Memcache for CentOS 6.X, note you must restart Apache after installing memcache and the php module.

yum install memcached memcached-devel php-pecl-memcache;
chkconfig memcached on;
service memcached start;
apachectl restart;

Once installed edit the  /etc/sysconfig/memcached file. We recommend 512MB of cache for systems with 4GB of RAM, or between 1-4GB for systems with 16GB RAM.

Note you must specify the options tag below, to prevent memcache from been accessible on the LAN/WAN for security, localhost access is only required. Once the config file has been written, restart memcached for changes to take effect.


Next visit the Atmail Webadmin > Config > Webmail settings and turn on memcache support

Once enabled, save settings.The last step is to monitor and confirm memcache is correctly running. Execute the following:

watch "echo stats | nc 11211"

During the monitoring login to the Atmail Webmail UI, or use an external CalDAV/CardDAV or ActiveSync client. You will see instant activity to memcache for all cache hits to core Atmail services.

Setting time limits

Time limits can be imposed that should prevent stale processes from taking too much time. Find this line in your webmail/bootloader.php:


Change this to:


Disabling automatic tmp folder deletion

You can disable automatic tmp folder deletion, which is recursive and may take up too much time. Open up '''application/modules/mail/controllers/AuthController.php''' , and do the following:


        $usersTmpFolder = users::getTmpFolder();

Change to:

        $usersTmpFolder = users::getTmpFolder();


if( is_dir($dir . DIRECTORY_SEPARATOR . $dirItem) )

Change to:

if( is_dir($dir . DIRECTORY_SEPARATOR . $dirItem) )

You can then set the tmp folder deletion to occur daily. Create a file called '''''' in '''/etc/cron.daily'''. In the file, put:

find /usr/local/atmail/webmail/tmp -type f | xargs rm

Afterwards, execute the following in the command line:

chmod 755 /etc/cron.daily/

This will manually delete the contents of the tmp directory.

System improvements

Improvements can be made to the services running parallel to Atmail. These small changes can greatly boost server performance, and are highly recommended.

mod_expires and mod_gzip

With Apache, you can use the mod_expires and mod_deflate modules to gain a performance boost.  The mod_expires module provides caching, while the mod_deflate module compresses downloadable items to decrease bandwidth usage.

Implementation instructions can be found here: Apache mod_deflate and mod_expires **need to locate this info

Multi-server setups

In the case of large bases of users 30,000 and more, you may want to consider multi-server implementations. These can help spread the load, and provide your users with greater stability and response times.

We have documentation that can help you set up your own redundant multiserver installations. Details can be found here Atmail MultiServer Setup Guide

Third-party improvements

Third party software can be used to further accelerate your Atmail service. The following are some of the many improvements you can run alongside your Atmail software.


APC (Alternative PHP Cache) is an opcode cache for PHP that increases the performance of Atmail by caching and pre-loading PHP within Apache. It is easy to install, and recommended for all Atmail deployments.

Below is a quick tutorial on installing APC under CentOS 6.x

First, install APC from the yum repository

# yum install php-pecl-apc

Once installed tweak the default config file /etc/php.d/apc.ini and change the following defaults


Next, restart Apache and you will notice considerable performance improvements while using Atmail. APC will cache a copy of the PHP opcodes in memory and reduce the need to recompile the application for each hit.


Varnish is a state-of-the-art, high-performance HTTP accelerator, used by sites such as Facebook and Twitter. With Varnish, you can vastly decrease the load used by Apache on your server.

Implementation instructions can be found here: Apache and Varnish


eAccelerator is a free open-source PHP accelerator and optimizer, an alternative to APC. It optimizes scripts to speed up their execution, typically reducing server load and increasing the speed of your PHP.

Implementation instructions can be found here: Speed up Atmail with eAccelerator

MySQL InnoDB improvements

Out of the box, MySQL has very limited memory allocation for cache use. If you are using Atmail with MySQL in production, it is imperative you review and optimize MySQL for your hardware and memory. You can increase performance dramatically and reduce I/O usage by tweaking MySQL to use more of your system memory for the cache and buffers.

Implementation instructions can be found here: Importance of tuning MySQL


Contact our support team

+61 (7) 5357 6605