Administrators tasked with improving performance of a PHP-based Apache Web server may find it helpful to check out the latest product from Israel-based Zend Technologies before investing in more hardware.
While PHP itself speeds up Web site performance, even a site based on PHP can be overwhelmed if enough users access it. A typical response to this scenario is to buy expensive hardware and database upgrades, which also increases the administrator’s workload.
However, there is another option. Zend recently announced a major upgrade to its Zend Cache PHP performance enhancement software, now called Zend Accelerator, which boasts improvements such as real-time performance monitoring, performance enhancements, and a code optimizer.
F. Harvell, president and CEO of ICGate, Inc., a Web development company and ISP based in Winter Park, FL, said that Zend Accelerator saved one of his clients tens of thousands of dollars. Here is the story of how Harvell and his client accomplished this.
CPU use cut dramatically
The ideal of every Web site is to provide pages that load quickly and keep visitors interested. Lots of graphics and interactivity can make a site interesting, but if it takes a long time to load in users’ browsers, they’ll go somewhere else.
Losing visitors to slow performance hits any company’s pocketbook, and it can happen to any site that becomes so popular that its servers can’t keep up with demand.
That’s what was beginning to happen to one of Harvell’s clients, Milesource.com. The Milesource business model is essentially to draw visitors to products using articles and links; purchasing these products earns visitors “award miles.” The award miles can be used as currency to buy anything from theater tickets to airline tickets.
The site (which was colocated at the ICGate facility until Milesource’s recent move to New York) uses four dual Pentium III-based servers for its front end and a dual Pentium III machine for its database engine back end. The site is built on PHP.
Milesource was started in February 2000 and now boasts more than 2.5 million members. On any given day, the site sees 12 million hits and 10 million page views from more than 400,000 unique visitors.
“They were pushing a tremendous amount of traffic in that framework,” Harvell said, “and we were maxing out the front ends during the peak times. We were running them at 100 percent.
“Since putting the Accelerator in, during the peak times, those boxes are running about 75 percent idle.”
Harvell estimated that to get the same effect with hardware alone, you would have to balance the load over twice as many machines. The cost would include not only the hardware for at least four machines but also the cost of four licenses of the database software. In this particular case, Harvell is using InterSystem’s Caché database.
He doesn’t figure in any cost for operating system or Web server software because these machines are running Red Hat Linux and Apache, which are both free. Even so, the costs of the hardware and the database licenses would add up to about $160,000 in this case, compared to $12,000 to $16,000 for the Zend Accelerator product—a savings of as much as $144,000.
A peek under the hood
Harvell is a big believer in PHP for developing interactive and dynamic Web sites. You can do many things with PHP, such as connecting to different types of database systems and payment systems, dynamically creating PDFs and graphics files, manipulating data on servers, and making calls to UNIX commands.
“Performance, that’s really the biggest thing,” he said. “We can serve a tremendous amount of traffic dynamically with PHP, and the level of functionality available in the system is pretty fantastic all by itself.”
PHP is an interpretive script, and the PHP/Zend engine reads HTML that includes PHP and parses it. The engine then interprets the tokens it parsed in order to produce the output (Web page) that is sent to the user’s browser.
According to Harvell, the Zend Accelerator sits between the parsing and the execution. The first time that page is requested, the Zend engine parses it, and then Accelerator stores that parsed image in memory. It executes the parsed image and sends the information to the browser.
When the next person requests that page, Accelerator determines that the page is in its cache, bypasses the parse process operation, and executes that preparsed memory image. PHP doesn’t have to handle the file I/O to pull the file into memory, and it doesn’t have to parse it. Beyond that, the PHP file executes as if Accelerator weren’t there.
“In our case, we use a PHP library that includes a lot of predefined functions we can use to make our applications faster,” Harvell said. “That library is a fairly lengthy body of code that gets preparsed, and now we don’t have to parse that library to execute. Only the pieces that need to be executed get executed.
“By using the Accelerator, we bypass that parsing piece. Parsing on the equipment we’re using takes about 0.2 seconds. By removing that parsing aspect of it, we reduce our processing on a page from about 0.3 seconds [total] to 0.07 seconds. Those numbers don’t mean much until you start aggregating them. It translates into five pages per second to 30 pages per second [faster].”
Speeding up the process hasn’t had a negative effect on the reliability of the Web and database servers either, Harvell said.
“We’ve had servers in operation without being restarted for literally months at a time, and the restarts were required only because we had to stop the servers for upgrades,” he said. “To date, we have never had any problems with the Zend Accelerator with PHP 4.0.5.”
How do you speed up your Web site?
Caching pages and code are two ways of speeding up the presentation of your Web site’s pages. What other ways have you found to improve your site’s performance? Send us a note or post a comment in the discussion below.