Re: Re: PHP programming strategy; lots of little include files, or a few big ones?
| From: | Robert Cummings | Date: | Fri, 08 Jan 2010 16:59:14 +0000 |
| Subject: | Re: Re: PHP programming strategy; lots of little include files, or a few big ones? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300916@lists.php.net to get a copy of this message | ||
clancy_1@cybec.com.au wrote:
On Thu, 07 Jan 2010 22:48:59 -0500, robert@interjinn.com (Robert Cummings) wrote:A particular cache of bytecode is usually pushed out of memory when the configured maximum amount of memory for the bytecode cache is about to be exceeded. Additionally, the particular cache that gets eliminated is usually the oldest or least used cache. Given this, and your purported usage patterns, your pages will most likely remain in the cache until such time as you update the code or restart the webserver.clancy_1@cybec.com.au wrote:Five times faster is certainly more attractive than twice as fast. But under what circumstances is this achieved? Unfortunately these days it is difficult to find any solid information on how things actually work, but my impression is that caches only work for pages which are frequently accessed. If this is correct, and (as I suspect) somebody looks at my website once an hour, the page will not be in the cache, so it won't help. Also one of the more popular parts of this website is my photo album, and for this much of the access time will be the download time of the photos. Furthermore as each visitor will look at a different set of photos, even with heavy access it is unlikely that any given photo would be in a cache.Thank you all for your comments. I did not know about bytecode caches. They're an interesting concept, but if I am interpreting the paper http://itst.net/654-php-on-fire-three-opcode-caches-compared correctly they only double the average speed of operation, which is rather less than I would have anticipated.I strongly advise that you take the time to try a bytecode cache. Within linux environments I am partial to eaccelerator. In IIS environments I now use WinCache from Microsoft. From my own observations with a multitude of different types of PHP web applications I find that the speed gain is closer to 5 times faster on average.
Despite these comments the access times for my websites seem to be pretty good -- certainly a lot better than many commercial websites -- but have a look at http://www.corybas.com/, and see what you think. (I am in the process of updating this, and know that the technical notes are not currently working, but there is plenty there to show you what I'm trying to do.)I'm not disputing your good enough statistics. I'm merely asserting that a bytecode cache will resolve your concerns about file access times when your code is strewn across many compartmentalized files. In addition, I am advising that it is good practice to always install a bytecode cache. One of the first things I do when setting up a new system is to ensure I put an accelerator in place. Once it's in place, no matter how many pages or sub sites I put up, the accelerator is already in place and providing benefits. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP