[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mod_php vs fastcgi/php speed [BENCHMARK]


On Fri, 2004-03-19 at 06:42, Joris wrote:
> Hi,
> I'm looking for some in-depth information on the speed difference 
> between mod_php and using php-cgi with fastcgi.
> So far a google search has yielded nothing but unbacked statements (I'll 
> clean up the language a bit): "mod_php is a lot fast er than php-cgi", 
> and "fastcgi/php is a lot faster than mod_php". Not very usefull.
> Anyone care to shed some light/benchmarks here?
hhmm you made me curious, and I started a benchmark, here the results:

(btw the server is a P3 1ghz, 512MB RAM, Debian Woody)

Summary of the benchmark

PHP4 module, very simple script (phpinfo.php):			requests/s
plain				130.04
+turckcache			129.42
+turckcache+zend-optimizer	125.50

PHP4 module, very complex script (insurance application):			requests/s
plain				1.84
+turckcache			6.23
+turckcache+zend-optimizer	5.58
+optimizer			1.58

PHP4 CGI, very simple script (phpinfo.php):			requests/s
plain				22.69
+turckcache			n/a*
+turckcache+zend-optimizer	n/a*
+optimizer			21.23

PHP4 CGI, very complex script (insurance application):			requests/s
plain				2.00
+turckcache			n/a*
+turckcache+zend-optimizer	n/a*
+optimizer			1.72

* = turkcache doesn't support caching of the PHP scripts in CGI mode

> Also, experiences migrating from mod_php to (fast)cgi/php would be 
> welcome :)
migrating from mod to cgi is good as in security, but performance and
also problems with some scripts.

Those problems with scripts come from .htaccess files which try to
change things with "php_flag" (which is not possible with cgi).
Also sometimes script use variables like $_SERVER['SCRIPT_NAME'], they
get changed by cgi-handler apache things. They usually still work, but
its still different than before (with php_mod). E.g. with mod_php
SCRIPT_NAME is foo.php, with cgi its something like cgi-bin/php/foo.bar

If you use suPHP though (www.suphp.org), it will correct those $_SERVER

I hope this answered your questions

Mirco 'meebey' Bauer


Version: 3.12
GIT d s-: a--- C++ UL++>++++ P L++$>+++$ E W+++$ N o? K- w++>! O- M- V? PS
PE+ Y- PGP>++ t 5+ X++ R tv+ b+ DI? D+ G>++ e h! r>++ y?

Reply to: