On 17/05/2011 11:12 AM, lowshoe wrote:
> hi all,
> i just switched from mod_php to mod_fcgid as we have a
> multi-user-webserver and i wanted to use the benefits of per-user
> executuion of php-scripts.
> now we have huge problems with the stability of the webserver.

This does not surprise me, once you get over 10 users with the fcgid
defaults it's easy to whore a server.

> the server has 16 GB RAM
> after stating the webserver, 10GB of ram are immediately consumed.

You must host many busy sites if they are mostly spawning processes
right after restart. You might need to consider splitting them up over
different boxes.

> later (15-20min) the ram ist almost full and most of the
> php-applications are not available anymore.
> in the apache error.log i can then see the following error:
> Connection reset by peer: mod_fcgid: error reading data from FastCGI server
> [error] [client x.x.x.x] Premature end of script headers: index.php

You should track down exactly what is causing this, try strace or
something. If you know exactly what is causing them to die you can tweak
much more effectively.

> this is my fcgid.conf:
>  DefaultMinClassProcessCount and DefaultMaxClassProcessCount are commented out

set FcgidMinProcessesPerClass 0 and FcgidMaxProcessesPerClass to like 5
or 10. Watch the error log to see if it cries about not being able to
spawn processes, bump if necessary.

> in my top  i see something like this:
> 3510  user1   20   0  134m  10m  5472 S   35       0.1   0:07.07 php-cgi
>  4402 user2   20   0  157m  22m   13m S   16       0.1   0:01.29 php-cgi
>  3619 user3   20   0  153m  20m   15m S    6        0.1   0:01.28 php-cgi
>  3609 user4   20   0  144m  21m  5632 S    4        0.1   0:00.39 php-cgi
>  [..]
>  3623 userN   20   0  140m  18m  5708 S    4        0.1   0:00.47 php-cgi

Yes you will have up to <virtual host or php wrapper>
*FcgidMaxProcessesPerClass. default is 100 since you have not set it.

> the fcgid-wrapper-script for each user looks like this:

export PHPRC="/data/homewww/user1/conf/"
export TMPDIR="/data/homewww/user1/tmp"
exec /opt/php/php-5.2/bin/php-cgi -c "/data/homewww/user1/conf/php.ini" $@

I'm just nitpicking. Don't quote me but I beleive PHPRC will
overlay/override settings given with -c, so you could set defaults and
allow clients to override. That said I haven't had to configure php in a

> this is my apache2.conf:
> <IfModule mpm_worker_module>
>     StartServers          2
>     MinSpareThreads    25
>     MaxSpareThreads    75
>     ThreadLimit            64
>     ThreadsPerChild      25
>     MaxClients            150
>     MaxRequestsPerChild   0
> </IfModule>

event > worker, won't change memory usage much.

> a also have aeccelerator enabled for each user. could this be the reason?

disable eaccelerator for an hour and see what happens.

If you need more specific help feel free to send me an email and we can
work something out. Most of my consulting is "X server performance just
went to shit after Y change. Fix it yesterday"

Something else to note. I noticed you have php in /opt, which tells me
you don't want your distro to play with your install. If your using a
"enterprise" (old as shit) distro that can play a huge role in the way
applications perform and the resources they use. Now obviously switching
is not always an option. I got called in to "fix" a download mirror for
a FPS game mod/map site. While on centos it would only put out a maximum
of 15MB/s with lighty and randomly drop connections here and there. But
after doing a takeover install remotely, the box now runs gentoo and
happily puts out 35-38MB/s using apache with a lower loadavg (but more
ram, apache is a bit of a pig). Point being, sometimes all the tricks in
the world won't make a difference if your starting with crap.

What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
Mod-fcgid-users mailing list

Reply via email to