Have you noticed caching has becoming more and more prominent lately? I've been thinking about caching a lot lately and here are some of my thoughts on the subject.
What are the bottlenecks? Where is a PHP script slowed down?
Hardware:
Network
Hard Drive
Memory/Bus
CPU
Software:
Script
MySQL
PHP
Apache
OS
How does caching help eliminate these bottlenecks?
First by consolidating hard drive operations. Every included file is a hard drive operation. Consolidating included files means PHP is only compiling one file instead of two or even more.
Second by eliminating database queries. Every database query is a network/harddrive/Memory/CPU operation. Eliminating multiple database queries will eliminate the associate bottlenecks.
Third, by eliminating script processing. Static HTML is fast even going through the PHP engine.
Last, but the least obvious, by optimizing your code on a per page basis. Hmm... so if we can figure out how to do the first two or three ourselves maybe caching wouldn't be neccessary?
So why do we see caching turning up all over the place?
I think there is a trend happening, we started out programming every page as an individual entity. But somehow we are no longer programming pages but applications. The problem with this is PHP is still doing the something it always has - rendering a single page at a time. I'm I wrong?
PHP is still a scripting language, correct?
Read script
compile script to bytecode
execute bytecode/get another script/output some of the page
However, we are no longer treating it as a interpreted language but a compiled language. Which would definitely be wrong, yes? PHP only sees a page at a time everything else is just dead weight.
So what are your thoughts?
[ Moderators - I put this topic here because I have no idea where to put it? ]