DEBATE on PHP-FPM I feel that it's a layer on top of an other layer

is PHP-FPM a good thing ?

  • no

    Votes: 0 0.0%
  • n/a

    Votes: 0 0.0%
  • some hitman will be put on my head if I speaks against it

    Votes: 0 0.0%

  • Total voters
    3
Operating System & Version
Centos 7 and 8
cPanel & WHM Version
96

Jintor

Member
Jul 14, 2021
7
0
1
Canada
cPanel Access Level
Root Administrator
I would like your opinion on PHP-FPM...

I was wondering why PHP-FPM is so popular ???

Sorry for worshippers of PHP-FPM, but I don't get it...

I had only BAD, super BAD, and more than TERRIBLE outcome with that installed.

In my server (Centos 7 + PHP 8 + latest WHM...) I had many time the cpu goes 1100% crazy WITHOUT END seeing php-fpm in top.... (note; same issues with php 7)

** the moment I completely uninstalled it : boom, wow, my site was 10x faster.... I don't get it because PHP-FPM seems to me that it's a layer on top of PHP (extra computation). [in EasyApache4 uncheck it in php extensions]

In my case I need file upload and that php don't use www as a user....

I also disabled output buffer and gzip compression... because some of my script could take long to finish and I need to output live (while processing implicit flush echos...)

You'll wonder why ?

1 example you could be familiar with : if a user upload a .mov, ffmpeg needs to convert it. ffmpeg can take time, so with php is quite easy to echo stuff while shell_exec is performing.

an other simple example echo '1'; sleep(3);echo '2'; sleep(3);echo '3'; sleep(3);

that simple lines : (output buffer off and implicit flush on)

• with PHP-FPM : I wait, wait then 1 2 wait wait 3 like it was exhausted of running....

• without PHP-FPM : NO wait : 1, normal 3sec, 2, normal 3sec, 3

with PHP-FPM I was feeling like if the server was suffering to output stuff.

without PHP-FPM ; no wait just plain flow, right away, TTFB WAY WAY WAY smaller, etc

*** also good to note : PHP-FPM installed and put to off => same blocking feeling, I really had to yum remove it to get the full raw speed.

when I see : PHP-FPM is PHP's FastCGI implementation. In this setup, PHP-FPM runs as a standalone FastCGI server and Apache connects to it using FastCGI modules, such as mod_fcgid, mod_fastcgi or mod_proxy_fcgi (Apache 2.4+). In this configuration, permissions, processes related stuff & everything else is controlled by the PHP-FPM server. Performance is comparable with mod_php.

it kind of give me the creeps

I just want opinions....
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,951
920
313
cPanel Access Level
Root Administrator
Hey there! PHP-FPM does get enabled on servers running the WordPress Toolkit software, so there are likely many users running it that don't even notice.

It could be that your particular machine doesn't have enough resources to properly run PHP-FPM, as we require at least 2G of RAM, or 30M of RAM per domain on the machine, for that to be an efficient service. Details on the configuration values are outlined here:


I'm not sure if "it is a good thing" is the first question to ask - since it's included with cPanel we've already determined that users want/need it, and it works well with the product. I think a better question would be "is PHP-FPM for everyone" and the answer to that question is almost certainly "no"
 

Jintor

Member
Jul 14, 2021
7
0
1
Canada
cPanel Access Level
Root Administrator
Hi @cPRex ,

Wordpress is not a good example because I prefer creating my own library from scratch.
( over the years, I've tried other libs, but with my homemade ones, I always get better performance )

for argument sake let's stay with the most basic example :

index.php with the following : <?php echo 1; sleep(3); echo 1; sleep(3); echo 1; sleep(3); echo 1; sleep(3); echo 1; sleep(3); echo 1; ?> // no ob_start, flush, ob_flush....
for this example : php.ini have output_buffer to off and implicit_flush on

** in real world it would be more like move_uploaded_file stuff then shell_exec(ffmpeg....) nested within a while loop that echos status every x seconds.....

I tested many configurations : even 8 CPU with 16 GIG RAM with SSD (all the good stuff) dedicated servers.....

What I noticed during ALL tests I performed is the following :
•• NO matter what CPU, RAM, Disk (even 1cpu vs 16 cpu)
when I hit index.php 3 scenarios :
••1•• php-fpm present in the server (installed and set to on) => I wait, wait, then 12, after it's a bit ok, wait 3, then 3, wait 3 than 4
••2•• php-fpm present in the server (installed and set to off) => I wait, wait, then 12, after it's a bit ok, wait 3, then 3, wait 3 than 4 ==>> the EXCAT SAME on or off have the same issue
••3•• php-fpm completely removed WHM tells me php-fpm "unavailable" => NO wait : 1, then wait 3, 2 wait 3, and so on


Do you see a bit more clearer my point ?

Just the fact that php-fpm exists in the server => there is a wait.


**** an other point : one of my site is a RSS aggregator... some rss feed points to images that don't exists, => when that happens, php-fpm hang and CPU goes 1000% without stop (if you have access to consult tickets see ID : 94334980 ) A level 2 pointed out this "It is possible that this is simply being held open which is causing the load and the process to never complete."
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,951
920
313
cPanel Access Level
Root Administrator
WordPress was just one example I picked to indicate that many users probably have PHP-FPM running and may not even know it, as the WordPress Toolkit tools are dependent on PHP-FPM.

I know there was a large amount of performance testing done on our side before PHP-FPM was released, but I don't have any specific data I can share in that regard.

Our technician in ticket 94334980 also determined that the scripts in question had been running for several hours and recommended reviewing those to see if they are working as intended.
 

Handssler Lopez

Well-Known Member
Apr 30, 2019
65
20
8
Guatemala
cPanel Access Level
Root Administrator
I just add that on different servers running the latest version of cPanel + cloudlinux or centos7 + cpanel I decided to use php-fpm since almost all accounts use cms like joomla / worpress / prestashop / drupal, etc.

Actually, if there is an improvement in the speed of loading and execution of the sites when activating fpm, logically the configuration was adjusted based on the needs and resources of each server.

* I have another server where I don't run fpm as it performs better without fpm

as I mentioned @cPRex it is best to evaluate when to use php-fpm or not.
 
  • Like
Reactions: cPRex