<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Apache + mod_php compared to Nginx + php-fpm</title>
	<atom:link href="http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/</link>
	<description>Un*x system engineering</description>
	<lastBuildDate>Mon, 30 May 2011 22:14:54 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: bostjan</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-18147</link>
		<dc:creator>bostjan</dc:creator>
		<pubDate>Mon, 30 May 2011 22:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-18147</guid>
		<description>@Phoenix:

I believe the number of processes are dictated by your site&#039;s max concurrent users you wish to handle which then dictates your hardware resources. If you are constrained then this is another matter, but unfortunately that was not the objective of this article.

About optimal performance, I would not recommend any exact numbers, but rather server metrics collection and graphing (Collectd is great at this) and based on those graphs you can make some additional decisions. But first you have to decide whether you are optimizing page load times (user experience) or server-side stuff (better overall performance of the server, but not necessarily better for users per se).

b.

PS: Did you use PHP-FPM which is included with PHP distribution as of lately?</description>
		<content:encoded><![CDATA[<p>@Phoenix:</p>
<p>I believe the number of processes are dictated by your site&#8217;s max concurrent users you wish to handle which then dictates your hardware resources. If you are constrained then this is another matter, but unfortunately that was not the objective of this article.</p>
<p>About optimal performance, I would not recommend any exact numbers, but rather server metrics collection and graphing (Collectd is great at this) and based on those graphs you can make some additional decisions. But first you have to decide whether you are optimizing page load times (user experience) or server-side stuff (better overall performance of the server, but not necessarily better for users per se).</p>
<p>b.</p>
<p>PS: Did you use PHP-FPM which is included with PHP distribution as of lately?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phoenix</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-18142</link>
		<dc:creator>Phoenix</dc:creator>
		<pubDate>Mon, 30 May 2011 20:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-18142</guid>
		<description>What a fantastic, and informative post. I have recently made the switch to nginx + php-frm + eaccelerator, so it&#039;s really nice to have this post. So far php-frm is performing well. But it would be great to have some learnings and best practices from these benchmarks -- as in, how many process workers should we set in php-fpm for best performance (based on amount of RAM or CPU cores, etc). Thanks!</description>
		<content:encoded><![CDATA[<p>What a fantastic, and informative post. I have recently made the switch to nginx + php-frm + eaccelerator, so it&#8217;s really nice to have this post. So far php-frm is performing well. But it would be great to have some learnings and best practices from these benchmarks &#8212; as in, how many process workers should we set in php-fpm for best performance (based on amount of RAM or CPU cores, etc). Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nginx + PHP-FPM + symfony &#8211; オレオレPHP環境 - BLABBER</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-16922</link>
		<dc:creator>Nginx + PHP-FPM + symfony &#8211; オレオレPHP環境 - BLABBER</dc:creator>
		<pubDate>Tue, 10 May 2011 16:01:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-16922</guid>
		<description>[...] 尚、ベンチ云々はググれば出てくる(Apache + mod_php compared to Nginx + php-fpmとか)と思いますので、そのへんはお任せしまして、環境構築した時のメモを記載します。環境はCentOSです。 [...]</description>
		<content:encoded><![CDATA[<p>[...] 尚、ベンチ云々はググれば出てくる(Apache + mod_php compared to Nginx + php-fpmとか)と思いますので、そのへんはお任せしまして、環境構築した時のメモを記載します。環境はCentOSです。 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zob</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-13865</link>
		<dc:creator>zob</dc:creator>
		<pubDate>Mon, 28 Mar 2011 14:41:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-13865</guid>
		<description>Disregard the use of SuEXEC. Its performance is plain abysmal. It&#039;s a nice thing to have but it&#039;s un-useable for performance/high traffic.

ITK MPM is much better in that case but not always what you want.

A third solution is something like mod_rsbac. It works with prefork MPM and mod_php, yet provide full virtualhost isolation (in fact, much better isolation any of the previous solution offers by a very long margin)

mod_rsbac is nearly the same performance as native prefork+mod_php, too</description>
		<content:encoded><![CDATA[<p>Disregard the use of SuEXEC. Its performance is plain abysmal. It&#8217;s a nice thing to have but it&#8217;s un-useable for performance/high traffic.</p>
<p>ITK MPM is much better in that case but not always what you want.</p>
<p>A third solution is something like mod_rsbac. It works with prefork MPM and mod_php, yet provide full virtualhost isolation (in fact, much better isolation any of the previous solution offers by a very long margin)</p>
<p>mod_rsbac is nearly the same performance as native prefork+mod_php, too</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bostjan</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-12627</link>
		<dc:creator>bostjan</dc:creator>
		<pubDate>Wed, 09 Mar 2011 12:47:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-12627</guid>
		<description>&quot;You benchmark suffers from this kind of starvation.&quot;

Thanks for the hint, you&#039;re probably right. Will retest it with larger PHP-FPM process pool.</description>
		<content:encoded><![CDATA[<p>&#8220;You benchmark suffers from this kind of starvation.&#8221;</p>
<p>Thanks for the hint, you&#8217;re probably right. Will retest it with larger PHP-FPM process pool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SaltwaterC</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-12626</link>
		<dc:creator>SaltwaterC</dc:creator>
		<pubDate>Wed, 09 Mar 2011 12:27:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-12626</guid>
		<description>Couple of notes though:

- from php-fpm.conf 16 - this limits the process pool to 16 processes for PHP-FPM while Apache can fork more children aka it can support better concurrency when the load is not CPU bound. This is the case for the HelloWorld.php test. The adaptive process spawning was implemented in PHP-FPM after the inclusion into the upstream PHP distribution, although the configuration file may state otherwise. This may be an unfair disadvantage for the PHP-FPM case. Most people say that Apache2+mod_php5 performs better for &quot;real world applications&quot;, but most of the time they forget to mention what&#039;s the exact level of concurrency stated by worker MPM vs the PHP-FPM process pool since a low number of processes into the PHP-FPM pool means that requests start to queue while the CPU basically is free for other stuff. You benchmark suffers from this kind of starvation.

- you may use an UNIX domain socket for the FastCGI protocol request / response transactions which avoids the TCP overhead that your tests has, even for the loopback interface that still needs to encapsulate / decapsulate the traffic, or fragment the information which is not uncommon for real world applications as the loopback MTU is just 16436.

About your longer answers, there are some things to consider:

- .htaccess comes with some added computational cost, therefore a properly configured Apache won&#039;t have this &quot;advantage&quot;. Apache is good for virtualhosting when the end client has access to the server configuration, but for an organization, that job should suit better a professional sysadmin.

- from the virtualhosting point of view, mod_php5 comes with a security issue &#039;by design&#039; when combined with worker MPM since by default any virtualhost can access the files hosted by another virtual host. ITK MPM would avoid that. PHP&#039;s safe_mode would avoid most of the issues as well, but that&#039;s a nasty hack that the PHP team is going to remove anyway into the next version. The other solution is FastCGI. Proper configuration with suEXEC, open_basedir and mod_fcgid has loads of fun under Apache. PHP-FPM has a much cleaner implementation since it binds a specific process pool to its own security context by design, not by hacking configuration files and creating FastCGI wrappers.

What can I say ... we ditched Apache from out production servers for quite a while. So far, nobody misses it.</description>
		<content:encoded><![CDATA[<p>Couple of notes though:</p>
<p>- from php-fpm.conf 16 &#8211; this limits the process pool to 16 processes for PHP-FPM while Apache can fork more children aka it can support better concurrency when the load is not CPU bound. This is the case for the HelloWorld.php test. The adaptive process spawning was implemented in PHP-FPM after the inclusion into the upstream PHP distribution, although the configuration file may state otherwise. This may be an unfair disadvantage for the PHP-FPM case. Most people say that Apache2+mod_php5 performs better for &#8220;real world applications&#8221;, but most of the time they forget to mention what&#8217;s the exact level of concurrency stated by worker MPM vs the PHP-FPM process pool since a low number of processes into the PHP-FPM pool means that requests start to queue while the CPU basically is free for other stuff. You benchmark suffers from this kind of starvation.</p>
<p>- you may use an UNIX domain socket for the FastCGI protocol request / response transactions which avoids the TCP overhead that your tests has, even for the loopback interface that still needs to encapsulate / decapsulate the traffic, or fragment the information which is not uncommon for real world applications as the loopback MTU is just 16436.</p>
<p>About your longer answers, there are some things to consider:</p>
<p>- .htaccess comes with some added computational cost, therefore a properly configured Apache won&#8217;t have this &#8220;advantage&#8221;. Apache is good for virtualhosting when the end client has access to the server configuration, but for an organization, that job should suit better a professional sysadmin.</p>
<p>- from the virtualhosting point of view, mod_php5 comes with a security issue &#8216;by design&#8217; when combined with worker MPM since by default any virtualhost can access the files hosted by another virtual host. ITK MPM would avoid that. PHP&#8217;s safe_mode would avoid most of the issues as well, but that&#8217;s a nasty hack that the PHP team is going to remove anyway into the next version. The other solution is FastCGI. Proper configuration with suEXEC, open_basedir and mod_fcgid has loads of fun under Apache. PHP-FPM has a much cleaner implementation since it binds a specific process pool to its own security context by design, not by hacking configuration files and creating FastCGI wrappers.</p>
<p>What can I say &#8230; we ditched Apache from out production servers for quite a while. So far, nobody misses it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edu</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-11824</link>
		<dc:creator>Edu</dc:creator>
		<pubDate>Fri, 25 Feb 2011 11:22:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-11824</guid>
		<description>good article!</description>
		<content:encoded><![CDATA[<p>good article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Teste de desempenho da página inicial do Magento no Nginx e Apache &#124; Magento NET</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-11375</link>
		<dc:creator>Teste de desempenho da página inicial do Magento no Nginx e Apache &#124; Magento NET</dc:creator>
		<pubDate>Fri, 18 Feb 2011 20:23:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-11375</guid>
		<description>[...] Segue abaixo um link com um teste de desempenho interessante. Ele mostra bem a diferença ente os dois servidores quando usados em grande escala. Ficou evidente que o ngin é muito superior em conteudo estático, enquanto o apache é melhor com scripts php. http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/ [...]</description>
		<content:encoded><![CDATA[<p>[...] Segue abaixo um link com um teste de desempenho interessante. Ele mostra bem a diferença ente os dois servidores quando usados em grande escala. Ficou evidente que o ngin é muito superior em conteudo estático, enquanto o apache é melhor com scripts php. <a href="http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/" rel="nofollow">http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Which web server architecture do you think is better?</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-7631</link>
		<dc:creator>Which web server architecture do you think is better?</dc:creator>
		<pubDate>Mon, 29 Nov 2010 13:24:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-7631</guid>
		<description>[...] am         Unreason People mostly use 1 on larger sites, but 2 is supposed to be good to. There are benchmarks, but most of them are synthetic or [...]</description>
		<content:encoded><![CDATA[<p>[...] am         Unreason People mostly use 1 on larger sites, but 2 is supposed to be good to. There are benchmarks, but most of them are synthetic or [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nils Eriksen</title>
		<link>http://blog.a2o.si/2009/06/24/apache-mod_php-compared-to-nginx-php-fpm/comment-page-1/#comment-4959</link>
		<dc:creator>Nils Eriksen</dc:creator>
		<pubDate>Mon, 20 Sep 2010 11:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.a2o.si/?p=65#comment-4959</guid>
		<description>If you have a small server. and running many concurrent. nginx, php-fpm does indeed utilize the overall hardware available much better than apache/mod_php.</description>
		<content:encoded><![CDATA[<p>If you have a small server. and running many concurrent. nginx, php-fpm does indeed utilize the overall hardware available much better than apache/mod_php.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

