Zimbra ClamAV CPU Spikes: When to Tune, Repair, or Wait

If clamd or freshclam suddenly tops your Zimbra server's CPU chart, first determine whether the load is a short signature-update spike or sustained email scanning. For a brief spike with normal mail delivery, monitoring is safer than disabling protection; for persistent load, check the logs and available memory before tuning scanning concurrency or repairing the virus database.

Find out which process is busy and why

clamd is the long-running antivirus scanner; freshclam downloads and checks signature updates. A database refresh can make both processes busy: FreshClam may test a downloaded database, and ClamD may reload it into memory. ClamAV documents that concurrent database reloads can temporarily require roughly twice the daemon's usual database memory. CPU percentage alone therefore does not prove that scanning is broken.

Connect by SSH to the affected mail transfer agent (MTA) host. As an administrator, examine the process list and basic resource pressure:

ps -eo pid,user,comm,%cpu,%mem --sort=-%cpu | head -n 15
free -h
vmstat 1 5

Observe several samples rather than reacting to one snapshot. If the same daemon remains busy while free memory falls, swap activity rises, or messages wait longer in the queue, investigate further. On a multi-server installation, check the MTA where antivirus processing actually runs rather than assuming the mailbox node is responsible.

Linux top terminal lists clamd and freshclam separately with CPU and memory columns on a Zimbra host.
A process list helps distinguish CPU used by the ClamAV scanning daemon from CPU used by its signature updater; the displayed values are an example, not a benchmark.

Match the CPU spike to log events

Zimbra identifies /opt/zimbra/log/clamd.log and /opt/zimbra/log/freshclam.log as the relevant antivirus logs. Check them at the timestamp of the spike, then compare mail transport messages in /var/log/zimbra.log:

tail -n 80 /opt/zimbra/log/clamd.log
tail -n 80 /opt/zimbra/log/freshclam.log
tail -n 80 /var/log/zimbra.log

Look for database reloads, update retries, checksum or malformed-database errors, and antivirus service failures. Repeated downloads are different from a single successful update. ClamAV notes that a failed incremental update may legitimately fall back to downloading the full database, so one such message is not, by itself, a reason to delete signatures. See the official FreshClam troubleshooting guidance and Zimbra's log reference.

Two terminal windows display sample entries from Zimbra clamd.log and freshclam.log files.
Review clamd.log for scanning and database-load events and freshclam.log for update activity before deciding whether the spike indicates a fault.

Compare the fixes before changing production mail filtering

Observed conditionPreferred responseTrade-off
Short spike near a successful database update; mail is flowingLeave scanning enabled and monitor the next update cycleNo security reduction, but brief peaks may recur
Sustained scanner load on a resource-constrained MTAEvaluate lower Amavis/ClamAV concurrency on that serverLower peak parallel work, potentially slower mail throughput
Repeated FreshClam network errors or failed signature checksRepair DNS, connectivity, permissions, or database state according to the logTargets the cause, but some repairs need a maintenance window
Continued CPU saturation and growing mail queue under legitimate trafficIncrease capacity or distribute MTA workloadPreserves scanning throughput but adds operational cost

Stopping antivirus can immediately reduce its CPU use, but it also removes an important layer of malware inspection. It is not an equivalent performance optimization. Zimbra's antivirus incident guidance explicitly warns against disabling protection as a workaround.

For sustained ClamD load, tune concurrency cautiously

Zimbra documents zimbraAmavisMaxServers and zimbraClamAVMaxThreads for ZCS 8.5 and later. Amavis submits mail for filtering; ClamAV provides scanning threads. Zimbra recommends matching the two values or permitting more ClamAV threads than Amavis workers. The values are not universal CPU limits, and their effect depends on current traffic, hardware, and the installed release.

Become the Zimbra service account and record the current settings on the affected MTA:

su - zimbra
zmcontrol -v
zmprov gs "$(zmhostname)" zimbraAmavisMaxServers zimbraClamAVMaxThreads

If measured traffic and a maintenance plan justify reducing concurrency, a conditional example is six matched workers on that individual MTA:

zmprov ms "$(zmhostname)" zimbraAmavisMaxServers 6 zimbraClamAVMaxThreads 6

Six is an example, not a recommended default. Compare against the original settings and lower values only when existing parallelism is excessive for the host. Apply or reload settings using the service procedures supported by your exact Zimbra release, and confirm the active configuration afterward. Revert the recorded values if the mail queue grows or delivery latency increases. Do not edit generated clamd.conf or Amavis configuration as a first resort: Zimbra may regenerate such files. The original settings and relationship between the two attributes are documented in Zimbra's MTA feature notes.

Linux htop screen with ClamAV scanning and updating processes sorted by CPU usage.
A process monitor makes sustained CPU use visible, but the correct response also depends on swap activity, mail delays, and the timing of definition reloads.

For FreshClam loops or broken databases, repair the cause

If the spike coincides with every signature check, investigate the update error instead of blindly making checks less frequent. Confirm working DNS resolution, outbound HTTPS access, disk space, and permissions to Zimbra's signature directory. For example:

host -t txt current.cvd.clamav.net
df -h /opt/zimbra

ClamAV's FreshClam FAQ covers DNS failures, outdated engines, HTTP rate limits, and failed downloads. An “OUTDATED” engine warning is not proof that the signatures are corrupt. Zimbra's antivirus reference has historically documented a two-hour definition-check interval; don't assume changing that schedule will fix a reload problem, and don't force rapid checks that may trigger rate limiting.

Only if the logs explicitly report malformed or checksum-invalid databases, plan a signature-database rebuild using Zimbra's database reset procedure. Back up the existing signatures, stop the relevant services, verify the updater executable path for your Zimbra release, and restore updates before returning the MTA to normal service. The referenced article includes version-dependent command paths; copying commands from an older release into a newer installation can make matters worse. Never erase the signature directory just because CPU usage is high.

When the logs show ordinary successful updates but memory pressure or swap coincides with database reload, capacity is usually a more appropriate lever. ClamAV documents that disabling concurrent reload can reduce peak memory but blocks new scans during a reload, while skipping FreshClam database testing risks accepting broken updates. Those standalone ClamAV settings may not be supported or persistent inside Zimbra-managed configurations; evaluate them only with vendor support and a recovery plan. See ClamAV's explanation of reload memory trade-offs.

Verify CPU, protection, and mail flow

After monitoring or applying the selected fix, validate more than a lower CPU reading. As the zimbra user, check the service status, then review fresh log entries and compare process load over another typical mail period:

zmcontrol status
zmclamdctl status
tail -n 30 /opt/zimbra/log/clamd.log
tail -n 30 /opt/zimbra/log/freshclam.log

Confirm that antivirus remains running, signatures update without repeated errors, and legitimate test mail passes through the usual delivery path. Compare mail queue depth and delivery delay with the baseline; a quieter CPU at the cost of a growing queue is not a successful optimization. If high load persists, gather timed process samples, the relevant log excerpts, Zimbra release details, and memory metrics before escalating to your Zimbra support channel.

Terminal examples show Zimbra service status, clamd daemon status, and a process listing.
After a change, verify that antivirus services are running and that scan and update processes remain healthy; the displayed command outputs are examples.

Leave a Comment

How to