You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Honza Lefty Škoda <le...@multihost.cz> on 2010/10/28 16:10:09 UTC

[users@httpd] mod_fcgid: fcgid processes serving static content as well

Hi!

I use mod_fcgid & suexec for safe execution of php scripts. I've
recently tested the performance of fcgid
and found out that when i request static page (.html or .css)
fcgi process is spawned (if doesn't exist yet) and the
counter "Accesses" on server-status page increments as well.

I'm not sure if this is a bug, result of my wrong settings, or
desired behavior, but it imho leads to quite poor performance.
I use mpm_worker, gentoo linux, mod_fcgid 2.3.5, apache 2.2.15.

Pieces of configuration I found relevant:

In file: /etc/apache2/modules.d/20_mod_fcgid.conf
   3: FcgidIPCDir /var/run/fcgidsock
   4: FcgidProcessTableFile /var/run/fcgid_shm
  10: FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 5000
  11: FcgidMaxRequestsPerProcess 4990
  12: FcgidProcessLifeTime 5184000
  15: FcgidIdleTimeout 300
  16: FcgidIdleScanInterval 60
  18: FcgidBusyTimeout 240
  19: FcgidBusyScanInterval 60
  21: FcgidConnectTimeout 20
  22: FcgidIOTimeout 240
  24: FcgidMinProcessesPerClass 0
  25: FcgidMaxProcessesPerClass 10
  29: FcgidSpawnScore 0
  30: FcgidTerminationScore 0

SuexecUserGroup user group
Options +ExecCGI
AddHandler the-php .php
Action the-php /mh-bin/php-wrapper.fcgi

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_fcgid: fcgid processes serving static content as well

Posted by Honza Lefty Škoda <le...@multihost.cz>.
I have finally found it! fcgid and apache work great (as usual :P), the
problem rests elsewhere:

When I hit the static file my browser downloads favicon.ico as well. If
it doesn't exist, server raises E404 - and that is handled by PHP in
configurations with mod_rewrite clean url hack. robots.txt does similar
problems with web crawlers.

I'm going to solve it by writing a redirect that will return E504. (E404
would be caught by ErrorDocument, which would lead to same problems.)
Another step to make my server really effective. :)

Thanks for your help, I wouldn't have figured it out as soon without it :).

