fastcgi和fpm有什么区别?

时间:2022-10-27 22:34:38

I am trying to install php with fpm on macports. I read somewhere that fpm means FastCGI process manager. Does that mean fastcgi and fpm are same? If they are same, then why do we have two different macports variants for php namely "php5 +fastcgi" and "php5 +fpm"

我正在尝试在macports上安装带有fpm的php。我在某处读到fpm意味着FastCGI过程管理器。这意味着fastcgi和fpm是一样的吗?如果它们是相同的,那么为什么php有两个不同的macports变体,即php5 +fastcgi和php5 +fpm

2 个解决方案

#1


72  

FPM is a process manager to manage the FastCGI SAPI (Server API) in PHP.

FPM是一个过程管理器,用于管理PHP中的FastCGI SAPI(服务器API)。

Basically, it replaces the need for something like SpawnFCGI. It spawns the FastCGI children adaptively (meaning launching more if the current load requires it).

基本上,它取代了对SpawnFCGI这样的需求。它自适应地生成FastCGI子代(如果当前负载需要,这意味着启动更多子代)。

Otherwise, there's not much operating difference between it and FastCGI (The request pipeline from start of request to end is the same). It's just there to make implementing it easier.

否则,它与FastCGI之间的操作差异不大(从请求开始到结束的请求管道是相同的)。它只是为了使实现变得更容易。

#2


43  

What Anthony says is absolutely correct, but I'd like to add that your experience will likely show a lot better performance and efficiency (due not to fpm-vs-fcgi but more to the implementation of your httpd).

Anthony所说的是绝对正确的,但是我想补充一点,您的经验可能会显示出更好的性能和效率(不是因为fpm-vs-fcgi,而是因为您的httpd实现)。

For example, I had a quad-core machine running lighttpd + fcgi humming along nicely. I upgraded to a 16-core machine to cope with growth, and two things explided: RAM usage, and segfaults. I found myself restarting lighttpd every 30 minutes to keep the website up.

例如,我有一台运行lighttpd + fcgi的四核机器。我升级到一台16核的机器以应付增长,并且有两件事被删除:RAM的使用和seg。我发现自己每隔30分钟就重新启动一次lighttpd,以保持网站的正常运行。

I switched to php-fpm and nginx, and RAM usage dropped from >20GB to 2GB. Segfaults disappeared as well. After doing some research, I learned that lighttpd and fcgi don't get along well on multi-core machines under load, and also have memory leak issues in certain instances.

我切换到php-fpm和nginx,内存使用从>20GB减少到2GB。这种错误消失了。在做了一些研究之后,我了解到lighttpd和fcgi在多核机器的负载下并不是很好,在某些情况下也存在内存泄漏问题。

Is this due to php-fpm being better than fcgi? Not entirely, but how you hook into php-fpm seems to be a whole heckuva lot more efficient than how you serve via fcgi.

这是因为php-fpm比fcgi好吗?不完全是,但是你如何与php-fpm挂钩,似乎比你如何通过fcgi服务要有效率得多。

#1


72  

FPM is a process manager to manage the FastCGI SAPI (Server API) in PHP.

FPM是一个过程管理器,用于管理PHP中的FastCGI SAPI(服务器API)。

Basically, it replaces the need for something like SpawnFCGI. It spawns the FastCGI children adaptively (meaning launching more if the current load requires it).

基本上,它取代了对SpawnFCGI这样的需求。它自适应地生成FastCGI子代(如果当前负载需要,这意味着启动更多子代)。

Otherwise, there's not much operating difference between it and FastCGI (The request pipeline from start of request to end is the same). It's just there to make implementing it easier.

否则,它与FastCGI之间的操作差异不大(从请求开始到结束的请求管道是相同的)。它只是为了使实现变得更容易。

#2


43  

What Anthony says is absolutely correct, but I'd like to add that your experience will likely show a lot better performance and efficiency (due not to fpm-vs-fcgi but more to the implementation of your httpd).

Anthony所说的是绝对正确的,但是我想补充一点,您的经验可能会显示出更好的性能和效率(不是因为fpm-vs-fcgi,而是因为您的httpd实现)。

For example, I had a quad-core machine running lighttpd + fcgi humming along nicely. I upgraded to a 16-core machine to cope with growth, and two things explided: RAM usage, and segfaults. I found myself restarting lighttpd every 30 minutes to keep the website up.

例如,我有一台运行lighttpd + fcgi的四核机器。我升级到一台16核的机器以应付增长,并且有两件事被删除:RAM的使用和seg。我发现自己每隔30分钟就重新启动一次lighttpd,以保持网站的正常运行。

I switched to php-fpm and nginx, and RAM usage dropped from >20GB to 2GB. Segfaults disappeared as well. After doing some research, I learned that lighttpd and fcgi don't get along well on multi-core machines under load, and also have memory leak issues in certain instances.

我切换到php-fpm和nginx,内存使用从>20GB减少到2GB。这种错误消失了。在做了一些研究之后,我了解到lighttpd和fcgi在多核机器的负载下并不是很好,在某些情况下也存在内存泄漏问题。

Is this due to php-fpm being better than fcgi? Not entirely, but how you hook into php-fpm seems to be a whole heckuva lot more efficient than how you serve via fcgi.

这是因为php-fpm比fcgi好吗?不完全是,但是你如何与php-fpm挂钩,似乎比你如何通过fcgi服务要有效率得多。