0

We use webalizer to generate reports on our Apache access logs - it is useful in conjunction with Google Analytics.

The problem is that webalizer uses ALOT of CPU when running. If I run top I can see two perl processes with 90% CPU - this slows down the machine and therefore the website for our users.

Webalizer is run via a daily cron job (/etc/cron.daily/00webalizer):

#! /bin/bash
# update access statistics for the web site
if [ -s /var/log/httpd/access_log ]; then
   exec /usr/bin/webalizer -Q
fi

Does anyone know how to limit how much CPU webalizer can use? For example, would nice help and how would I use it?

Tom
  • 4,157
  • 11
  • 41
  • 52

2 Answers2

1

Yes nice would help, it lower the process priority so your webserver and thus users get priority.

exec nice /usr/bin/webalizer -Q 
  • Thanks - I'll give it a try. Will it lessen the CPU load at all? – Tom Apr 23 '10 at 09:44
  • No, but webalizer will only get scheduled when nothing else wants the CPU time –  Apr 23 '10 at 11:12
  • After using `nice` for a few days I can report that unfortunately it isn't the silver bullet I was hoping for - webalizer is still overloading the server when it runs. – Tom Apr 26 '10 at 10:23
0

Having monitored the situation for a while I have an embarrassing confession - Webalizer was not causing the load spike on our server. It was actually caused by logwatch, a different log file analyser. Both scripts were running at the same time (via cron.daily) and I only figured out which one was causing the issue by disabling one, then the other and comparing the CPU usage.

We don't need logwatch because I have never even seen the emails it produces. So, I disabled it by deleting the symbolic link in /etc/cron.daily/:

> ls -l /etc/cron.daily/0logwatch 
lrwxrwxrwx 1 root root 39 Apr 17 03:46 /etc/cron.daily/0logwatch -> /usr/share/logwatch/scripts/logwatch.pl

Problem solved. Sorry Webalizer - didn't mean to falsely accuse you of being a CPU hog.

Tom
  • 4,157
  • 11
  • 41
  • 52