[Koha] Koha used 100% cpu

Robin Sheat robin at catalyst.net.nz
Thu Aug 14 11:24:45 NZST 2014


Carlos Rodrigo Cordova Sandoval schreef op wo 13-08-2014 om 10:52
[-0400]:
> have a problem with our koha 3.16.02 installed on debian 64bit 7x and
> has
> 45,000 records and 157,000 items, our koha uses 100% of cpu. view
> image.

It's hard to tell for sure, but it really just looks like you're seeing
a lot of traffic. Have you tried running stats over your apache logs to
see what's going on there? If you set apache to log things with a better
logformat than default[0], then you'll get a lot more data about who and
what is hitting your system. It might be you're being spidered by a
badly behaving bot, or it might just be you're so popular that you need
to invest in more hardware (and/or help the Plack support move forward
so that Koha is a lot lighter on CPU.)

As good as htop is, the one thing it's not showing is the distribution
of wait states, regular top will say something like:

Cpu(s): 38.3%us,  3.8%sy,  0.0%ni, 56.4%id,  0.9%wa,  0.0%hi,  0.6%si,  0.0%st

if the 'wa' one is high, that usually means things are stuck in IO wait,
which is common if you're on a virtual machine and something else starts
using all your disk bandwidth. It can also mean that it's just got so
much going on that mysql is always reading the disk, telling these
situations apart just requires experience. 

If you do find that mysql is doing too much work, especially IO — and
looking at htop I think it might be — make sure you've tuned it to have
enough RAM to hold your entire database in memory. That can make a huge
difference. There's a mysql tuner script out there that might help[1].

[0] I add:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

to the bottom of /etc/koha/apache-shared.conf, that helps a lot. I
should really make that default for the packages.

[1] https://launchpad.net/mysql-tuning-primer or http://mysqltuner.com/
I think it's one of these.

-- 
Robin Sheat
Catalyst IT Ltd.
✆ +64 4 803 2204
GPG: 5FA7 4B49 1E4D CAA4 4C38  8505 77F5 B724 F871 3BDF



More information about the Koha mailing list