Re: fastcgi-developers Digest, Vol 36, Issue 19
"mirkos" <mirkos-Ts0aPfm7q/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Organization | BIK |
| Message-ID | <000901c61fe4$5610e470$0600000a@BIK01> |
----- Original Message ----- From: <fastcgi-developers-request-xGejAJT2w6yOE5Ap4OspEtHuzzzSOjJt@public.gmane.org> To: <fastcgi-developers-xGejAJT2w6yOE5Ap4OspEtHuzzzSOjJt@public.gmane.org> Sent: 22. januar 2006 18:00 Subject: fastcgi-developers Digest, Vol 36, Issue 19 Send fastcgi-developers mailing list submissions to fastcgi-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org To subscribe or unsubscribe via the World Wide Web, visit http://fastcgi.com/fastcgi-developers/listinfo.cgi/fastcgi-developers or, via email, send a message with subject or body 'help' to fastcgi-developers-request-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org You can reach the person managing the list at fastcgi-developers-owner-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org When replying, please edit your Subject line so it is more specific than "Re: Contents of fastcgi-developers digest..." Today's Topics: 1. Re: Re: Accept() loop in php-fcgi? (Jonathan Chen) 2. Re: Accept() loop in php-fcgi? (Jonathan Chen) 3. Re: Accept() loop in php-fcgi? (Joachim Durchholz) 4. Re[4]: [FASTCGI] as always - manual is not for IT (Igor) 5. Re[2]: [FASTCGI] Accept() loop in php-fcgi? (Jack L) 6. Re: Accept() loop in php-fcgi? (Jonathan Chen) 7. Re: as always - manual is not for IT (Jonathan Chen) ---------------------------------------------------------------------- Message: 1 Date: Fri, 20 Jan 2006 15:28:17 -0800 From: Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]> Subject: Re: [FASTCGI] Re: Accept() loop in php-fcgi? To: Nikolay Ananiev <[email protected]> Cc: [email protected] Message-ID: <20060120232817.GC14264-z0t8KZiULAH2/[email protected]> Content-Type: text/plain; charset=big5 Dear Nikolay, I have observed 5-10x performance gain on fastcgi-capable perl scripts. It's tricky to see where the performance gain actually came from on php. With heavy php scripts running within mod_php, is it safe to say under high load, Apache has to fork many children to run mod_php and the overhead of forking and back-logging on Apache is more significant than doing them on stand-alone php processes over fastcgi? 30% or 40% would be a satisfactory mark, but so far my experiments show php-fastcgi is about 10% slower than mod_php. Thanks, Jonathan * Nikolay Ananiev <[email protected]> [2006-01-20 05:05]: > There is no Accept loop in php, but there must be a performance gain. I > don't know how you calculate it and I haven't done it personally, > but what I read on the Zeus and lighttpd sites there seems to be %30 to > %40 > gain in speed. Maybe the gain is outside the script so you > can't measure it inside php. > > "Jonathan Chen" <ccchen-z0t8KZiULAH2/[email protected]> > wrote in message news:20060119211003.GA23946-z0t8KZiULAH2/9iHc7UuXHrh/kl/[email protected] > Hi, > > Recently I moved some of my php scripts from running on mod_php to > (mod_fastcgi + php-fcgi) under Apache; hoping to see some gains on > performance, however, I observed that having (mod_fastcgi + php-fcgi) > brings almost no benefit. On the other hand, the equivalent perl > script runs 10x faster on (mod_fastcgi + perl). > > On perl, I convert a script like: > > #!/usr/bin/perl > > use XXX; # heavy initialization stuff > > print(¡§Content-type: text/html\n\n¡¨); # start of response > print(¡§Serving request...¡¨); > > to fastcgi script like: > > #!/usr/bin/perl > > use FCGI; > use XXX; # heavy initialization stuff > > while(FCGI::accept() >= 0) { > print(¡§Content-type: text/html\n\n¡¨); # start of response > print(¡§Serving request...¡¨); > } > > I am wondering if there is a notion of FCGI::accept() loop in php > semantics? It seems like php-fcgi implements the accept() outside of > the php scripts, which makes me unable to seperate the heavy > initialization part from the response part. > > Any ideas? > > Thanks, > > Jonathan > > > > ---------------------------------------------------------------------------- > ---- > > > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ > > > > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ ------------------------------ Message: 2 Date: Fri, 20 Jan 2006 15:31:41 -0800 From: Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]> Subject: Re: [FASTCGI] Accept() loop in php-fcgi? To: Joachim Durchholz <jo-JN0m9dTiHHGb9/[email protected]> Cc: [email protected] Message-ID: <20060120233141.GD14264-z0t8KZiULAH2/[email protected]> Content-Type: text/plain; charset=us-ascii Dear Joachim, Interesting, let me make a script that spits out Google's homepage, and I will come back with some numbers. Oh, just to remind us that neither mod_php or php-fastcgi use any accelerators. Thanks, Jonathan * Joachim Durchholz <jo-JN0m9dTiHHGb9/[email protected]> [2006-01-20 05:27]: > Jonathan Chen schrieb: > >Recently I moved some of my php scripts from running on mod_php to > >(mod_fastcgi + php-fcgi) under Apache; hoping to see some gains on > >performance, however, I observed that having (mod_fastcgi + php-fcgi) > >brings almost no benefit. > > There no performance benefit to be gained that way. The speedups occur > if you go from php-cgi to mod_fastcgi+php-fcgi. > > >I am wondering if there is a notion of FCGI::accept() loop in php > >semantics? It seems like php-fcgi implements the accept() outside of > >the php scripts, which makes me unable to seperate the heavy > >initialization part from the response part. > > That's indeed the case. PHP does the accept() loop for you. It's > tailored towards making the fcgi environment as invisible as possible to > the script. > > php-fcgi is also rumored to do the heavy initialisation part for your; > at least that's what I infer from rumors that it caches compiled code > from one invocation of a script to the next. > > Summing it up, I'd try a comparison that spits out a few lines of actual > HTML (the more, the more realistic), and measure the times not only for > a single run but for (say) a dozen runs. > > It would be interesting to read your findings here. > > Regards, > Jo > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ ------------------------------ Message: 3 Date: Fri, 20 Jan 2006 11:46:16 +0100 From: Joachim Durchholz <jo-JN0m9dTiHHGb9/[email protected]> Subject: Re: [FASTCGI] Accept() loop in php-fcgi? To: [email protected] Message-ID: <43D0BF78.4090606-JN0m9dTiHHGb9/[email protected]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Jonathan Chen schrieb: > Oh, just to remind us that neither mod_php or php-fastcgi use any > accelerators. You'll get skewed numbers if mod_php uses and php-fcgi doesn't. (Or vice versa.) (Fortunately, I've been able to avoid that topic.) Regards, Jo ------------------------------ Message: 4 Date: Fri, 20 Jan 2006 14:01:44 +0300 From: Igor <[email protected]> Subject: Re[4]: [FASTCGI] as always - manual is not for IT To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=us-ascii Hello Jonathan, Saturday, January 21, 2006, 2:16:27 AM, you wrote: JC> I am pretty sure that my setup is correct. To verify my setup, I JC> limit the php-fcgi children to 1, and I use strace to trace that child JC> process. On the other terminal, I setup ab2 to get main.php twice: JC> ab2 -n 2 http://localhost/main.php JC> The attached strace file shows that each include file is JC> open/read/close twice. JC> Do you think PHP engine actually translates Read this: http://us3.php.net/manual/en/function.require.php and even more specific information on how PHP's includes work is available here: http://us3.php.net/manual/en/function.require-once.php "statement includes and evaluates the specified file during the execution of the script" the key words are "during the execution" So much for PHP... That means that even in FastCGI mode PHP will continue to spend time on making useless includes each time a script is invoked. This appears to be the one big difference between PHP and Perl interpreters (or at least of fastcgi for the both languages). Perl will optimize the code before it starts it. Even if you use "require" not "use" in Perl script header, when fascgi is started you may delete the required module and it won't be required until the fastcgi process is alive or there is no new fascgi server to start. The drawback of this approach is a relatively slow start (I think Perl has some kind of a preprocessor). May be PHP developers consciously built this behavior in the PHP's design to speed it up. I only wish there were an alternative to this default behavior in PHP. This behavior might give some ground for the following assumption: Perl in Fast-CGI mode works even faster than PHP in any mode. It appears that if you're expecting performance gain of PHP fast-cgi - do not seek it in include optimization. PHP's includes are proved to be slow and inefficient in many ways and this Fast-CGI issue. Sorry, for propagating the wrong ideas about PHP's includes working faster in FastCGI mode. Obviously the assumption was not correct. JC> everything into one unit before the intepretation or it works like a JC> bash interpreter reading and executing line by line? Try require, the chances are low that it will work differently but you may try it anyway. -- www.rol.ru Best regards, Igor mailto:[email protected] ------------------------------ Message: 5 Date: Fri, 20 Jan 2006 08:43:32 -0500 From: Jack L <jlist9-FFYn/[email protected]> Subject: Re[2]: [FASTCGI] Accept() loop in php-fcgi? To: Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]> Cc: [email protected] Message-ID: <518632122.20060120084332-FFYn/[email protected]> Content-Type: text/plain; charset=us-ascii Hello Jonathan, > Oh, just to remind us that neither mod_php or php-fastcgi use any > accelerators. Do you mean that they don't support accelerators or accelerators are not used in your set up? Thanks, Jack ------------------------------ Message: 6 Date: Sat, 21 Jan 2006 13:37:58 -0800 From: Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]> Subject: Re: [FASTCGI] Accept() loop in php-fcgi? To: Jack L <jlist9-FFYn/[email protected]> Cc: [email protected] Message-ID: <20060121213758.GA23796-z0t8KZiULAH2/[email protected]> Content-Type: text/plain; charset=us-ascii Dear Jack, mod_php supports Zend Optimizer and phpa. I am not sure about php-fcgi. To have a fair test, I chose not to use php accelerators in the test. Thanks, Jonathan * Jack L <jlist9-FFYn/[email protected]> [2006-01-20 19:26]: > Hello Jonathan, > > > Oh, just to remind us that neither mod_php or php-fastcgi use any > > accelerators. > > Do you mean that they don't support accelerators or > accelerators are not used in your set up? > > Thanks, > Jack > ------------------------------ Message: 7 Date: Sun, 22 Jan 2006 10:39:24 -0800 From: Jonathan Chen <ccchen-z0t8KZiULAH2/[email protected]> Subject: Re: [FASTCGI] as always - manual is not for IT To: Igor <[email protected]> Cc: [email protected] Message-ID: <20060122183924.GA26894-z0t8KZiULAH2/[email protected]> Content-Type: text/plain; charset=us-ascii Dear Igor, require() is as the same as include(). The test numbers are the same. Thanks, Jonathan > Try require, the chances are low that it will work differently but > you may try it anyway. > > > -- > www.rol.ru > Best regards, > Igor mailto:[email protected] > ------------------------------ _______________________________________________ fastcgi-developers mailing list fastcgi-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org http://fastcgi.com/fastcgi-developers/listinfo.cgi/fastcgi-developers End of fastcgi-developers Digest, Vol 36, Issue 19 ************************************************** ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/