PHP 4.0: Dynamic Content for the Web Warrior - page 3
PHP 4: A Vast ImprovementWhat should be immediately clear is that php4 shows a dramatic similarity (at least in my application) to static html files--something I would never have expected at all. Our news_story page includes several fairly complex function files, some includes for content, and a portion of the main newswire, as well as an array of data from the main newswire. In other words, our story pages are kind of like mini index pages in and of themselves--in addition to the story and talkback content.
The penalty for dynamic content using PHP version 4 in this rough benchmark was only 12 percent--and that's unoptimized as well. Optimized the penalty drops to an almost unbelievable 4.6 percent. In fact, some of the optimized php4 dynamic runs were faster than the static page runs. Clearly, this was a major surprise for me.
I have to admit that at this point, I was pretty much blown away. The HTML file used in this example had no include files whatsoever--it was strictly one static file, and a good example of serving content at the fastest speed possible. For the curious, ad banners were not being served from remote locations, so all of the content was coming from my internal servers, and the site operation was an identical configuration to the Linux Today's servers that are in-use. The static file size was 373062 bytes--a real porker for a Linux Today story in my opinion.
Slicing and Dicing
Slicing the data another way, subtracting the static times from the dynamic times for each server, and comparing the results, the noticeable improvement on my end could be gauged at roughly 476 percent, or over 4 and a half times faster for unoptimized pages. For optimized pages, the difference is a staggering 1250 percent or roughly 12 and a half times faster.
The claim by the Zend folks is that for complex scripts PHP 4 provides performance improvements in speed by a factor of anywhere between 5 and 200 times. I'd have to say that from my experiences, this isn't at all unrealistic.
Trials and Tribulations
I can only find good things to say about this upgrade. All of my existing code has worked without a hitch. When you factor in the speed improvement, it's like getting a free lunch.
I did have some small problems during installation, but it turned out that I wasn't Reading The Fine Manual that they had included. I have an install script that worked with PHP version 3 that created a static httpd with the php3 module and mysql support, but I'll have to rewrite that now, I guess.
As for future improvements, there are some interesting things to consider. If you study how the Zend engine works, you'll find that it's compiling the code on the fly each time a page is accessed.
At ApacheCon this past year I met Zeev--a terrific guy, I must add--and after seeing the new PHP model, I asked him if the object code from page accesses was being cached (in other words, after the page gets compiled, does PHP save it so that the next time the page is accessed it won't have to do it again). The answer: not yet, but he knew of someone out there who was doing it, and it might eventually be included in the code.
Clearly there's another step here, and it doesn't stretch the imagination to see the product getting there. In the meantime, what an improvement! It would be incredibly cool if the next major upgrade to PHP provided some way to provide content at faster speeds than static files, wouldn't it?
I can only say that if you are planning a deployment using dynamic content, you would be seriously shooting yourself in the foot if you chose any other technology. It's fast, the language is easy to learn, and it just plain makes the most economic sense. The web is growing and changing, and dynamic content Web sites and Web-based applications are the next big thing.
If this trend continues I'd say you should look for Zend Technologies and PHP to play a huge role in this arena. Look for the product to improve even further. Look for the wave to go ever-increasingly in the direction of open-source and the incredible power of the new Internet software development model. Unlike the other choices available, this technology is here today--and, because of the Open Source nature of the product--here to stay.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates