• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How to: tune php-cgi on high-traffic servers

MislavO

Regular Pleskian
Hello all. I'm in proccess of tunning services this days and i've tryed few configurations and so far i've seen that sites on server are loading faster and i got same feedback from clients, but there are still some issues.

So i've read many articles here and on Internet, just few of them are

and many others. Anyway, so far mysql is fine, but currently i'm very interested in tunning php-cgi. At the moment my fcgid.conf have:
<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
AddHandler fcgid-script fcg fcgi fpl
</IfModule>

FcgidIPCDir /var/lib/apache2/fcgid/sock
FcgidProcessTableFile /var/lib/apache2/fcgid/shm

FcgidProcessLifeTime 1000

# Maximum number of PHP processes.
FcgidMaxProcesses 1000
FcgidMaxProcessesPerClass 100
FcgidMinProcessesPerClass 0
FcgidConnectTimeout 60

# Number of seconds of idle time before a process is terminated
FcgidIOTimeout 1000
FcgidIdleTimeout 240
FcgidInitialEnv RAILS_ENV production
FcgidIdleScanInterval 20

# Maximum requests a process handles before it is terminated
FcgidMaxRequestsPerProcess 1500
FcgidMaxRequestLen 10737418

</IfModule>

With this settings i see difference and i guess i'm on good path (Note: this are only current settings, i'm changing them every few days and trying some combinations - https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html - old/new values).

Some of this settings should be improved because i noticed that in some parts of day (probably high traffic/a lot of requests/visitors) websites are loading slower - some of them can't even get request from server and after like 60sec i get error 503). What i've found in logs is this:
mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper

I've tryed to open this file, but it's crypted.

So in short:
1) do you have any suggestions how to improve fcgid.conf, i guess there are people who have more experience and knowledge with high traffic servers
2) note that problem with websites is always the FIRST request, when websites is loading for the first time, after that, everything goes smooth and clear
3) does anyone had problems with :
mod_fcgid: can't apply process slot for /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
I found almost nothing about this one, should i contact plesk support since file is crypted?
4) NGINX is not enabled on server (there are still some problem, i will have to contact plesk support about this).


If needed i can write server hardware configuration.
 
Have you tried installing a caching engine, like APC or Memcache ..These can greatly improve your speeds.
 
Back
Top