October 31, 2020

203 words 1 min read

Optimizing Zimbra Server Cpu Wait Time

CPU stat illustration CPU stat illustration

Yesterday, I was complained about our mail server’s performance.

At first, I checked the disk space and everything’s OK. From server statistics, I found that the processed messages (sending and receiving) was about a hundred per minute.

Then I checked the load of the server using top command, and the result showed that the CPU wa percentage was quite high, about 30 to 60 %.

Based on some references on the internet, it mainly was caused by amavisd service which is doing read and write operation  from and to disk. It’s better to change the location of amavisd temporary folder (/opt/zimbra/data/amavisd/tmp) to RAM disk.

Then I did these steps:

  1. zmcontrol stop as zimbra user
  2. Add the following line to /etc/fstab:

/dev/shm /opt/zimbra/data/amavisd/tmp tmpfs defaults,size=200m,mode=700,uid=2003,gid=2000 0 0

Explanation:

/dev/shm : the RAM disk device

/opt/zimbra/data/amavisd/tmp : the mount point (amavisd temporary folder)

size=200m : folder size

mode=700 : only zimbra user can do read, write, and execute

uid=2003,gid=2000 : UID and GID of amavis (usually same to zimbra user)

After restarting the server and starting the zimbra services (zmcontrol start) I found that the CPU wait time  now is about 5 to 20% and the performance seems better and faster :)

comments powered by Disqus