You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Andrew Nelson <an...@hotmail.com> on 2004/11/29 01:27:31 UTC

Mail::audit & mail::spamassassin is SLOW - not using spamd ?

Hi,

I want to use spamassassin through an Exim router pipe to a
Mail:Audit perl script.  It's all working very effectively and i'm
impressed by SA's accuracy, but it's incredibly slow and grinds
my server to a halt when activated.  It's on FreeBSD 5.2.1.

I'm not too sure how to make use of the spamd daemon
from the script  - I think that would help..  My perl script uses
simple calls to SA and doesn't anything else fancy - here's the guts:

$status = $spamtest->check ($mail);
$status->rewrite_mail ();
open (PIPE, "|-") || exec($exim, @parms);
$mail->{obj}->print(\*PIPE);
close(PIPE);
exit $? >> 8;

I've run a perl profiler on it which shows most of the execution
time is taken by Mail::SpamAssassin::Conf::_parse.

%Time ExclSec CumulS #Calls sec/call Csec/c  Name
19.9   0.128  0.147      1   0.1282 0.1470  Mail::SpamAssassin::Conf::_parse
9.67   0.062  0.493     67   0.0009 0.0074  
Mail::SpamAssassin::PerMsgStatus::
                                             BEGIN
9.20   0.059  0.092      1   0.0589 0.0917  
Mail::SpamAssassin::PerMsgStatus::
                                             do_body_tests
7.02   0.045  0.053      1   0.0448 0.0534  
Mail::SpamAssassin::PerMsgStatus::
                                             do_head_tests
6.08   0.039  0.272     17   0.0023 0.0160  Mail::SpamAssassin::BEGIN
4.83   0.031  0.060      9   0.0035 0.0067  base::import
3.59   0.023  0.019   1030   0.0000 0.0000  
Mail::SpamAssassin::Conf::add_test
3.59   0.023  0.023      3   0.0078 0.0078  Mail::SpamAssassin::read_cf
2.49   0.016  0.013    720   0.0000 0.0000  
Mail::SpamAssassin::PerMsgStatus::
                                             ran_rule_debug_code
2.49   0.016  0.022     26   0.0006 0.0009  Mail::Audit::BEGIN
2.49   0.016  0.015     21   0.0007 0.0007  File::Spec::Unix::BEGIN
2.49   0.016  0.023     59   0.0003 0.0004  Net::DNS::RR::_get_subclass
2.49   0.016  0.185      1   0.0156 0.1851  Mail::SpamAssassin::init
2.49   0.016  0.015      6   0.0026 0.0025  IO::Socket::BEGIN
2.49   0.016  0.015     26   0.0006 0.0006  Mail::SpamAssassin::Bayes::BEGIN


How can I speed it up?  It needs to be at least 75% faster for me to be able 
to
use it  - I've previously been using commercial software which works fine, 
but isn't
as good or flexible.  This is a P4 ~3.2Ghz.

Thanks,
Andrew.



Re: Mail::audit & mail::spamassassin is SLOW - not using spamd ?

Posted by Theo Van Dinter <fe...@kluge.net>.
On Mon, Nov 29, 2004 at 11:27:31AM +1100, Andrew Nelson wrote:
> I want to use spamassassin through an Exim router pipe to a
> Mail:Audit perl script.  It's all working very effectively and i'm
> impressed by SA's accuracy, but it's incredibly slow and grinds
> my server to a halt when activated.  It's on FreeBSD 5.2.1.

FYI: SpamAssassin no longer supports Mail::Audit, so you're kind of on your
own there.

> I've run a perl profiler on it which shows most of the execution
> time is taken by Mail::SpamAssassin::Conf::_parse.

If you're using 2.x, yeah, _parse is kind of slow.  It's a huge if-then-else
structure.  It was rewritten to do hash lookups in 3.x so it's a lot faster.

-- 
Randomly Generated Tagline:
Always remember that you're representing our country.  I guess what I'm
 saying is, don't mess up France the way you messed up your room.
 
 		-- Homer Simpson
 		   The Crepes of Wrath

Re: Mail::audit & mail::spamassassin is SLOW - not using spamd ?

