Relation between max_servers and ncpu

Patrick Domack patrickdk at
Mon Feb 27 01:44:39 CET 2012

Quoting Mark Martinec <Mark.Martinec+amavis at>:

> Henrik K wrote:
>> Look, I have max_servers=20 on an ancient 4x1Ghz SPARC with no problems.
>> One amavisd process cannot take 100% cpu for all the 3 seconds. Most of
>> that time is waiting for DNS lookups.
>> Just put something like 20-30 depending on how you want to prioritize other
>> services and mail flow.
>> If you put too many, the worst case scenario is that some processes get
>> marginally slower (but total throughput will be great).  You need to
>> experiment.
> I agree with Henrik. For a reasonably modern hardware with sufficient memory
> and a sizable mail traffic the max_servers=6 is too low.  The 20-30 is about
> right, and even 50 may be acceptable if need be.
> There are plenty of latencies during processing of a mail message, especially
> if spam scanning is enabled. These idle times can be put to good use when
> running multiple child processes.
> Keep an eye on the RSS usage (real memory) used by amavisd processes,
> these should not come too close to available RAM size. Also see CPU idle
> time: when CPU usage approaches 90 or 100% on the average, adding
> more child processes brings no advantage, just wastes memory.
> In other words: if mail processing is falling behind the traffic rate
> and CPU utilization is not close to max and memory permits, increase
> the $max_servers and a corresponding MTA stting.
> If amavisd-nanny shows that amavisd processes are frequently idling,
> or if CPU usage is close to 100% for long periods, or if memory is
> tight, decrease $max_servers setting.

Pretty much same results here. I found about 30 is good for me, with 6  
cores and 6gigs ram. Increasing to even 60 works well, but needs more  

At 30, I rarely ever get more than 3-4 cores used.

More information about the amavis-users mailing list