[Web4lib] mediawiki and excessive CPU usage

Michael McDonnell michael at winterstorm.ca
Tue Jul 10 16:38:14 EDT 2007


Ken Irwin wrote:
> The wiki is running on:
> SunOS 5.8
> PHP 4.3.11
> Apache 2.0
>
> I don't have the kind of access that allows me to run strace, but our 
> sysadmin was able to get some kind of reading on what processes are 
> hogging up the bulk of the server's attention. There were about 100 
> different wiki-related scripts, but here were the biggies. The first 
> number shows how many times the particular operation occured in one 
> minute; this comes from the output of a "truss" command, with which I 
> am not familiar:
Truss is like strace and it is the command that came with Solaris before 
Solaris 10 (which introduced a different command "dtrace").  For those 
who don't know, truss and strace will show you all of the system calls 
being executed by a process.  This is typically things like opening a 
file, reading, and writing data.  The output below looks like the output 
of "truss | sort | uniq -c" which sorts all the output   What that means 
is that this is a sorted list of all the different system commands that 
were executed in a short space of time, with a count of how many time 
each command was executed.

So what I see is a LOT of "stat" commands.  Stat checks the status of a 
file.  A program would "stat" a file if it wanted to see if it exists, 
or if it had changed.

In general, this does not look unusual, but the volume you report is 
obviously high.

I would agree with Casey's advice about checking Special:Statistics at 
this point.

>  50 stat("/usr/local/www/green_guide/normal/UtfNormal.php",
>  50 stat("/usr/local/www/green_guide/includes/normal/UtfNormal.php",
>  50 
> resolvepath("/usr/local/www/green_guide/includes/normal/UtfNormal.php",
>  50 open("/usr/local/www/green_guide/includes/normal/UtfNormal.php",
>  39 stat("/usr/local/www/green_guide/includes/Revision.php",
>  39 stat("/usr/local/www/green_guide/Revision.php",
>  39 resolvepath("/usr/local/www/green_guide/skins/MonoBook.php",
>  39 resolvepath("/usr/local/www/green_guide/skins/MonoBook.deps.php",
>  39 resolvepath("/usr/local/www/green_guide/includes/Revision.php",
>  39 open("/usr/local/www/green_guide/skins/MonoBook.php",
>  39 open("/usr/local/www/green_guide/skins/MonoBook.deps.php",
>  39 open("/usr/local/www/green_guide/includes/Revision.php",
>  26 stat("/usr/local/www/green_guide/languages/LanguageUtf8.php",
>  26 stat("/usr/local/www/green_guide/languages/LanguageEn.deps.php",
>  26 stat("/usr/local/www/green_guide/includes/normal/UtfNormalUtil.php",
>  26 stat("/usr/local/www/green_guide/includes/Title.php",
>  26 stat("/usr/local/www/green_guide/includes/SkinTemplate.php",
>  26 stat("/usr/local/www/green_guide/includes/LanguageUtf8.php",
>  26 stat("/usr/local/www/green_guide/includes/GlobalFunctions.php",
>  26 stat("/usr/local/www/green_guide/includes/Database.php",
>  26 stat("/usr/local/www/green_guide/includes/CacheManager.php",
>  26 stat("/usr/local/www/green_guide/includes/Article.php",
>  26 stat("/usr/local/www/green_guide/Title.php",
>  26 stat("/usr/local/www/green_guide/LanguageUtf8.php",
>  26 stat("/usr/local/www/green_guide/GlobalFunctions.php",
>  26 stat("/usr/local/www/green_guide/Database.php",
>  26 stat("/usr/local/www/green_guide/CacheManager.php",
>  26 stat("/usr/local/www/green_guide/Article.php",
>  26 resolvepath("/usr/local/www/green_guide/languages/LanguageUtf8.php",
>  26 resolvepath("/usr/local/www/green_guide/index.php",
>  26 
> resolvepath("/usr/local/www/green_guide/includes/normal/UtfNormalUtil.php", 
>
>  26 resolvepath("/usr/local/www/green_guide/includes/Title.php",
>  26 resolvepath("/usr/local/www/green_guide/includes/SkinTemplate.php",
>  26 
> resolvepath("/usr/local/www/green_guide/includes/GlobalFunctions.php",
>  26 resolvepath("/usr/local/www/green_guide/includes/Database.php",
>  26 resolvepath("/usr/local/www/green_guide/includes/CacheManager.php",
>  26 resolvepath("/usr/local/www/green_guide/includes/Article.php",
>  26 open("/usr/local/www/green_guide/languages/LanguageUtf8.php",
>  26 open("/usr/local/www/green_guide/includes/normal/UtfNormalUtil.php",
>  26 open("/usr/local/www/green_guide/includes/Title.php",
>  26 open("/usr/local/www/green_guide/includes/SkinTemplate.php",
>  26 open("/usr/local/www/green_guide/includes/GlobalFunctions.php",
>  26 open("/usr/local/www/green_guide/includes/Database.php",
>  26 open("/usr/local/www/green_guide/includes/CacheManager.php",
>  26 open("/usr/local/www/green_guide/includes/Article.php",
>
> ken
>
> Michael McDonnell wrote:
>> Ken Irwin wrote:
>>> Hi folks,
>>>
>>> We've got a wiki running on our library website (using MediaWiki 
>>> 1.6.8) and have noticed that since installing it our CPU usage is 
>>> almost always right up at 99% of capacity. About 100 distinct 
>>> processes related to the wiki run about 2000 times every minute. It 
>>> may be that a high-traffic wiki needs all this legwork to keep 
>>> itself up-to-date and functioning well, but this is a super 
>>> low-traffic wiki. Does anyone know if it's possible to get wiki to 
>>> chill out a bit? ($cpuQualudes = "yes";)
>>>
>>> We're thinking of installing additional wikis on the same machine 
>>> for different purposes, and we'd like to not fry its little brain. 
>>> Any advice?
>> Hi Ken,
>>
>> This may be a misconfiguration or a bug.  What platform are you 
>> running mediawiki on?  Apache on Linux?  What version of PHP?  How 
>> much RAM does your server have?
>>
>> Do you see any logfile activity that corresponds with this activity?  
>> That is, are there access or error logs being generated in large 
>> volumes?  You can change what apache is logging by changing the 
>> "LogLevel" configuration line (typically in httpd.conf).  Change it 
>> from "notice" to "info" or "debug" and see if that provides any 
>> relevant information.
>>
>> Under linux you can also take a peak at what those crazy processes 
>> are doing with the
>> "strace" command (under Solaris 10 you could use dtrace). e.g. strace 
>> -p <pid> where <pid> is the ID of one of the crazy processes.
>>
>> -- 
>> Michael McDonnell
>


More information about the Web4lib mailing list