php-cgi apache high load

rndinit0

Verified User
Joined
Jan 15, 2005
Messages
91
PHP:
top - 12:51:47 up 14:31,  2 users,  load average: 1.64, 2.24, 1.40                                                                  
Tasks: 332 total,   7 running, 325 sleeping,   0 stopped,   0 zombie                                                                
Cpu(s):  22.4% user,   2.6% system,   0.0% nice,  75.0% idle                                                                        
Mem:    905392k total,   726548k used,   178844k free,    18724k buffers                                                            
Swap:  1951888k total,  1951888k used,        0k free,   101000k cached                                                             
                                                                                                                                    
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                
20640 chicintu  17   0 14784  14m 4624 R  7.2  1.6   0:00.22 php-cgi                  17082 root      12   0  1264 1264  852 R  1.3  0.1   0:10.59 top                      
17371 apache     9   0  6244 6244 5608 S  0.3  0.7   0:00.05 httpd                    17618 mysql      9   0 24416  23m 1528 S  0.3  2.7   0:00.01 mysqld

I've recently switched to Apache 2.0 Php5 suPHP .60 mysql 5

The problem is apache keeps crashing, if this happens, bind, exim, dovecot usually crash as well.

top shows that highest loads are apache 28% cpu and users php scripts taking up anywhere from .3% -> 8% cpu.

How can I control/resolve this?

The server has become extremely unstable.

Debian 2.4.27-2-386 #1 Wed Aug 17 09:33:35 UTC 2005 i686 GNU/Linux
 
update:

PHP:
top - 13:39:27 up 15:19,  2 users,  load average: 1.74, 1.58, 1.20
Tasks: 309 total,   5 running, 304 sleeping,   0 stopped,   0 zombie
Cpu(s):   0.3% user,   1.3% system,   0.0% nice,  98.4% idle
Mem:    905392k total,   572628k used,   332764k free,    31892k buffers
Swap:  1951888k total,  1951884k used,        4k free,   149392k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                  
24825 root      15   0  1248 1248  848 R  1.3  0.1   0:19.74 top                      
24148 bind      11   0  8148 8148 1744 S  0.3  0.9   0:31.09 named                    
    1 root       8   0   536  480  456 S  0.0  0.1   0:05.83 init

I would assume having only 4k of swap free is really really bad.

free -m

PHP:
               total       used       free     shared    buffers     cached
Mem:           884        562        321          0         32        146
-/+ buffers/cache:        383        500
Swap:         1906       1904          1
 
Last edited:
My first guess is, suPHP is the thing sucking up so much memory.
Your system has no memory left, so everything crashes ...
 
My first guess is, suPHP is the thing sucking up so much memory.
Your system has no memory left, so everything crashes ...
Thats what I was thinking, isnt there a way to control how much memory suphp uses. Or at least optimize it? I cant be the only one using suphp
 
I must admit, running PHP as CGI is a bit of a resource hog, i've reverted all my servers back to CLI.
You could try a memory upgrade aswell, atleast double what you have.
 
I must admit, running PHP as CGI is a bit of a resource hog, i've reverted all my servers back to CLI.
You could try a memory upgrade aswell, atleast double what you have.

Whats the average usage of suPHP per virtual entry in httpd?
 
Back
Top