How can I optimize the performance of Amavis for processing large volumes of email?

Optimize the Number of Amavis Processes

How fast Amavis can process email is directly tied to Max servers option under Warden -> Settings -> Filter Settings. More information:

https://www.danami.com/clients/knowledgebase/139/How-can-I-speed-up-how-fast-Amavis-processes-email.html

Enable a Local Caching DNS Resolver

You can speed up DNS queries used by Amavis by enabling a local caching DNS resolver. More information:

https://www.danami.com/clients/knowledgebase/187/How-can-I-setup-a-local-caching-DNS-resolver-to-speed-up-DNS-queries-used-by-Amavis.html

Enable the Redis Storage Engine

For high volume servers we recommend switching from the default MySQL storage back end used for anti-spam bayes learning to the Redis back end. More information:

https://www.danami.com/clients/knowledgebase/188/How-can-I-configure-the-anti-spam-learning-in-Warden-to-use-Redis-for-storing-bayes-data-.html

Enable the plugin

This plugin will compile the rules into native-code in order to provide significant speedups in rule evaluation. More information:

https://www.danami.com/clients/knowledgebase/190/How-can-I-enable-the-Rule2XSBody-plugin-to-speed-up-anti-spam-rules-by-compiling-them-into-native-code.html

Exclude Specific Senders

If you have certain senders that are sending out large amounts of email (newsletters) then you can exclude them from anti-spam and anti-virus scanning. More information:

https://www.danami.com/clients/knowledgebase/147/How-can-I-bypass-Amavis-scanning-for-some-specific-senders.html

Disable the TxRep plugin (optional)

If your server processes a lot of email and your MySQL/MariaDB is overloaded you may want to disable the TxRep plugin as it will add about 10 additional DB queries per email and will slow down the the anti-spam learning (Amavis will still perform well with it disabled). You can disable it under Warden -> Settings -> Plugin Settings -> uncheck the TxRep checkbox and press the update button to apply the changes.

Optimize MySQL/MariaDB

Optimizing MySQL is outside the scope of this article but we recommend that advanced users use the MySQL tuner script from the link below. We recommend that you at least set the query cache e.g. query_cache_size=128M in the [mysqld] section of your /etc/my.cnf.

https://github.com/major/MySQLTuner-perl

To download and run the MySQLTuner script (MySQL should have not been restarted in a few days otherwise you will not get accurate results):

wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
chmod +x mysqltuner.pl
./mysqltuner.pl

Viewing the Processing Time

To view how long a message took to be processed by Amavis go to Warden -> Logs -> Message log and click on the plus icon next to an entry. The processing time will be listed at the end on the message (in milliseconds).

  • optimize, performance
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I view what SpamAssassin rules were matched by a message?

Go to Warden -> Settings -> Filter Settings and change the Log template option from short...

How can I reset and regenerate the mail statistics for the server?

You can reset and regenerate the statistics for all domains and mailboxes using the following...

How can I disable Amavis bad header tests?

By default mail with bad headers is quarantined for review but are still delivered to the users...

How do I allow or deny certain attachments with Amavis?

In Amavis banned attachments are controlled by the $banned_filename_re option in the Amavis...

How can I disable the ***UNCHECKED*** tag that Amavis applies to a message when an email is not able to be scanned?

Amavis will prepend to Subject (for local recipients only) if mail could not be decoded or...