httpd 使用 100% CPU-这到底意味着什么?

httpd 使用 100% CPU-这到底意味着什么?

我有 2 个 Intel Xeon E5520 四核

top - 18:21:49 up 2 days, 16:33,  4 users,  load average: 2.09, 2.26, 2.36
Tasks: 313 total,   2 running, 309 sleeping,   0 stopped,   2 zombie
Cpu(s): 12.7%us,  1.3%sy,  0.0%ni, 85.8%id,  0.1%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  16427200k total, 16213896k used,   213304k free,  3129632k buffers
Swap:  2104496k total,      268k used,  2104228k free,  6019324k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                            
 7733 apache    25   0  388m  66m 5172 R 100.0  0.4   1:28.74 httpd                                                                                                                                                                                             
28314 apache    15   0  389m  68m 5868 S 36.9  0.4   3:16.10 httpd                                                                                                                                                                                              
23429 apache    15   0  357m  36m 4016 S  7.0  0.2   0:04.93 httpd                                                                                                                                                                                              
19562 apache    15   0  358m  36m 5176 S  2.3  0.2   1:39.78 httpd                                                                                                                                                                                              
22219 apache    17   0  360m  39m 5824 S  2.3  0.2   1:51.41 httpd                                                                                                                                                                                              
22233 apache    15   0  360m  38m 5152 S  2.3  0.2   2:31.10 httpd                                                                                                                                                                                              
32578 apache    15   0  357m  35m 5192 S  2.3  0.2   1:44.53 httpd                                                                                                                                                                                              
  911 apache    15   0  358m  36m 5192 S  2.0  0.2   1:35.01 httpd                                                                                                                                                                                              
19565 apache    15   0  359m  37m 5192 S  2.0  0.2   1:35.85 httpd                                                                                                                                                                                              
21643 apache    18   0  355m  34m 4016 S  2.0  0.2   0:12.32 httpd                                                                                                                                                                                              
27753 apache    17   0  358m  37m 5824 S  2.0  0.2   1:17.59 httpd                                                                                                                                                                                              
18335 apache    16   0  357m  35m 5128 S  1.7  0.2   0:21.50 httpd                                                                                                                                                                                              
 3698 apache    18   0  358m  36m 5200 S  1.3  0.2   2:38.00 httpd                                                                                                                                                                                              
22236 apache    15   0  370m  48m 5196 S  1.3  0.3   1:46.29 httpd                                                                                                                                                                                              
10148 apache    15   0  357m  35m 5148 S  1.0  0.2   0:42.47 httpd                                                                                                                                                                                              
10164 apache    16   0  357m  35m 5188 S  1.0  0.2   0:45.26 httpd                                                                                                                                                                                              
19560 apache    15   0  358m  37m 5828 S  1.0  0.2   1:41.71 httpd                                                                                                                                                                                              
19564 apache    15   0  357m  36m 5184 S  1.0  0.2   1:52.38 httpd                                                                                                                                                                                              
14119 apache    15   0  370m  48m 5192 S  0.7  0.3   2:27.13 httpd                                                                                                                                                                                              
25016 apache    18   0  386m  62m 5096 S  0.7  0.4   0:01.31 httpd                                                                                                                                                                                              
26375 root      15   0 12900 1340  848 R  0.7  0.0   0:08.10 top             

现在我刚刚切换到 ubuntu,我在 top 中也遇到了同样的事情

top - 18:06:58 up 1 day,  1:23,  8 users,  load average: 2.68, 2.97, 3.01
Tasks: 452 total,   5 running, 447 sleeping,   0 stopped,   0 zombie
Cpu(s): 14.3%us,  1.0%sy,  0.0%ni, 84.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  12322908k total,  7752752k used,  4570156k free,  4906912k buffers
Swap:  1998840k total,     1516k used,  1997324k free,  1203772k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                                            
 9112 www-data  20   0  341m  88m 3948 R  100  0.7   0:17.50 apache2                                                                                                                                                                                            
  424 www-data  20   0  347m  91m 5496 R  100  0.8   1:13.21 apache2                                                                                                                                                                                            
 9549 www-data  20   0  338m  85m 4052 R   41  0.7   0:03.37 apache2                                                                                                                                                                                            
 5894 www-data  20   0  295m  40m 5376 S   25  0.3   0:19.08 apache2                                                                                                                                                                                            
 9742 www-data  20   0  265m  13m 4028 S   25  0.1   0:00.78 apache2                                                                                                                                                                                            
 9004 www-data  20   0  266m  13m 4052 S   24  0.1   0:06.91 apache2                                                                                                                                                                                            
 6344 www-data  20   0  343m  90m 4252 R   18  0.8   0:20.49 apache2                                                                                                                                                                                            
 4722 www-data  20   0  295m  40m 5444 S   10  0.3   0:27.82 apache2                                                                                                                                                                                            
26081 www-data  20   0  307m  52m 5452 S   10  0.4   1:40.82 apache2                                                                                                                                                                                            
 6495 www-data  20   0  306m  51m 5396 S    2  0.4   0:20.03 apache2                                                                                                                                                                                            
