Optimizing PHP, Part One
Learn how to install and configure memcached, an object caching system, to improve the performance of your PHP applications.
Thursday, June 15th, 2006
As the LinuxQuestions.org (
http://www.linuxquestions.org/) web site continues to grow, good performance remains vitally important. The August 2004 “Tech Support” demonstrated a couple of ways to optimize the
Apache HTTP Server. The next few columns examine ways to enhance the performance of
PHP applications.
It’s estimated that PHP, a recursive acronym that stands for PHP: Hypertext Preprocessor, is currently in use on tens of millions of domains. Moreover, PHP is becoming increasingly capable with each release of the language, and is now considered a viable option for enterprise applications. Companies like IBM, Oracle, and Yahoo! now support PHP in a major way.
PHP performance is a topic you’ll find widely discussed on the Internet. In addition to Google,
http://talks.php.net/ is a great place to look for information on language-specific tweaks, such as disabling
register_globals and building the interpreter properly. Here, let’s focus on application-specific tweaks and system-wide enhancements that boost performance.
memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. Available under the BSD license,
memcached was originally written by Brad Fitzpatrick for LiveJournal and is available for download from
http://www.danga.com/memcached/.
memcached is meant to work in concert with something like the
MySQL query cache, not replace it. The two implementations excel at vastly different things: memcached is an object cache, while MySQL provides a query cache.