Posted by Martin Hepworth <ma...@solid-state-logic.com>.
Andrew

what version of SA?

what extra rules in /etc/mail/spamassassin?

any RBLs or URI RBLs being used?

Rather than bringing up SA each time, prob better to have something in 
th background that catches the email and run SA over it...that startup 
routines do seem to be kinda slow.

I use MailScanner to link my SA, Exim, ClamAV and Sophos together on my 
gateway and do note it takes a good amount of time (> 20 seconds) to get 
going when I start the process off. MailScanner, a little like your 
script, call SA via the Perl API, but forks child processes to handle 
the actual processing and kills the child processes every so often to 
stop memory leakage.

You may wish to have a have a look at MailScanner and link a call to 
MailAudit in if the default logging isn't enough or the extra tools 
available don't do exactly what you want...

--
Martin Hepworth
Snr Systems Administrator
Solid State Logic
Tel: +44 (0)1865 842300


Andrew Nelson wrote:
> Hi,
> 
> I want to use spamassassin through an Exim router pipe to a
> Mail:Audit perl script.  It's all working very effectively and i'm
> impressed by SA's accuracy, but it's incredibly slow and grinds
> my server to a halt when activated.  It's on FreeBSD 5.2.1.
> 
> I'm not too sure how to make use of the spamd daemon
> from the script  - I think that would help..  My perl script uses
> simple calls to SA and doesn't anything else fancy - here's the guts:
> 
> $status = $spamtest->check ($mail);
> $status->rewrite_mail ();
> open (PIPE, "|-") || exec($exim, @parms);
> $mail->{obj}->print(\*PIPE);
> close(PIPE);
> exit $? >> 8;
> 
> I've run a perl profiler on it which shows most of the execution
> time is taken by Mail::SpamAssassin::Conf::_parse.
> 
> %Time ExclSec CumulS #Calls sec/call Csec/c  Name
> 19.9   0.128  0.147      1   0.1282 0.1470  
> Mail::SpamAssassin::Conf::_parse
> 9.67   0.062  0.493     67   0.0009 0.0074  
> Mail::SpamAssassin::PerMsgStatus::
>                                             BEGIN
> 9.20   0.059  0.092      1   0.0589 0.0917  
> Mail::SpamAssassin::PerMsgStatus::
>                                             do_body_tests
> 7.02   0.045  0.053      1   0.0448 0.0534  
> Mail::SpamAssassin::PerMsgStatus::
>                                             do_head_tests
> 6.08   0.039  0.272     17   0.0023 0.0160  Mail::SpamAssassin::BEGIN
> 4.83   0.031  0.060      9   0.0035 0.0067  base::import
> 3.59   0.023  0.019   1030   0.0000 0.0000  
> Mail::SpamAssassin::Conf::add_test
> 3.59   0.023  0.023      3   0.0078 0.0078  Mail::SpamAssassin::read_cf
> 2.49   0.016  0.013    720   0.0000 0.0000  
> Mail::SpamAssassin::PerMsgStatus::
>                                             ran_rule_debug_code
> 2.49   0.016  0.022     26   0.0006 0.0009  Mail::Audit::BEGIN
> 2.49   0.016  0.015     21   0.0007 0.0007  File::Spec::Unix::BEGIN
> 2.49   0.016  0.023     59   0.0003 0.0004  Net::DNS::RR::_get_subclass
> 2.49   0.016  0.185      1   0.0156 0.1851  Mail::SpamAssassin::init
> 2.49   0.016  0.015      6   0.0026 0.0025  IO::Socket::BEGIN
> 2.49   0.016  0.015     26   0.0006 0.0006  
> Mail::SpamAssassin::Bayes::BEGIN
> 
> 
> How can I speed it up?  It needs to be at least 75% faster for me to be 
> able to
> use it  - I've previously been using commercial software which works 
> fine, but isn't
> as good or flexible.  This is a P4 ~3.2Ghz.
> 
> Thanks,
> Andrew.
> 
> 

**********************************************************************

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote confirms that this email message has been swept
for the presence of computer viruses and is believed to be clean.

**********************************************************************