Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Optimizing mod_fcgid configuration |
|
Author |
|
tbutler
Joined: 21 Apr 2021 Posts: 1 Location: Saint Louis, MO, USA
|
Posted: Wed 21 Apr '21 8:54 Post subject: Optimizing mod_fcgid configuration |
|
|
Hello,
I'm just getting into FastCGI to accelerate my Perl scripts (perhaps a couple of decades late, I know) and it has been working great so far with one big caveat: on pages where multiple AJAX requests may occur, the second request is orders of magnitude slower than the initial one (say 1.5 seconds versus 230 ms), regardless of which specific request is done second. After going through the code and watching where the delay occurs, I believe this is since they happen in an asynchronous fashion and Apache doesn't think the script has hit the appropriate "score" to have multiple child processes spawned. (Preventing the AJAX requests from occurring asynchronously proves a stopgap solution that confirms my theory -- the two requests performed serially are way faster than the two performed in parallel.)
Looking at the Apache directives for FastCGI, I suspect I need to set the spawn score lower, but I assume that might risk an excessive amount of spawning. Is there a way to set a default of, say, two (or some other wise number) FastCGI processes for the script (to help with parallel requests), but keep the overall score the same so that it doesn't needlessly spawn a bunch of additional child processes?
I have not modified FcgidMinProcessesPerClass from the default and the Apache documentation mentions the default is 3, which would make me think it should be willingly launching an additional process up to 3, but perhaps I'm misunderstanding what this directive does?
Here's my FastCGI configuration:
Code: | <IfModule fcgid_module>
FcgidIPCDir /run/mod_fcgid
FcgidProcessTableFile /run/mod_fcgid/fcgid_shm
AddHandler fcgid-script .fpl
# Basic configuration settings
FcgidMaxRequestLen 1073741824
MaxRequestsPerProcess 500
</IfModule> |
Do you have suggestions on how I might adjust these mod_fcgid settings to make it better address my issue (and/or simply improve the configuration generally)?
Thanks so much! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 22 Apr '21 21:31 Post subject: |
|
|
There are a lot of setting for mod_fcgid http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
I've never run perl over that. I can give your the config that as been proven to work with PHP.
Code: |
<IfModule fcgid_module>
FcgidMaxProcesses 300
FcgidMaxProcessesPerClass 300
FcgidOutputBufferSize 65536
FcgidConnectTimeout 10
FcgidProcessLifeTime 0
FcgidMaxRequestsPerProcess 0
FcgidMinProcessesPerClass 0
FcgidFixPathinfo 0
FcgidProcessLifeTime 0
FcgidZombieScanInterval 20
FcgidMaxRequestLen 536870912
FcgidIOTimeout 120
FcgidTimeScore 3
FcgidPassHeader Authorization
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/php7/php-cgi.exe" .php
</Files>
</IfModule>
|
Maybe that helps. |
|
Back to top |
|
|
|
|
|
|