Lately, our server face problem with the memory. Started from few weeks ago, our server was loading very slow. Accessing emails and websites were really take too long. Then we asked the server technical support to reboot the server for us. After rebooting, things came back to normal. We thought that it was time for us to upgrade the RAM. Originally we only have 2GB RAM on our server, therefore we upgraded it into 8GB.
We thought the problem was solved. However, after upgrading the RAM, the memory usage was keep getting higher and higher. It was like always reach its max usage (ex. 456.5 MB free out of 7.8 GB memory). The next day, the server was totally down, and we had to ask the technical support to reboot the server for us again. Every time we face the problem, we have to ask the supporting staff to reboot the server for us. According to the support staff, if they of the SQL access, the memory will turn back to normal. But if they on it again, the memory will getting higher again. So, they suspect the problem is with the SQL query.
I want to ask, is it really the SQL query that give the problem? Or it was the hardware problem? If it's the SQL, how do I know what kind of queries that have taken up such a huge memory? How can I check it? Our server is running on the details below:
OS: Linux 2.6.18
CPU: GenuineIntel, Intel(R)Xeon(R)CPU W3550 @ 3.07GHz
Average Load: 808.18;674.21;587.18
database records: 421,031 with 58 tables
Query statistics that I can provide from the PHPMyAdmin:
select 314 k 11.98 k 66.37%
set option 34 k 1,296.59 7.18%
show fields 19 k 712.00 3.94%
update 16 k 620.61 3.44%
alter table 16 k 610.32 3.38%
change db 15 k 569.08 3.15%
insert 15 k 560.20 3.10%
show variables 11 k 434.01 2.40%
show tables 9,752 371.66 2.06%
begin 7,172 273.33 1.51%
result of performing 'top':
top - 15:20:07 up 1 day, 6:13, 1 user, load average: 497.30, 512.17, 542.15
Tasks: 7743 total, 5 running, 7738 sleeping, 0 stopped, 0 zombie
Cpu(s): 23.9%us, 50.9%sy, 0.1%ni, 25.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8173372k total, 8048380k used, 124992k free, 1816952k buffers
Swap: 2096376k total, 216k used, 2096160k free, 533876k cached
I hope someone can give me some advice as I have facing this problem for some time and I have no one that I can ask for guidance. Thank you in advance.
update: dmesg
CPU5: Temperature above threshold, cpu clock throttled
CPU7: Temperature/speed normal
CPU2: Temperature/speed normal
CPU6: Temperature/speed normal
CPU1: Temperature above threshold, cpu clock throttled
CPU3: Temperature/speed normal
CPU0: Temperature/speed normal
CPU4: Temperature/speed normal
CPU6: Temperature/speed normal
CPU5: Temperature/speed normal
CPU1: Temperature/speed normal
CPU2: Temperature/speed normal
CPU4: Temperature/speed normal
CPU7: Temperature/speed normal
CPU0: Temperature/speed normal
CPU3: Temperature/speed normal
brute[19592]: segfault at 0000000000000028 rip 00000000080a592f rsp 00000000ffae3a28 error 6
brute[19539]: segfault at 0000000000000028 rip 00000000080a592f rsp 00000000ffae3a28 error 6
CPU2: Temperature/speed normal
CPU4: Temperature/speed normal
CPU7: Temperature/speed normal
CPU1: Temperature/speed normal
CPU5: Temperature/speed normal
CPU3: Temperature/speed normal
CPU6: Temperature/speed normal
CPU0: Temperature/speed normal
CPU0: Temperature/speed normal
CPU7: Temperature/speed normal
CPU6: Temperature/speed normal
CPU1: Temperature/speed normal
CPU2: Temperature/speed normal
CPU3: Temperature/speed normal
CPU5: Temperature/speed normal
CPU4: Temperature/speed normal
brute[21368]: segfault at 0000000000000000 rip 0000000008048f03 rsp 00000000ffb82db0 error 4
today's TOP result:
top - 10:42:47 up 3 days, 1:35, 1 user, load average: 4.35, 4.53, 4.59
Tasks: 187 total, 5 running, 182 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.7%us, 38.5%sy, 0.0%ni, 48.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8173372k total, 7800156k used, 373216k free, 1653768k buffers
Swap: 2096376k total, 216k used, 2096160k free, 2723732k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27913 consulti 25 0 31096 3700 1172 R 100.2 0.0 1484:40 perl
27916 consulti 25 0 31096 3732 1204 R 100.2 0.0 1051:59 perl
28213 consulti 25 0 31096 3736 1204 R 100.2 0.0 1073:30 perl
28210 consulti 23 0 31096 3740 1204 S 86.9 0.0 1016:23 perl
3205 mysql 15 0 333m 55m 5416 S 13.6 0.7 143:36.73 mysqld
14616 apache 15 0 333m 33m 6056 S 4.7 0.4 1:02.12 httpd
25104 consulti 18 0 31096 3732 1204 R 4.7 0.0 486:12.74 perl
2702 root 15 0 12744 1148 808 R 0.3 0.0 0:00.01 top
1 root 15 0 10352 696 588 S 0.0 0.0 0:01.62 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.07 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/2
9 root 34 19 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/2
10 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
11 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/3
12 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3
13 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/3
14 root RT -5 0 0 0 S 0.0 0.0 0:00.05 migration/4
15 root 34 19 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/4
16 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/4
17 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/5