Tuesday, March 6, 2012

MailScanner Tweakings

MailScanner is a good tool, which integrates antivirus, spam control with SMTP servers,

The workflow is simple mails received will go to hold state, then Mailscanner scans through them in batch mode, and re-Que it for delivery, if everything is OK. If spam is observed suitable defined action will be taken.

This was working quite fine without any problem, but one day it is observed that we had a big que pending, and Mailscanner was taking more than 30 minutes to scan a batch of 30 mails. It is a kind of serious issue, because users started complaining that they have sent the mail, but the addressee has not received them yet. (Unfortunately no one remembers the old snail mail working days, or even the days when trunk call was taking more than couple of hours to get connected.)

We had no option but to wait till the Mailscanner runs through all that big que, so that mails will get delivered.

So I was just wondering about someways to speed up the Mailscanner, which starts from investigation on finding out what might be the things that takes up longer time. It could be I/O speed of disk, as mails are written twice into disk, big mail size as MailScanner scans the whole message, big batch, as the batch processing takes longer time, Many RBL lists, contacting each one of them, non cached Spam list, Restrictions to use resources on part of applications, DNS server non-functionality and many more.

Little googling revealed some tips and tricks to overcome quite these problems, as listed below

In Mailscanner.conf set

Clamd Use Threads = yes

This will use  multiple thread from avaialble multiple cpu cores. so that scanning will become faster

log speed =yes

Will log the speed of message scanning so that you will know it, and benchmark

Reduce the number of RBL lists

Reduce the batch size from 30 to a lower number

These will speed up Mailscanner a bit. Also a speedy filesystem would help much.

No comments:

Post a Comment