28300 www-data  20   0  316m  63m 4364 S    2  0.5   2:35.44 apache2                                                                                                                                                                                            
 9411 www-data  20   0  304m  52m 4256 S    2  0.4   0:02.24 apache2                                                                                                                                                                                            
 1541 root      20   0 3455m 105m 9396 S    1  0.9  11:26.06 java                                                                                                                                                                                               
 8142 www-data  20   0  306m  51m 5368 S    1  0.4   0:09.83 apache2                                                                                                                                                                                            
 7160 root      20   0 19616 1832 1064 R    1  0.0   0:56.69 top                                                                                                                                                                                                
  375 root      20   0     0    0    0 S    0  0.0   0:05.83 kondemand/12                                                                                                                                                                                       
    1 root      20   0 23696 1908 1272 S    0  0.0   0:19.71 init                                                                                                                                                                                               
    2 root      20   0     0    0    0 S    0  0.0   0:00.01 kthreadd                                                                                                                                                                                           
    3 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/0                                                                                                                                                                                        
    4 root      20   0     0    0    0 S    0  0.0   0:00.61 ksoftirqd/0                                                                                                                                                                                        
    5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0                                                                                                                                                                                         
    6 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/1                                                                                                                                                                                        
    7 root      20   0     0    0    0 S    0  0.0   0:00.70 ksoftirqd/1                                                                                                                                                                                        
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1                                                                                                                                                                                         
    9 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/2                                                                                                                                                                                        
   10 root      20   0     0    0    0 S    0  0.0   0:00.10 ksoftirqd/2                                                                                                                                                                                        
   11 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/2                                                                                                                                                                                         
   12 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/3                                                                                                                                                                                        
   13 root      20   0     0    0    0 S    0  0.0   0:00.03 ksoftirqd/3                                                                                                                                                                                        
   14 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/3                                                                                                                                                                                         
   15 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/4                                                                                                                                                                                        
   16 root      20   0     0    0    0 S    0  0.0   0:00.12 ksoftirqd/4                                                                                                                                                                                        
   17 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/4                                                                                                                                                                                         
   18 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/5                                                                                                                                                                                        
   19 root      20   0     0    0    0 S    0  0.0   0:00.01 ksoftirqd/5                                                                                                                                                                                        
   20 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/5                                                                                                                                                                                         
   21 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/6                                                                                                                                                                                        
   22 root      20   0     0    0    0 S    0  0.0   0:00.93 ksoftirqd/6                                                                                                                                                                                        
   23 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/6                                                                                                                                                                                         
   24 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/7                                                                                                                                                                                        
   25 root      20   0     0    0    0 S    0  0.0   0:00.16 ksoftirqd/7                                                                                                                                                                                        
   26 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/7                                                                                                                                                                                         
   27 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/8                                                                                                                                                                                        
   28 root      20   0     0    0    0 S    0  0.0   0:00.04 ksoftirqd/8                                                                                                                                                                                        
   29 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/8                                                                                                                                                                                         
   30 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/9                                                                                                                                                                                        
   31 root      20   0     0    0    0 S    0  0.0   0:00.01 ksoftirqd/9                                                                                                                                                                                        
   32 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/9                                                                                                                                                                                         
   33 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/10                                                                                                                                                                                       
   34 root      20   0     0    0    0 S    0  0.0   0:00.01 ksoftirqd/10                                                                                                                                                                                       
   35 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/10                                                                                                                                                                                        
   36 root      RT   0     0    0    0 S    0  0.0   0:00.01 migration/11                                                                                                                                                                                       
   37 root      20   0     0    0    0 S    0  0.0   0:00.02 ksoftirqd/11                                                                                                                                                                                       
   38 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/11                                                                                                                                                                                        
   39 root      RT   0     0    0    0 S    0  0.0   0:00.06 migration/12                                                                                                                                                                                       
   40 root      20   0     0    0    0 S    0  0.0   0:00.11 ksoftirqd/12                                                                                                                                                                                       
   41 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/12                                                                                                                                                                                        
   42 root      RT   0     0    0    0 S    0  0.0   0:01.13 migration/13                                                                                                                                                                                       
   43 root      20   0     0    0    0 S    0  0.0   0:00.43 ksoftirqd/13                                                                                                                                                                                       
   44 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/13                                                                                                                                                                                        
   45 root      RT   0     0    0    0 S    0  0.0   0:00.75 migration/14                                                                                                                                                                                       
   46 root      20   0     0    0    0 S    0  0.0   0:00.54 ksoftirqd/14                       

答案1

可能是您的某个 PHP 脚本非常繁忙。

答案2

这种情况持续了多久?这是第一次发生吗?我看到了工作线程的挂机时间,但您没有给我们任何其他信息。

如果事情一直变得很棘手,您可以做很多事情来排除故障,例如使用 mod_logio 进行黑盒日志记录、使用 XDebug 进行 PHP 分析等。

如果没有更多细节,很难推测。

相关内容