Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i have fedora 8 32bit vps on amazon ec2

1.7 gig memory

After few runs (dont know how much) server is getting stuck and just not loaded ( can't access with http://)

When using 'top' im getting :

     1948 memcache  15   0 33048  856  424 S  0.0  0.0   0:00.04 memcached
 2031 root      25   0  2640 1208 1040 S  0.0  0.1   0:00.00 mysqld_safe
 2091 mysql     18   0  137m  24m 5472 S  0.0  1.4   0:09.16 mysqld
 6690 root      18   0 59928 7968 4712 S  0.0  0.5   0:00.01 httpd
 6692 apache    15   0 61100  18m  14m S  0.0  1.1   0:00.10 httpd
 6693 apache    22   0 69996  40m  27m S  0.0  2.4   0:00.73 httpd
 6694 apache    18   0 64744  27m  19m S  0.0  1.6   0:00.87 httpd
 6695 apache    15   0 82488  53m  28m S  0.0  3.1   0:02.25 httpd
 6696 apache    15   0 67408  36m  25m S  0.0  2.1   0:00.93 httpd
 6697 apache    15   0 64248  26m  18m S  0.0  1.5   0:00.23 httpd
 6698 apache    15   0 65884  27m  17m S  0.0  1.6   0:00.38 httpd
 6699 apache    18   0 64840  26m  17m S  0.0  1.5   0:00.42 httpd
 6700 apache    15   0 66324  34m  25m S  0.0  2.0   0:00.93 httpd
 6702 apache    15   0 68668  29m  17m S  0.0  1.7   0:01.20 httpd
 6703 apache    16   0 60344  10m 6788 S  0.0  0.6   0:00.01 httpd
 6704 apache    15   0 65784  27m  18m S  0.0  1.6   0:00.84 httpd
 6705 apache    15   0 60336  10m 6596 S  0.0  0.6   0:00.00 httpd
 6706 apache    15   0 65948  27m  18m S  0.0  1.6   0:00.83 httpd
 6707 apache    15   0 64836  25m  17m S  0.0  1.5   0:00.19 httpd
 6708 apache    15   0 67104  26m  16m S  0.0  1.6   0:00.21 httpd

I dont know how much mb is it , only 'service httpd restart' make it online again I dont have much traffic becouse atm its only test server

I got php5.2.6 and mysql 5.1.6 installed

Here is the parts of config :

Timeout 25
KeepAlive On
MaxKeepAliveRequests 150
KeepAliveTimeout 3
<IfModule prefork.c>
StartServers       20
MinSpareServers    20
MaxSpareServers    50
ServerLimit        500
MaxClients         500
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

HostnameLookups Off

what might be the problem ? thanks

edit : i noticed that static files like .html , .txt are served fine

When using php then we getting the problem , i have tested 2 simple scripts :

<?php getcwd(); ?>
<?php phpinfo(); ?>

php is loaded as apache_module

php memory limit is 128M

what might be the problem ? thanks again

share|improve this question

2 Answers 2

150 KeepAliveRequests is too much for server with only 1.7G memory. Reduce it to 30-50. You should reduce Max instances as well. You cant fit in that memory 500 instances, I would put here like 200-300.

I suggest that your application need those 128M you gave to php? If not reduce it as well.

Enable extend server status and look at http://server/server-status/ for further optimization.

share|improve this answer

I think you're starting way too much server instances. Which module are you using as worker? prefork.c or worker.c?

If youre using prefork.c set the values 'StartServers', MinSpareServers and MaxSpareServers to a lower value and look if the server hangs again.

<IfModule prefork.c>
  StartServers       5
  MinSpareServers    5
  MaxSpareServers    10
  ServerLimit        500
  MaxClients         500
  MaxRequestsPerChild  1000
</IfModule>

Also check the apache error logs for issues.

share|improve this answer
    
how do i know which module is used by the apache ? have you noticed its happen only with php files? my orginal prefork was start 8 server and its got stuck more often –  Anonymous Feb 19 '10 at 13:57
    
i dont have much experience with apache on a fedora box. You should have some lines like ''LoadModule prefork /usr/lib/.......'' in your httpd.conf. It depends which mod is loaded in the httpd.conf. –  grub Feb 19 '10 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.