On 30.10.2010 12:27, Honza Lefty Škoda wrote::
> On 29.10.2010 19:08, Jeff Trawick wrote:
>> 2010/10/28 Honza Lefty Škoda <le...@multihost.cz>:
>>> Hi!
>>>
>>> I use mod_fcgid & suexec for safe execution of php scripts. I've
>>> recently tested the performance of fcgid
>>> and found out that when i request static page (.html or .css)
>>> fcgi process is spawned (if doesn't exist yet)
>>
>> unexpected
>>
>>>                                                                      and the
>>> counter "Accesses" on server-status page increments as well.
>>
>> expected
> Are you sure? I've probably described it wrong way, I meant Accesses
> counter of the corresponding fcgid worker (mod_fcgid status section)
>>
>>>
>>> I'm not sure if this is a bug, result of my wrong settings, or
>>> desired behavior, but it imho leads to quite poor performance.
>>> I use mpm_worker, gentoo linux, mod_fcgid 2.3.5, apache 2.2.15.
>>>
>>> Pieces of configuration I found relevant:
>>>
>>> In file: /etc/apache2/modules.d/20_mod_fcgid.conf
>>
>>> Options +ExecCGI
>>> AddHandler the-php .php
>>> Action the-php /mh-bin/php-wrapper.fcgi
>>
>> something more is needed to run static files through php; the other
>> directives are irrelevant
>>
>> (it is getting processed by php, right?  mod_fcgid can't handle static
>> file requests itself)
> 
> If I insert PHP code into the static file (like <?php echo "something";
> ?>), it isn't processed, so it probably doesn't go through PHP
> interpreter. Maybe it doesn't go through fcgi worker at all. On the
> other hand, the speed of processing static files is imho quite poor
> (static file is servered 3x faster than PHP with DB).
> 
> The mail reason why I began inspecting this problem is that static files
> "wakes" fcgi threads and prevents idle timeouts, spawns new threads and
> so. I would expect fcgid not serving static files (and ignoring them in
> fcgi process management!) at all.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_fcgid: fcgid processes serving static content as well

Posted by Jeff Trawick <tr...@gmail.com>.
2010/10/30 Honza Lefty Škoda <le...@multihost.cz>:
> On 29.10.2010 19:08, Jeff Trawick wrote:
>> 2010/10/28 Honza Lefty Škoda <le...@multihost.cz>:
>>> Hi!
>>>
>>> I use mod_fcgid & suexec for safe execution of php scripts. I've
>>> recently tested the performance of fcgid
>>> and found out that when i request static page (.html or .css)
>>> fcgi process is spawned (if doesn't exist yet)
>>
>> unexpected
>>
>>>                                                                      and the
>>> counter "Accesses" on server-status page increments as well.
>>
>> expected
> Are you sure? I've probably described it wrong way, I meant Accesses
> counter of the corresponding fcgid worker (mod_fcgid status section)

you're right, I was thinking of the wrong accesses counter

>>
>>>
>>> I'm not sure if this is a bug, result of my wrong settings, or
>>> desired behavior, but it imho leads to quite poor performance.
>>> I use mpm_worker, gentoo linux, mod_fcgid 2.3.5, apache 2.2.15.
>>>
>>> Pieces of configuration I found relevant:
>>>
>>> In file: /etc/apache2/modules.d/20_mod_fcgid.conf
>>
>>> Options +ExecCGI
>>> AddHandler the-php .php
>>> Action the-php /mh-bin/php-wrapper.fcgi
>>
>> something more is needed to run static files through php; the other
>> directives are irrelevant
>>
>> (it is getting processed by php, right?  mod_fcgid can't handle static
>> file requests itself)
>
> If I insert PHP code into the static file (like <?php echo "something";
> ?>), it isn't processed, so it probably doesn't go through PHP
> interpreter. Maybe it doesn't go through fcgi worker at all. On the
> other hand, the speed of processing static files is imho quite poor
> (static file is servered 3x faster than PHP with DB).
>
> The mail reason why I began inspecting this problem is that static files
> "wakes" fcgi threads and prevents idle timeouts, spawns new threads and
> so. I would expect fcgid not serving static files (and ignoring them in
> fcgi process management!) at all.

Are the FastCGI processes which get created all PHP interpreters?

I can't tell from the individual directives you listed why it is going
through FastCGI.  I guess you don't have FcgidAccessChecker or
FcgidAuthenticator or FcgidAuthorizer anywhere?  You don't have a
SetHandler for the-php anywhere, and only the one AddHandler shown
above?

I think you're going to need to post real configuration, after you've
figured out everything you can remove from it while static files are
still passed through mod_fcgid.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_fcgid: fcgid processes serving static content as well

Posted by Honza Lefty Škoda <le...@multihost.cz>.
On 29.10.2010 19:08, Jeff Trawick wrote:
> 2010/10/28 Honza Lefty Škoda <le...@multihost.cz>:
>> Hi!
>>
>> I use mod_fcgid & suexec for safe execution of php scripts. I've
>> recently tested the performance of fcgid
>> and found out that when i request static page (.html or .css)
>> fcgi process is spawned (if doesn't exist yet)
> 
> unexpected
> 
>>                                                                      and the
>> counter "Accesses" on server-status page increments as well.
> 
> expected
Are you sure? I've probably described it wrong way, I meant Accesses
counter of the corresponding fcgid worker (mod_fcgid status section)
> 
>>
>> I'm not sure if this is a bug, result of my wrong settings, or
>> desired behavior, but it imho leads to quite poor performance.
>> I use mpm_worker, gentoo linux, mod_fcgid 2.3.5, apache 2.2.15.
>>
>> Pieces of configuration I found relevant:
>>
>> In file: /etc/apache2/modules.d/20_mod_fcgid.conf
> 
>> Options +ExecCGI
>> AddHandler the-php .php
>> Action the-php /mh-bin/php-wrapper.fcgi
> 
> something more is needed to run static files through php; the other
> directives are irrelevant
> 
> (it is getting processed by php, right?  mod_fcgid can't handle static
> file requests itself)

If I insert PHP code into the static file (like <?php echo "something";
?>), it isn't processed, so it probably doesn't go through PHP
interpreter. Maybe it doesn't go through fcgi worker at all. On the
other hand, the speed of processing static files is imho quite poor
(static file is servered 3x faster than PHP with DB).

The mail reason why I began inspecting this problem is that static files
"wakes" fcgi threads and prevents idle timeouts, spawns new threads and
so. I would expect fcgid not serving static files (and ignoring them in
fcgi process management!) at all.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_fcgid: fcgid processes serving static content as well

Posted by Jeff Trawick <tr...@gmail.com>.
2010/10/28 Honza Lefty Škoda <le...@multihost.cz>:
> Hi!
>
> I use mod_fcgid & suexec for safe execution of php scripts. I've
> recently tested the performance of fcgid
> and found out that when i request static page (.html or .css)
> fcgi process is spawned (if doesn't exist yet)

unexpected

>                                                                      and the
> counter "Accesses" on server-status page increments as well.

expected

>
> I'm not sure if this is a bug, result of my wrong settings, or
> desired behavior, but it imho leads to quite poor performance.
> I use mpm_worker, gentoo linux, mod_fcgid 2.3.5, apache 2.2.15.
>
> Pieces of configuration I found relevant:
>
> In file: /etc/apache2/modules.d/20_mod_fcgid.conf

> Options +ExecCGI
> AddHandler the-php .php
> Action the-php /mh-bin/php-wrapper.fcgi

something more is needed to run static files through php; the other
directives are irrelevant

(it is getting processed by php, right?  mod_fcgid can't handle static
file requests itself)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org