We have a server running Apache 1.3, PHP 4.21 with PHPA, and MySQL 3.23
About a week end we had an incident where some fields in several
hundred MySQL database records zeroed. I was able to restore the
data from a backup. I also rebooted at about the same time (prior to
that, the sever had been up for about a month).
Since then the server seems to be running MUCH slower. I don't know
whether it is due to the DB problem, or something else. When running
top, it is not unusual to see a load average of 3 or 4 or higher even
though the CPU is 95% idle most of the time.
Here is a typical top display:
7:40pm up 3 days, 2:08, 3 users, load average: 3.90, 3.21, 2.48
122 processes: 119 sleeping, 2 running, 1 zombie, 0 stopped
CPU states: 1.8% user, 2.4% system, 0.0% nice, 95.8% idle
Mem: 512584K av, 507580K used, 5004K free, 0K shrd, 8992K buff
Swap: 1445808K av, 25500K used, 1420308K free 376276K cached
In the past we have sometimes have had this problem when our access or
error logs got real big, so I made sure that was not the case.
I have a gut feeling this is a DB problem, but am not sure how to go
about finding where the slowdown is. It seems to be across the board,
not any specific pages (we have over 300 PHP pages on the site). We
are running mytop, but that doesn't seem to show anything unusual.
Typical display:
MySQL on localhost (3.23.54-log) up 0+02:29:04 [19:51:20]
Queries: 178.9k qps: 20 Slow: 66.0 Se/In/Up/De(%): 85/02/09/00
qps now: 31 Slow qps: 0.0 Threads: 6 ( 3/ 4) 86/00/08/00
Key Efficiency: 99.8% Bps in/out: 2.1k/64.6k Now in/out: 2.6k/140.5k
The # of slow queries is (66.0 in the above display) is increasing a
couple of counts per minute.
In the past, I have have added additional indicies to tables which
seemed to help overall, but I haven't changed the DB or added any new
queries lately, so there is no reason why things should have slowed
down.
So, MY QUESTION IS:
How can I determine why my server load is so high all of a sudden? Is
there a way I can determine if it is an MySQL problem? Are there ways
of displaying the time it takes for specific queries to execute
(without having to go in and modify dozens of PHP pages), or to
display all queries that take over a certain time to run?
Thx |