On Fri, 28 Dec 2012 21:48:25 -0800 (PST)
Sean Tout wrote:

> Hi Martin,
> 
> You certainly did not miss anything....but I did! Being new to
> spamassassin, I was only familiar with spamassassin command. which
> was awfully slow for a large number of emails. But now that I used
> spamc, I'm getting 5+ messages per second.
> 
> Thank you much for the advise. I have practically given up on the
> original perl code since I'm unable to find out the issue. With
> spamc, I can get a decent performance.
> 


Using spamc avoids repeated initialisation, but if I want it to be
really fast I do it something like this:


   for m in /home/sean/code/spam/spfiles/*
   do
      spamc <$m  ... &
      [ "$(( n=(n+1) % 20 ))" -eq 0 ] && spamc -K >/dev/null
   done

It puts spamc processes into the background in parallel. Occasionally
running spamc -K in the foreground prevents unnecessary timeouts by
limiting the number of spamc process waiting to be assigned to a spamd
child process.

At very least there's a speed-up from using all cpu cores, but with slow
or unreliable network tests the speed-up can be enormous. You need to
set --max-children in spamd appropriately.

Reply via email to