Tmpfs for amavisd-new
Tmpfs for amavisd-new
It is highly advised to see http://wiki.zimbra.com/wiki/SpamAssassin_Customizations#2._Put_Amavis.27s_Temp_Dir_on_a_RAM_Disk This wiki is outdated. This document gathers steps required to configure amavisd to use a ramdisk for its temporary data processing. The steps are specific to RHEL servers running Zimbra 6.x or higher.
Amavisd-new's speed may be limited by the speed and latency of your disk I/O, which can causes huge active mail queue, with a very limited delivery rate. Moving amavisd tmp directory to ramdisk will eliminate disk read/write operations. It can make a lot of difference in amavisd mail processing speed.
1. You need a kernel that is capable of creating and using a tmpfs filesystem
2. Zimbra 6.x or higher installed on the server.
Warning: Following is just an example. Actual sizing for tmpfs vary on several factors like number of compressed attachments, number and size of attachments etc. You need contact zimbra PS for optimal sizing suggestions based upon your environment.
If you run n amavisd-new instances and each one accepts mails of the size defined in zimbraMtaMaxMessageSize, then the tmpfs of size will be:
n * (1 + max(expansionfactor)) * $zimbraMtaMaxMessageSize
n = "max_servers" option configured in /opt/zimbra/conf/amavisd.conf file. By default it set to 10.
zimbraMtaMaxMessageSize = It is a global config option in zimbra. It sets value for postconf message_size_limit. By default it is set to "10240000".
So for a default zimbra install, tmpfs size will be:
10 instances * 10MB (zimbraMtaMaxMessageSize) = 100 MB
The unpacked mail: 10*10 MB raw mail size become about 10*8 MB binary size, unpack at ratio 1:2, become 160 MB
Hence the size will be 100 + 160 = 260 MB
1. Create a tmpfs entry in /etc/fstab
/dev/shm /opt/zimbra/data/amavisd/tmp tmpfs defaults,noexec,nodev,nosuid,size=150m,mode=750,uid=502,gid=503 0 0
uid and gid will be zimbra user's gid/uid. Check for it in /etc/passwd
2. Stop zmamavisdctl.
3. Mount the ramdisk.
4. Start zmamavisdctl.
Check using "mount" command if the ramdisk is mounted at /opt/zimbra/data/amavisd/tmp. You can also check for logs in /var/log/zimbra.log if there are any errors.