October 1, 2014
 
 
RSSRSS feed

PHP 4.0: Dynamic Content for the Web Warrior - page 2

PHP 4: A Vast Improvement

  • May 25, 2000
  • By Paul Ferris

The Zend folks claim that PHP performance improvements in the new engine are orders of magnitude over PHP 3.x . I'm always skeptical of performance improvements (if you're reading Microsoft press releases of late, in regards to Windows 2000, you need to be more than skeptical, but that's another story, alas).

I did some benchmarking of my own, with php3 and php4. I played with the Zend optimizer a bit, and ran the tests with it enabled and disabled. Using two identical PCs with 128 MB RAM and similar software configurations, I loaded php4 and the exact same Linux Today index page (Linux Today and Apache Today both exclusively use php for everything web-oriented). I used the dubious "time" command to come up with the numbers that the user will experience under Mindcraft benchmark conditions.

No, I'm not being totally tongue-in-cheek here, I'm actually describing the real benchmark conditions. If you remember the Mindcraft benchmark conditions they had some seriously wide bandwidth pipes on a pretty fat server. What was different was that they requested static pages--PHP provides dynamic content.

In other words, during my benchmark, I was the only person on my 100baseT network, requesting files from the only busy server on my network, at speeds that would be pretty much out of the price range of most people serving content on the world wide web. Even more to the point--this isn't intended to be a "real" benchmark measuring conditions you would experience under "real" load conditions. It's more intended to satisfy my curiosity about whether the product actually would actually provide performance improvements for my application--delivering the news.

Bear in mind that our application is not a huge one--PHP can do far more complex things than make a dynamic news site. Our main page has multiple include files and an extremely small number of database calls. It's been fairly well optimized and trimmed down because some people poll it constantly looking for new Linux news.

I wouldn't know or pretend to understand who these people are (cough).

Anyway, at first glance the improvement was around 75% for an unoptimized (small) page. I know I'm happy with this, but it doesn't quite match the claims made by the Zend folks, and I kind of wanted to believe them in this case.

So I went searching for a real porker (in comparison to the main page) of a php3 page. I didn't have far to look, fortunately. Just about anything that Richard Stallman has ever written for Linux Today has resulted in an eruption of flame that makes anything I've ever touched upon look like a prayer session with the Pope.

So, I chose the story:
UPDATED: Richard Stallman -- Boycott Amazon!
and proceeded to flog both servers with the url inserted in my hokey benchmark program. The result was similar--about a 50-75 percent improvement in speed.

Then it hit me, yes, I was real-world testing--everything in the equation. Not just php3/php4, but apache, my network, my browser--everything.

In order to get a real grasp of how much better php4 was than php3, I should take a look at everything as compared to something that has php removed entirely--something like a static page, for instance.

So, I dumped the file to a static html file, and tossed that into the mix. I think you'll find that the results are nothing short of staggering. Table 1 shows the results of three runs.

Quasi-Mind-Craft Benchmark Stats for PHP4 vs PHP3

RUN PHP3 Server
HTML static
PHP3 Server
dynamic
PHP4 Server
HTML static
PHP4 Server
dynamic
PHP4 Server
dynamic optimized
1 42.12 73.14 46.92 53.05 49.63
2 46.5 71.43 47.26 53.84 50.77
3 48.75 73.46 46.37 50.57 46.60
AVG 45.79 72.68 46.85 52.49 49.0
Figure 1

The benchmark runs were from identical hardware, and each time represents the time for lynx to do a raw source dump 50 times for the Stallman article.

Sitemap | Contact Us