OSCON 2006: Gettting Rich with PHP5
This week, Kevin Yank is reporting from OSCON 2006 in Portland, OR.
PHP’s creator, Rasmus Lerdorf, gave a surprising talk on building PHP rich web applications using PHP5—suprising, because fully half the talk focused on low-level PHP optimization techniques. The slides are available online.
Taking a simple PHP script as an example, he set out to optimize it to meet a request throughput requirement of 1700 requests/second (as measured by http_load). Techniques he touched on along the way included using KCachegrind to analyze the Apache process running your script, in order to determine what parts of PHP are actually causing the slow-down in your script.
Some examples of bottlenecks he identified and fixed included a default PostgreSQL setting that uses secure SSL connections (with significant overhead) and PostgreSQL database connections, which are much slower than connecting to MySQL. He also showed how to further improve performance by caching PHP intermediate code and automatically optimizing that code using the various features of Alternative PHP Cache, a project that Lerdorf is actively working on right now.
Lerdorf then spent some time looking at new features of PHP 5.0 and 5.1 that make building Web 2.0 applications easier, including the libxml-based XML handling functions, SimpleXML, and the object oriented SOAP library, but these are things with which most serious PHP developers will already be familiar.
A few of his demos showed off PHP parsing various feeds and producing interesting user interfaces using the YUI Library, and he capped off the talk with a few Google Maps and Yahoo! Maps mashups powered by simple PHP scripts. Interesting in these demos were those that directly called the Yahoo! Maps API to pull map tiles for particular locations directly on the server-side (rather than loading up a full DHTML user interface on the client side).