Centos – My Centos is terribly slow

apache-2.2centosssh

Linux xxx.xxx.xxx 2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:19:18 EDT 2009 i686 i686 i386 GNU/Linux

Problems:

  • When I connect with SSH, each command take until 2 min to run!
  • Restart the server takes 16 minutes on average.
  • I have a web page in this server (PHP (Joomla) with Apache/2.2.8 (Unix) ) and each page takes 1 min in load.
  • I assumed it was because originally it was connected with IPv6, because when running the command "lsmod | grep v6" showed me the following:

ipv6 261473 125
xfrm_nalgo 13381 1 ipv6

But using this website (http://techno.mayix.net/deshabilitar-ipv6-en-redhatcentos/), I disable IPv6 connection because when running the command "lsmod | grep v6" showed me nothing. But the problems of slowness, still.
– When I run the command top give me this:

top - 09:40:08 up 10 min,  1 user,  load average: 18.89, 14.99, 8.02
Tasks: 153 total,  13 running, 140 sleeping,   0 stopped,   0 zombie
Cpu(s): 57.1%us, 42.4%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.2%hi,  0.3%si,  0.0%st
Mem:   1555380k total,   667200k used,   888180k free,    18332k buffers
Swap:  2048276k total,        0k used,  2048276k free,   193784k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                              
 2265 mysql     15   0  133m  23m 6052 S 35.8  1.5   2:43.58 mysqld                                                                                                               
 2868 apache    15   0 42092  21m 4520 S 18.2  1.4   0:19.51 httpd                                                                                                                
 3112 apache    16   0 41844  21m 4536 S 18.2  1.4   0:09.18 httpd                                                                                                                
 2506 apache    15   0 42108  21m 4516 S 17.9  1.4   0:23.15 httpd                                                                                                                
 3471 apache    16   0 41732  20m 4252 S 17.9  1.4   0:02.59 httpd                                                                                                                
 2567 apache    15   0 42060  21m 4496 S 16.9  1.4   0:20.84 httpd                                                                                                                
 2625 apache    16   0 41840  21m 4568 R 16.9  1.4   0:16.53 httpd                                                                                                                
 3461 apache    15   0 41460  20m 4260 S 16.6  1.4   0:02.17 httpd                                                                                                                
 2593 apache    15   0 42084  21m 4480 S 16.3  1.4   0:15.37 httpd                                                                                                                
 2429 apache    15   0 42040  21m 4484 S  9.8  1.4   0:14.31 httpd                                                                                                                
 3477 apache    18   0 36900  15m 3792 R  5.5  1.0   0:01.24 httpd                                                                                                                
 3499 apache    19   0 37432  16m 3840 R  3.3  1.1   0:01.40 httpd                                                                                                                
 2417 apache    15   0 40544  20m 4508 S  1.3  1.3   0:18.89 httpd                                                                                                                
 3520 root      15   0  2420 1060  800 R  1.3  0.1   0:00.46 top                                                                                                                  
 3464 apache    15   0 41332  20m 4432 S  0.7  1.4   0:04.03 httpd                                                                                                                
 2423 operador  15   0 10032 1596 1024 S  0.3  0.1   0:00.54 sshd                                                                                                                 
 2463 root      16   0  2052  636  556 S  0.3  0.0   0:01.84 hald-addon-stor                                                                                                      
 2482 apache    15   0 37224  16m 4508 S  0.3  1.1   0:17.95 httpd                                                                                                                
    1 root      15   0  2152  672  580 S  0.0  0.0   0:02.09 init                                                                                                                 
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.10 migration/0                                                                                                          
    3 root      34  19     0    0    0 R  0.0  0.0   0:00.00 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.05 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      10  -5     0    0    0 S  0.0  0.0   0:00.06 events/0                                                                                                             
    9 root      10  -5     0    0    0 S  0.0  0.0   0:00.04 events/1                                                                                                             
   10 root      10  -5     0    0    0 S  0.0  0.0   0:00.03 khelper                                                                                                              
   11 root      14  -5     0    0    0 S  0.0  0.0   0:00.02 kthread                                                                                                              
   15 root      10  -5     0    0    0 S  0.0  0.0   0:00.08 kblockd/0                                                                                                            
   16 root      10  -5     0    0    0 S  0.0  0.0   0:00.05 kblockd/1                                                                                                            
   17 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid                                                                                                               
   74 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0                                                                                                             
   75 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/1                                                                                                             
   78 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 khubd                                                                                                                
   80 root      14  -5     0    0    0 S  0.0  0.0   0:00.03 kseriod                                                                                                              
  146 root      19   0     0    0    0 S  0.0  0.0   0:00.00 pdflush                                                                                                              
  147 root      15   0     0    0    0 S  0.0  0.0   0:00.50 pdflush                                                                                                              
  148 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 kswapd0                                                                                                              
  149 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0                                                                                                                
  150 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 aio/1                                                                                                                
  305 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kpsmoused                                                                                                            
  349 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 mpt_poll_0                                                                                                           
  350 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0                                                                                                            
  354 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 ata/0                                                                                                                
  355 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 ata/1                                                                                                                
  356 root      12  -5     0    0    0 S  0.0  0.0   0:00.00 ata_aux                                                                                                              
  363 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 kstriped                                                                                                             
  376 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 ksnapd 

When I run "cat /etc/resolv.conf", in my server, showed me this:

nameserver xxx.xxx.xxx.1
domain mydomain.com

And when I run "ping mydomain.com", in my pc, showed me this:

"Pinging mydomain.com [xxx.xxx.xxx.5] with 32 bytes of data:"

Best Answer

Looks like mysql and apache are chewing up a lot of processing time. The database could be a bottleneck, I am assuming that you really need it - could you profile your db usage and see what is going on?