最近,我们的服务器面临内存问题.从几周前开始,我们的服务器加载非常慢.访问电子邮件和网站真的需要太长时间.然后我们请求服务器技术支持为我们重启服务器.重启后,事情恢复正常.我们认为现在是我们升级RAM的时候了.最初我们的服务器上只有2GB RAM,因此我们将其升级到8GB.
我们认为问题已经解决了.但是,升级RAM后,内存使用量不断增加.它总是达到其最大使用率(例如,从7.8 GB内存中免费456.5 MB).第二天,服务器完全关闭,我们不得不请求技术支持再次为我们重启服务器.每当我们遇到问题时,我们都要请支持人员为我们重启服务器.据支持人员介绍,如果他们进行了sql访问,内存将恢复正常.但如果他们再次上场,记忆力将再次升高.因此,他们怀疑问题与SQL查询有关.
我想问一下,问题真的是SQL查询吗?还是硬件问题?如果是sql,我怎么知道哪些查询占用了如此巨大的内存?我怎么检查呢?我们的服务器正在运行以下详细信息:
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
查询我可以从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%
执行’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
我希望有人可以给我一些建议,因为我已经面对这个问题一段时间了,我没有人可以寻求指导.先感谢您.
更新: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
今天的TOP结果:
top - 10:42:47 up 3 days,1:35,load average: 4.35,4.53,4.59
Tasks: 187 total,182 sleeping,0 zombie
cpu(s): 12.7%us,38.5%sy,0.0%ni,48.7%id,7800156k used,373216k free,1653768k buffers
Swap: 2096376k total,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