Re: Re[2]: Accept() loop in php-fcgi?

Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Dear Igor,

I am pretty sure that my setup is correct.  To verify my setup, I
limit the php-fcgi children to 1, and I use strace to trace that child
process.  On the other terminal, I setup ab2 to get main.php twice:

ab2 -n 2 http://localhost/main.php

The attached strace file shows that each include file is
open/read/close twice.  Do you think PHP engine actually translates
everything into one unit before the intepretation or it works like a
bash interpreter reading and executing line by line?

Thanks,

Jonathan

* Igor <[email protected]> [2006-01-20 03:04]:
> Hello Jonathan,
> 
> Friday, January 20, 2006, 11:37:11 AM, you wrote:
> 
> JC> If my main php script is structured as follows:
> 
> JC> <?
> JC> include("include/include.1.inc");
> JC> include("include/include.2.inc");
> JC> include("include/include.3.inc");
> JC> ...
> JC> ...
> JC> include("include/include.100.inc");
> JC> echo("this is main.php");
> 
>     Logically it should work differently under Fast-CGI. If you're
>     right then either your PHP compilation does make includes at run-time - I doubt
>     that - or mod_fascgi doesn't work for PHP at all in your case
>     (that might be the case if you've not configured it)
>     
>     PHP includes were always slow, and if you have to design a huge,
>     nice yet modular system you got to keep it in mind, otherwise when
>     everything is ready - it won't work.
> 
>     Are you sure your PHP is working in fast-cgi mode?
>     
> JC> and all of the "include/include.`seq 1 100`.inc" php include files are
> JC> empty, then the one unit after translation should be equivalent to:
> 
> JC> <?
> JC> // empty
> JC> // empty
> JC> // empty
> JC> ...
> JC> // empty
> JC> echo("this is main.php");
> 
> >>
> 
> JC> However, from the benchmark under (mod_fastcgi + php-fcgi), a single
> JC> echo statement in php yields 1500+ requests per seconds performance
> JC> versus 200+ requests per second from a single echo statement plus 100
> JC> empty includes.
> 
>     Try the following:
>      - run a php fast-cgi script which does include some file
>      - when the script is loaded rename the inc file.
>      - open that PHP-fastcgi script via HTTP again and see if it does
>        require deleted inc file... it should not need it in
>        FastCGI mode unless PHP does run-time includes now - that would
>        be funny :-)
> 
> 
> JC> Obviously I may have done something wrong in the benchmark
> 
>     Rather in php-fastcgi configuration...
> 
> JC> methodology.  Could you please kindly provide an example that would
> JC> demostrate the benefit of time saved from compiling the files
> JC> (repeatedly)?
> 
>     You've done everything right, just make sure you've configured
>     PHP/fast-cgi correctly.
>     
> 
> -- 
> www.rol.ru
> Best regards,
>  Igor                            mailto:[email protected]
>

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
php5.0-fcgi.strace (text/plain, 146.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.