有没有办法发现为什么我的服务器负载很高

Duc*_*uck 6 logs load freeze

刚才由于超高负载(75!)导致系统瘫痪,我被迫远程重启我的 CentOS 6.3 系统。这是一个为 wordpress 博客 (mySQL + PHP) 提供服务的网络/邮件服务器。

有没有我可以分析的日志并尝试发现是什么原因造成的?

这是我现在从系统收到的关于昨天事件的电子邮件:

This is an automated message notifying you that the 5 minute load average on your system is 75.91.
This has exceeded the 10 threshold.

One Minute      - 83.24
Five Minutes    - 75.91
Fifteen Minutes - 39.35

top - 22:25:30 up 122 days,  7:28,  0 users,  load average: 99.14, 80.70, 42.31
Tasks: 298 total,   1 running, 297 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.2%us,  0.5%sy,  0.0%ni, 98.1%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1020176k total,   956828k used,    63348k free,     2788k buffers
Swap:  4194296k total,  1391900k used,  2802396k free,    25164k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
   1 root      20   0 19352  448  444 S  0.0  0.0   0:08.27 /sbin/init                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
   2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [kthreadd]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
   3 root      RT   0     0    0    0 S  0.0  0.0   0:09.43 [migration/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   4 root      20   0     0    0    0 S  0.0  0.0   1884:48 [ksoftirqd/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 [migration/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   6 root      RT   0     0    0    0 S  0.0  0.0   0:06.06 [watchdog/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
   7 root      RT   0     0    0    0 S  0.0  0.0   0:07.81 [migration/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 [migration/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   9 root      20   0     0    0    0 S  0.0  0.0   7:25.62 [ksoftirqd/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  10 root      RT   0     0    0    0 S  0.0  0.0   0:04.58 [watchdog/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  11 root      20   0     0    0    0 S  0.0  0.0   4:48.95 [events/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  12 root      20   0     0    0    0 S  0.0  0.0   9:13.85 [events/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  13 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [cgroup]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  14 root      20   0     0    0    0 S  0.0  0.0   0:08.21 [khelper]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  15 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [netns]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  16 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [async/mgr]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  17 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [pm]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  18 root      20   0     0    0    0 S  0.0  0.0   0:21.72 [sync_supers]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  19 root      20   0     0    0    0 S  0.0  0.0   0:20.65 [bdi-default]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  20 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [kintegrityd/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  21 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [kintegrityd/1]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  22 root      20   0     0    0    0 S  0.0  0.0   5:26.09 [kblockd/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  23 root      20   0     0    0    0 S  0.0  0.0   0:22.90 [kblockd/1] 
Run Code Online (Sandbox Code Playgroud)

我不确定这是否有帮助。

一切似乎都在使用 0% 的 CPU...

这是另一封电子邮件...

This is an automated message notifying you that the 5 minute load average on your system is 70.53.
This has exceeded the 10 threshold.

One Minute      - 94.79
Five Minutes    - 70.53
Fifteen Minutes - 32.68

top - 22:23:34 up 122 days,  7:26,  0 users,  load average: 96.88, 74.74, 35.91
Tasks: 283 total,   2 running, 281 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.2%us,  0.5%sy,  0.0%ni, 98.1%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1020176k total,   970440k used,    49736k free,     3196k buffers
Swap:  4194296k total,  1249404k used,  2944892k free,    29836k cached

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
6715 apache    20   0  217m 7804 3252 D  1.9  0.8   0:00.28 /usr/sbin/httpd -k start -DSSL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
6770 apache    20   0  218m 8772 3368 D  1.9  0.9   0:00.28 /usr/sbin/httpd -k start -DSSL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
6799 apache    20   0  301m 8088 3184 D  1.9  0.8   0:00.14 /usr/sbin/httpd -k start -DSSL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
7265 root      20   0 15160 1220  808 R  1.9  0.1   0:00.02 /usr/bin/top -c -b -n 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
7266 root      20   0 15160 1220  808 R  1.9  0.1   0:00.02 /usr/bin/top -c -b -n 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
   1 root      20   0 19352  448  444 S  0.0  0.0   0:08.27 /sbin/init                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
   2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 [kthreadd]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
   3 root      RT   0     0    0    0 S  0.0  0.0   0:09.43 [migration/0]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   4 root      20   0     0    0    0 S  0.0  0.0   1884

jll*_*gre 1

除非您有一些带有日志记录的系统监控,否则很难判断事后高系统负载的原因。

性能下降的一个常见原因是 RAM 耗尽导致的系统抖动。

在大多数 Unix 系统上,抖动不会导致高负载,但 Linux 确实会在此指标中考虑等待 I/O 的进程,因此这里可能就是这种情况。