Re: [PHP] PHP compared to JSP
I find caching to be extremely helpful. I have a complex property layer for my php based web engine/library. These properies have several levels of dependency and inheritance which can take as many as 15 queries to build. Then I cache the tree and it is reduced to a single query on subsequent page requests. Also I found a 30% load time improvement when I installed the PHPAccelerator compile cache which is excellent considering the amount of optimizations I have in my code. Thus to close I must say there are different types of caching to suit different needs and whether one or the other is suitable depends on what you want whether it makes sense to cache the data. Cheers, Rob. Manuel Lemos wrote: Hello, Sp wrote: Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. I have been doing that for quite some time and I can tell that it is not worthy to cache just database query results but rather the pages that are generated with the data that is returned with such queries. For that I have developed of a robust class that caches pages in files while it prevents that concurrent accesses update the cache files simultaneously to prevent corrupting the cached data. You may want to try getting it here: http://www.phpclasses.org/browse.html/package/313.html Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Hello, SP wrote: Thanks dude I'll take a look at it. How do you get around caching only certain parts of a page? No problem, just capture all the page output in a variable and feed it to the class. Regards, Manuel Lemos -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: May 5, 2002 4:01 PM To: Sp Cc: Miguel Cruz; Pag; Luc Saint-Elie Subject: Re: [PHP] PHP compared to JSP Hello, Sp wrote: Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. I have been doing that for quite some time and I can tell that it is not worthy to cache just database query results but rather the pages that are generated with the data that is returned with such queries. For that I have developed of a robust class that caches pages in files while it prevents that concurrent accesses update the cache files simultaneously to prevent corrupting the cached data. You may want to try getting it here: http://www.phpclasses.org/browse.html/package/313.html Regards, Manuel Lemos . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
On Sat, 4 May 2002, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Sometimes the developer knows how stale information can get before it needs to be refreshed. An awful lot of pages fetched with GET args are just straight-up retrievals from mostly-static databases, and can be cached with impunity. Also, there are other types of caching. On a multi-use machine that is busy with other stuff but not getting a lot of web traffic, httpd may have been paged out. And the PHP source file will be cached by the filesystem for a while after being read, saving subsequent repeat visits the delay of a disk operation. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP compared to JSP
Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. Plus if you are a crappy programmer then it would mask how slow your code is :-) -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 5, 2002 3:01 AM To: Pag Cc: Luc Saint-Elie; [EMAIL PROTECTED] Subject: Re: [PHP] PHP compared to JSP On Sat, 4 May 2002, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Sometimes the developer knows how stale information can get before it needs to be refreshed. An awful lot of pages fetched with GET args are just straight-up retrievals from mostly-static databases, and can be cached with impunity. Also, there are other types of caching. On a multi-use machine that is busy with other stuff but not getting a lot of web traffic, httpd may have been paged out. And the PHP source file will be cached by the filesystem for a while after being read, saving subsequent repeat visits the delay of a disk operation. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Food for thought... There are a lot of performance issues outside of PHP... MySQL - version 4.0.x supports caching... Apache 2.0 - is now threaded... Memory is now cheap... Increase the server's memory You may also want to consider Zends Optimizer and Accelerator if you need additional boost in performance. Or even write your appliation to generate the HTML pages and place it in the cron job to keep the data refreshed... Just my 2 cents... - Original Message - From: SP [EMAIL PROTECTED] To: Miguel Cruz [EMAIL PROTECTED]; Pag [EMAIL PROTECTED] Cc: Luc Saint-Elie [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, May 05, 2002 2:47 PM Subject: RE: [PHP] PHP compared to JSP Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. Plus if you are a crappy programmer then it would mask how slow your code is :-) -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: May 5, 2002 3:01 AM To: Pag Cc: Luc Saint-Elie; [EMAIL PROTECTED] Subject: Re: [PHP] PHP compared to JSP On Sat, 4 May 2002, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Sometimes the developer knows how stale information can get before it needs to be refreshed. An awful lot of pages fetched with GET args are just straight-up retrievals from mostly-static databases, and can be cached with impunity. Also, there are other types of caching. On a multi-use machine that is busy with other stuff but not getting a lot of web traffic, httpd may have been paged out. And the PHP source file will be cached by the filesystem for a while after being read, saving subsequent repeat visits the delay of a disk operation. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Hello, Sp wrote: Does anyone think caching should be built into php for it to edge out the competition? (like what smarty is doing) I mean a static page will always serve up faster then a dynamic one. Also even if you are getting 100 pages/sec on your database, you could cache it for 5 seconds and you save 500 accesses to your database. Yeah the page would be at most 5 seconds old but no one would know. I have been doing that for quite some time and I can tell that it is not worthy to cache just database query results but rather the pages that are generated with the data that is returned with such queries. For that I have developed of a robust class that caches pages in files while it prevents that concurrent accesses update the cache files simultaneously to prevent corrupting the cached data. You may want to try getting it here: http://www.phpclasses.org/browse.html/package/313.html Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP compared to JSP
Sorry if this is repeated, but I didn't see my query in the news group so reposting it ! --- Dear all, How is PHP similar to / different than JSP ? I mean, in JSP the page is compiled the first time it runs on the web-browser, then the next time it finds the .class file and just runs it. i.e. the compiling is just the first time !! How does it work in PHP? Does PHP has any way to figure out whether it's first time ? that is does PHP compile .php file to some .compiled_php type and then it gives the output ? Thanks a lot. Paras. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP compared to JSP
JSP does not ever run in the browser. JSP is a server side technology designed to compete with ASP. PHP is similar in that it too is a server side language and can be embedded into html pages. Java tends to be considerably slower than PHP but the Java folks have made great strides towards overcoming this. As far as compiling scripts, both Java and PHP are capable of doing this if the correct software is installed on the server. In PHP's case this is the Zend Optimizer - in the case of Java, I am not certain but I think this would require a Sun web server; both solutions cost $$$. However, as far as PHP is concerned there are many open source free caching solutions available. This is perhaps true for Java as well. Unless your site is going to get many users per second this is probably not necessary. Ultimately, running LAMP (Linux, Apache, MySQL and PHP) will cost less and is probably faster. Many solutions, to my knowledge, requiring Java cost $$$ while LAMP is completely Open source. (Read the licenses for more info). Matt Friedman -Original Message- From: Paras Mukadam [mailto:[EMAIL PROTECTED]] Sent: Saturday May 4, 2002 10:36 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP compared to JSP Sorry if this is repeated, but I didn't see my query in the news group so reposting it ! --- Dear all, How is PHP similar to / different than JSP ? I mean, in JSP the page is compiled the first time it runs on the web-browser, then the next time it finds the .class file and just runs it. i.e. the compiling is just the first time !! How does it work in PHP? Does PHP has any way to figure out whether it's first time ? that is does PHP compile .php file to some .compiled_php type and then it gives the output ? Thanks a lot. Paras. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Thanks for that ! But my question still remains the same ... does PHP alone (without ZEND) compile code into some .compiled_PHP file so that the user loading same page for 2nd time gets better response than the 1st time? Regards, Paras. Matt Friedman [EMAIL PROTECTED] wrote in message 001401c1f37c$6bc34c60$[EMAIL PROTECTED]">news:001401c1f37c$6bc34c60$[EMAIL PROTECTED]... JSP does not ever run in the browser. JSP is a server side technology designed to compete with ASP. PHP is similar in that it too is a server side language and can be embedded into html pages. Java tends to be considerably slower than PHP but the Java folks have made great strides towards overcoming this. As far as compiling scripts, both Java and PHP are capable of doing this if the correct software is installed on the server. In PHP's case this is the Zend Optimizer - in the case of Java, I am not certain but I think this would require a Sun web server; both solutions cost $$$. However, as far as PHP is concerned there are many open source free caching solutions available. This is perhaps true for Java as well. Unless your site is going to get many users per second this is probably not necessary. Ultimately, running LAMP (Linux, Apache, MySQL and PHP) will cost less and is probably faster. Many solutions, to my knowledge, requiring Java cost $$$ while LAMP is completely Open source. (Read the licenses for more info). Matt Friedman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
At 11:07 04/05/2002 -0500, Paras Mukadam wrote: Thanks for that ! But my question still remains the same ... does PHP alone (without ZEND) compile code into some .compiled_PHP file so that the user loading same page for 2nd time gets better response than the 1st time? Hello, Both have nothing reallyr elated (as strange as it sounds) Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided Luc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
But my question still remains the same ... does PHP alone (without ZEND) compile code into some .compiled_PHP file so that the user loading same page for 2nd time gets better response than the 1st time? No, it doesnt. Every time a user accesses a page that has PHP, the page will be built on the spot. (server side) Its extremely fast so no delays whatsoever. More figurately, you have a webpage with the PHP code somewhere in it, if a user requests to view it, the server generates the code, builds the page, delivers it to the user and still keeps the original PHP code for the next user, going over it again, dynamically. Sorry if i cant explain this very well. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
In PHP programming this can be a complex issue. An excellent example of caching or re-handling data is the Smarty Template Engine, http://www.phpinsider.com/php/code/Smarty/ . It may seem a rather redundant idea to cache and create scripts in PHP which is already part of the HTML documents, but for highly complex sites this can become a necessity! jess. On Saturday, May 4, 2002, at 11:18 AM, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Caching is not going against PHP as long as whenever the file is changed of the 1st access it would be cached, rather then caching php scripts based on some arbitrary timer. Ideally the caching script would on the 1st access of the script convert the script to binary code which can then be executed right away without needing to pass through an interpreter. Just like you would run a compiled C program. I suspect such caching solution would greatly boost the speed of any PHP page. Unfortunately, as far as I know no current PHP caching solution does this. Ilia On May 4, 2002 12:18 pm, Pag wrote: Does PHP compile : NO Does the user loading same page for 2nd time gets better response : YES it can if caching is provided On a side not..isnt caching a bit like going against why PHP was built in the first place? I mean, information may get a bit out of date if we get a page on the cache instead of getting it fresh from the server. Pag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP compared to JSP
Ilia A. wrote: Caching is not going against PHP as long as whenever the file is changed of the 1st access it would be cached, rather then caching php scripts based on some arbitrary timer. Ideally the caching script would on the 1st access of the script convert the script to binary code which can then be executed right away without needing to pass through an interpreter. Just like you would run a compiled C program. I suspect such caching solution would greatly boost the speed of any PHP page. Unfortunately, as far as I know no current PHP caching solution does this. It's not PHP's place to do this. Currently, it would be Zend's place to do this, as they have somewhat of a monopoly on the PHP engine. Obviously not a monopoly like, well, MS, but there's not any notable support or demand for alternative PHP engines. Current caches cache the zend 'opcodes' (as far as I can tell), and the Zend engine translates to machine code during execution. If anything was to do this, that's the place where it would/should happen. I'd read about someone planning a PHP - C compiler, but haven't seen anything on it yet. This might alleviate speed problems for people (although it would introduce a longer write/compile/test cycle). Michael Kimsal http://www.logicreate.com/ 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php