Applicable to:
- Plesk for Linux
Symptoms
High CPU usage for sa-learn
and spamtrain
processes in the Plesk server.
Cause
Since the sa-learn
script is used by spamassassin
to learn the specific properties of spam from a folder that supposedly contains only spam emails.
CPU usage of the sa-learn
process depends on the number of emails in mailboxes and their size. In turn, if the number of emails is huge - CPU over usage is expected.
Resolution
To work around the issue, use one of the following solutions:
-
Connect to the server using SSH.
-
Use nice or ionice utilities to decrease the priority of
sa-update
from the cron tasks. -
Create a wrapper file which will execute
sa-learn
with the lowest CPU priority:# cp -a /usr/bin/sa-learn{,.orig}
# echo "/bin/nice 19 /usr/bin/perl -T -w /usr/bin/sa-learn.orig \$@" > /usr/bin/sa-learn
# chmod +x /usr/bin/sa-learnNote: In Debian based OS the correct path is
/usr/bin/nice
Set the lowest priority to the currently running sa-learn
processes execute the following:
# ps auxwf | grep -v grep | grep sa-learn | awk {'print $2'} | xargs -i renice 19 {}
Note: Process priority values range from -20 to 19. A process with the nice value of -20 is considered to be on top of the priority. And a process with nice value of 19 is considered to be low on the priority list.
Disable the sa-update
execution by moving 60sa-update
and spamassassin
files from /etc/cron.daily
to a different location:
# mv /etc/cron.daily/60sa-update /root
Comments
1 comment
Curious: why would disabling sa-update have anything to do with sa-learn? The script at /etc/cron.daily/60sa-update doesn't appear to have any references to sa-learn in it...
Please sign in to leave a comment.