Zimbra on Minimal Hardware

      by Wyatt Walter

I really like Zimbra, but it tends to use a ridiculous amount of CPU while just sitting there, which makes it a bad choice for someone like me who wants to run it with a few users at home as a virtual machine. As I stated growing the amount of virtual machines on my physical host at home, things started to get a little cramped. Zimbra just plain uses far more CPU “out of the box” than the other virtual machines (I’ve got enough RAM) and it was starting to become my bottleneck.

After installing Zimbra and just leaving it running, it used the better part of a processor core most of the time. That’s not good if you’ve got a limited amount of hardware like I do. However, it wasn’t too difficult of a process to get my Zimbra server to use almost no CPU most of the time. As a great side-effect to this project, I will be trying to bump down the amount of memory allocated to my Zimbra VM, but that wasn’t the highest priority. I am running on the latest version of Zimbra (6.0.6 at the time of writing), but the tricks should apply to almost any version.

First, I started with disabling services that I really wasn’t using. I’m not monitoring my Zimbra server using snmp, so snmp was a pretty easy one. My server isn’t for an IT department or hosting service, so stats and logging history isn’t overly important, so I also chose to disable logger and stats. To disable those, run:
zmprov ms mail.whatan00b.com -zimbraServiceEnabled snmp
zmprov ms mail.whatan00b.com -zimbraServiceEnabled logger
zmprov ms mail.whatan00b.com -zimbraServiceEnabled stats

Now, let’s do a restart:
zmcontrol stop; zmcontrol start
This really only gave me gains in memory usage, but since I didn’t need them turned on, that was ok. Another good candidate to disable would be antispam and antivirus, but I didn’t want to turn off spam filtering on my system.

After disabling those extra services, I still was having CPU spikes every minute (which ultimately was what I was after). After doing a little digging, it turns out that Zimbra was calling zmmtaconfigctl which makes several zmprov calls. If you have been around Zimbra for any amount of time, you know that zmprov calls are expensive and time-consuming. It turns out that this script just scans to updated config to apply to the MTA. I really can’t think of a reason that I would need this every minute. A quick Google search led to a forum post on how to increase the interval of which this script is called. It’s defined in zmlocalconfig and 60 seconds is assumed if the value is not set. I chose to have it run every 2 hours (a fairly arbitrary decision):
zmlocalconfig -e zmmtaconfig_interval=7200
zmmtactl restart

That got my spikes down quite a bit, but I was still getting spikes of nearly around 20% every couple of minutes or so. While this wasn’t all that detrimental, it would be good for my overall CPU usage to get rid of it. A quick look at the crontab for the zimbra user showed that the script /opt/zimbra/libexec/zmstatuslog. Apparently, this script checks the status of the Zimbra server and displays the status in the Admin Console. Since I rarely ever log into the admin console, I really don’t need this to run very often. While there’s really no use for me to have it running every two minutes, I did leave it set to run every hour:
0 * * * * /opt/zimbra/libexec/zmstatuslog
Now it’s time to look at the good we’ve done.

This is what we started with:

Obviously, quite a bit of CPU usage. You can see why I needed to do something to fit more VMs on this host.

And now:

Looks great now!

There are a few extra cron jobs left in the zimbra user’s crontab that really don’t need to run for me such as the Dspam cron jobs, but those only run once a day. If you’re really zealous, you can disable those as well, assuming you have Dspam disabled (the default).

Update: For anyone who is interested, I did the 6.0.6 -> 6.0.7 upgrade a few weekends ago and had my cron jobs reset. All the other changes stuck.

Tags:
Filed under How-Tos / Tips : Comments (15) : Apr 10th, 2010

  • Graham

    Thanks, what a great tip!! I had exactly the same graph as you posted , every 2 mins it would use almost all the cpu power available and was always anoying how many resources Zimbra uses compared to every other vm I run, but I done what you have posted and it so muich better! Well done Wyatt, great tip!

  • Troy L

    Hi Wyatt,

    Thanks, my CPU usage has noticeably dropped since trying this on my virtual machine.

    Great write up !

    Thanks again

    TL

    ps – Hopefully you have been able to catch some Twins games, we are having a killer year!

  • http://www.megamon.com The Wookie

    This exact thing happened to me … how does my little mail server use more resources than every other VM combined.

    You would think now that Zimbra is owned by VMware a few questions like “are you running this on a VM?” would lead to the disabling of the zmstatuslog cron.

    Good post.

    • http://whatan00b.com Wyatt Walter

      Thanks for the feedback.

      That’s true, but the problem isn’t necessarily specific to virtual machines. It would be nice if they just turned it down on all installs ;)

  • Eric

    Finally, after months of off and on searches for a resolution (I’m a fairly adept Google user), one article quickly resolves my problems. Now I can leave the damn thing running all the time. Good write up, thanks for pwning this one for me.

  • Ed

    Great article. After following your article I dropped the load on my box noticeably.

    Thanks!

  • http://www.sirtech.com.au James Pearce

    Wyatt,

    What hardware is the host machine? My E6750 spikes to about 35%. Yours appears to spike at about 20%. Obviously without knowing what other guests / processes are running on your machine, knowing the CPU is a fairly inaccurate yardstick, but still I’m curious nonetheless.

  • http://whatan00b.com Wyatt Walter

    Hi James,

    The machine has a Xeon E3110. I gave it access to on of the cores. There’s not a lot of other things happening on this machine to compete with, so that could also affect it.

  • Pingback: Ldap won't start after installing Preexisting Certifcate - Zimbra :: Forums

  • Nick

    Can someone explain what the zmconfigd service is? This is something new that shows when doing a status down at command line in version 7. Just wondering if this would also need to be disabled as with the other services above in version 7. With a D at the end of the service name it sounds like another cron job that runs, so I wanted to know if it was worth disabling.

    • http://whatan00b.com Wyatt Walter

      Hi Nick,

      Good catch on zmconfigd.. I just did the upgrade last night and didn’t even notice that. I took a look at my box and can’t really tell exactly what it’s being used for or if it’s necessary. I also can’t find anything in the wiki or forums. Will have to do some more digging!

  • Nick

    Yeah I’ve tried digging but not coming up with anything…literally. I’ve started a discussion under the “Installation” section of the Zimbra forums, so I’ll see if any developers will post or someone that has been working with Zimbra for a while. I do IT for a small public library (and may install this at other locations) and run this in a virt so these tips have come in great use for something that no one but me would look at and I can still access the logs the good ol’ fashioned way which is what I prefer anyways. :) I’ve only been using Zimbra for about 6 months now and hope to migrate other small libraries over looking for a nice option for email services.

    • http://whatan00b.com Wyatt Walter

      Cool, I found your post and subscribed. Hoepfully we find something.. I did find a few bugs related to it on pm.zimbra.com, but mostly just reports of it crashing.

  • Nick

    Wyatt,
    Are you by chance having issues with flushing the themes since you upgraded? See forums posts below. Since I’ve upgraded I’m seeing this and I’ve attempted the various ways to flush the themes but a no go.

    http://www.zimbra.com/forums/administrators/45983-adding-new-theme-problem.html#post209054

    • http://whatan00b.com Wyatt Walter

      I guess I haven’t had a need to do that yet at all.. so I guess I can’t really say I’ve been having issues :)