MySQL Slow performace
We run a web site that uses 7.2 RH with MySQL and PHP, 1G processor and 512 RAM. We have X-Cart and Vbulletin running on the server. Everything was working great with the server load around 1.0 or less with about 40 users on the message board.Now there is a problem with slow X-Cart performance. The slow performance is sporadic but appears to be a nagging problem(10+ seconds to load a page). The server load has increased to around 2.5 to 5.0 with the same number of users online. Before this problem started occurring the server load would hardly ever hit 2.0. As far as we now nothing has changed. We have not done any up major updates to the X-Cart or Vbulletin.
When doing top during these slow times mysql takes up a lot of resources. Here is a copy of top.
9:20pm up 26 days, 17:17, 1 user, load average: 2.49, 2.34, 2.39
207 processes: 205 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 0.0% user, 0.8% system, 0.0% nice, 0.4% idle
Mem: 514096K av, 506716K used, 7380K free, 0K shrd, 13072K buff
Swap: 1028148K av, 17344K used, 1010804K free 163840K cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
18847 mysql 9 0 24876 21M 4188 S 40.4 4.3 0:04 mysqld
18849 mysql 20 0 24876 21M 4188 R 9.2 4.3 0:00 mysqld
16069 apache 17 0 9912 7732 4248 S 6.5 1.5 0:09 httpd
6331 apache 9 0 10288 8120 4420 S 2.9 1.5 1:24 httpd
7025 apache 9 0 10008 7808 4324 S 2.7 1.5 1:11 httpd
14998 apache 9 0 10224 8016 4292 S 1.9 1.5 0:17 httpd
16062 apache 9 0 10292 8112 4252 S 1.9 1.5 0:12 httpd
16065 apache 9 0 10024 7844 4300 S 1.7 1.5 0:09 httpd
16146 apache 9 0 10524 8344 4296 S 1.7 1.6 0:10 httpd
16028 apache 9 0 10036 7856 4292 S 1.3 1.5 0:08 httpd
14994 apache 9 0 10208 8024 4320 S 1.1 1.5 0:19 httpd
18845 admin 15 0 1220 1220 828 R 1.1 0.2 0:00 top
18850 mysql 9 0 24876 21M 4188 S 0.9 4.3 0:00 mysqld
18851 mysql 9 0 24876 21M 4188 S 0.9 4.3 0:00 mysqld
15559 mysql 10 0 24876 21M 4188 R 0.7 4.3 0:02 mysqld
17991 mysql 9 0 24876 21M 4188 S 0.7 4.3 0:01 mysqld
18852 mysql 9 0 24876 21M 4188 S 0.7 4.3 0:00 mysqld
18394 mysql 9 0 24876 21M 4188 S 0.5 4.3 0:00 mysqld
14773 apache 9 0 11228 9032 4332 S 0.3 1.7 0:17 httpd
18161 mysql 9 0 24876 21M 4188 S 0.3 4.3 0:00 mysqld
17823 mysql 9 0 24876 21M 4188 S 0.1 4.3 0:00 mysqld
17909 mysql 9 0 24876 21M 4188 S 0.1 4.3 0:00 mysqld
1 root 8 0 508 468 444 S 0.0 0.0 0:05 init
2 root 9 0 0 0 0 SW 0.0 0.0 0:00 keventd
3 root 19 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU0
4 root 9 0 0 0 0 SW 0.0 0.0 0:37 kswapd
5 root 9 0 0 0 0 SW 0.0 0.0 0:00 bdflush
6 root 9 0 0 0 0 SW 0.0 0.0 0:00 kupdated
12 root 9 0 0 0 0 SW 0.0 0.0 0:00 scsi_eh_0
13 root 9 0 0 0 0 SW 0.0 0.0 15:54 kjournald
129 root -1 -20 0 0 0 SW< 0.0 0.0 0:00 mdrecoveryd
136 root 9 0 0 0 0 SW 0.0 0.0 0:00 kjournald
498 root 9 0 592 532 488 S 0.0 0.1 0:56 syslogd
503 root 9 0 544 392 392 S 0.0 0.0 0:00 klogd
577 named 9 0 3704 3364 1516 S 0.0 0.6 0:00 named
579 named 9 0 3704 3364 1516 S 0.0 0.6 0:00 named
580 named 9 0 3704 3364 1516 S 0.0 0.6 2:48 named
Does anyone have any idea of what could be causing the slow performance. More importantly how to fix this problem?