Practical PHP Performance
By Akash Mehta2008-02-13
Introduction
When it comes to building web applications in PHP, performance isn't typically a major concern. Features, usability and any business concerns are considered a greater priority, as they can be better demonstrated and visualised. Performance graphs don't make the boss's day.
So, why should you as a PHP developer, worry about performance? Quite a few reasons, in fact:
- Efficient code gives you more flexibility with what you do with your application - for example, you can't exactly throw in a thumbnailing routine if you've already maxxed your server.
- Performance techniques generally line up with best practices, and while best practices are their own justification, they will save you time (and money!) in the long run.
- On a high-scale application, performance graphs won't make much of a difference. Still, informing the boss that, thanks to your performance efforts, you can cut server costs significantly, will definitely earn you some credit, and maybe even a raise.
- Well written (and therefore efficient) are easier to debug.
The potential performance of PHP applications is certainly something to be proud of - at one stage, Digg was handling 200 million page views per month with just three web servers and eight database servers. PHP by its nature is one of the fastest web scripting languages available, having been more or less written for mod_php, the Apache module used for most PHP installations. Unlike Java, PHP is sufficiently dynamic to run literally as lightweight as you require - for example, you could write a web service in just ten lines of code that could easily handle millions of hits a day, as opposed to the overhead of pulling in a significant chunk of enterprise-sized libraries that you probably don't need.
Tutorial Pages:
» Introduction
» Performance: is it really what you're after?
» Ten ways to improve your application's performance
» Conclusion
