Results 1 to 7 of 7

Thread: Optimizing SpamAssassin for quickness/CPU-efficiency

  1. #1
    Member
    Join Date
    Dec 2001
    Location
    Long Beach, NY
    Posts
    287
    cPanel/WHM Access Level

    Root Administrator

    Default Optimizing SpamAssassin for quickness/CPU-efficiency

    Hi there -

    Has anybody tried to optimize SpamAssassin for processing speed?

    I've got lots of RAM to work with and would like to optimize so emails are processed most efficiently.

    Currently I have 12 max children and the default for Max Connections Per Child. I'm not sure if there are many moves to be made here, given that cpanel offers no means of changing the bulk of SpamAssassin default settings.

    I see that my spam emails average about 12-14 seconds for processing. This is on an 8-core hyper-threaded box and on a 12-core hyper-threaded box!

    Are there any productive changes I can make to improve upon that? I'd not mind throwing a few more gig of RAM at this, and I also wonder if there's a way to have SA make more efficient use of a multi-threaded machine similar to what PIGZ has done for compression.

    Thanks.

    Mike

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    You could try to modify settings for SpamAssassin in /var/lib/spamassassin/3.003001/updates_spamassassin_org directory. Most of the settings you have for SpamAssassin should be housed there.

    I don't have suggestions for changes, but this is being mentioned per the "cpanel offers no means of changing the bulk of SpamAssassin default settings" comment.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Dec 2001
    Location
    Long Beach, NY
    Posts
    287
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    Thanks Tristan - I took a look inside that directory and there are a large number of files. It is not apparent to me as to how I would be able to modify a setting like min-children. In fact when I grep that directory for "child" or "Child" there are no matches.

    Is modification of the content in this directory supported? I was told via ticket that the settings I am seeking to change are not supported.

    Thanks.
    Last edited by lbeachmike; 07-10-2012 at 11:08 PM.

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    We have an option in WHM > Manage Plugins that has "spamdconf" that can be enabled. When it is enabled, you can modify some of the settings for children as those settings appear in WHM > Plugins > Setup Spamd Startup Configuration area. There's no option for min-children, though.

    As for modification of the directory being supported, it isn't supported but it is available. Any modifications outside WHM that cannot be done via scripts either are basically custom. We don't support customizations, but that doesn't mean customizations don't work either. That's why the "no means" isn't actually how I would have phrased it. There's a means, it just is going to require customizations. There are going to probably be startup values you cannot modify, yes.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Member
    Join Date
    Dec 2001
    Location
    Long Beach, NY
    Posts
    287
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    Hi Tristan - Thanks. I already do use the Spamd Startup Settings plugin, which only allows four options of a huge number of SpamAssassin configuration options, to be set.

    Paul explained via ticket back in May why the additional options are not setable without modifying restartsrv.pl -

    This option cannot be set. I looked at /usr/local/cpanel/Cpanel/RestartSrv.pm and cPanel is only reading certain setting which are set in a function there and the options that it reads are set at Main >> Spamd Startup Configuration, and get written out to /etc/cpspamd.conf, but only those options you can set are read, in other words you cannot set your own options and if you did they would be ignored by the restart code.
    And then provided further details in a subsequent response -

    Extra parameters cannot be set in a config file. *Some* parameters can, but only those that are parsed by Restartsrv.pm which is the module that /scripts/restartsrv_* use when doing a service restart:

    Code:
    sub getspamdopts {
    my $cpspamdconf = '/etc/cpspamd.conf';
    my $spamdoptions = '';
    my $socketpath = '';
    my $allowedips = '--allowed-ips=127.0.0.1';
    my $maxconnperchild = '';
    my $maxchildren = '--max-children=5';
    my $maxspare = '';
    my $pidfile = '--pidfile=/var/run/spamd.pid';
    my $localonly = '';
    my $timeouttcp = '';
    my $timeoutchild = '';
    if ( -e $cpspamdconf ) {
    open( SPAMD, "<", $cpspamdconf );
    while (<SPAMD>) {
    if ( !(/^[\s\t]*$/) && !(/^[\s\t]*\#.*$/) ) {
    chomp();
    my ( $option, $value ) = split( '=', $_ );
    next if ( !defined $value || $value eq '' );
    if ( $option eq 'allowedips' ) {
    $allowedips = "--allowed-ips=${value}";
    }
    elsif ( $option eq 'socketpath' ) {
    $socketpath = "--socketpath=${value}";
    }
    elsif ( $option eq 'maxconnperchild' ) {
    $maxconnperchild = "--max-conn-per-child=${value}";
    }
    elsif ( $option eq 'maxspare' ) {
    $maxspare = "--max-spare=${value}";
    }
    elsif ( $option eq 'maxchildren' ) {
    $maxchildren = "--max-children=${value}";
    }
    elsif ( $option eq 'pidfile' ) {
    $pidfile = "--pidfile=${value}";
    }
    elsif ( $option eq 'local' ) {
    $localonly = '--local';
    }
    elsif ( $option eq 'timeouttcp' ) {
    $timeouttcp = "--timeout-tcp=${value}";
    }
    elsif ( $option eq 'timeoutchild' ) {
    $timeoutchild = "--timeout-child=${value}";
    }
    }
    }
    }
    close(SPAMD);
    $spamdoptions = $localonly . ' ' . $timeoutchild . ' ' . $timeouttcp . ' ' . ( $socketpath ? $socketpath : $allowedips ) . ' ' . $maxconnperchild . ' ' . $pidfile . ' ' . $maxchildren . ' ' . $maxspare;
    return $spamdoptions;
    }
    Only the options you see in that function can be set as those are the ones returned to $spamdoptions. While yes it technically would be possible to hack that routine in Restartsrv.pm, that is outside the scope of support and very much not recommended as Restartsrv.pm is used by not just SpamAssassin.
    So, it appears that getting additional settings modified requires hacking of restartsrv.pl, which I'm surpised is hard-coded like that - the code must be very ancient code because that seems very un-cpanel-like

    I've not yet sat down and tried to walk through the code to figure it out, so if you have any insight, it would be most appreciated.

  6. #6
    Member
    Join Date
    Dec 2001
    Location
    Long Beach, NY
    Posts
    287
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    Incidentally, my feature-request is here -

    http://forums.cpanel.net/f145/config...ns-283811.html

    Amazingly, there is zero interest thus far. Perhaps my subject line is not very catchy I'd think this would be a hot item, given the amount of resource SpamAssassin utilizes and the plethora of currently unreachable settings that exist as shown here - best SpamAssassin options documentation - 032411

  7. #7
    Member
    Join Date
    Dec 2001
    Location
    Long Beach, NY
    Posts
    287
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Optimizing SpamAssassin for quickness/CPU-efficiency

    So absolutely nobody in cpanel land has optimized spamassassin?

Similar Threads

  1. SpamAssassin and CPU load
    By mehrdad abed in forum New User Questions
    Replies: 1
    Last Post: 08-07-2008, 12:09 PM
  2. What does cPanel tolerate? (limit / efficiency)
    By lemocin in forum New User Questions
    Replies: 0
    Last Post: 04-13-2007, 01:06 PM
  3. SpamAssassin maxs out CPU
    By mfahey in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 11-16-2006, 06:17 PM