For managers and stakeholders of PHP projects, it is not only frustrating to have a slow website, but it is also bad for business, but could also cost you as much as 75% of your visitors. And while you engage your technical teams to remedy those issue it is not easy to get to the bottom of the issue and address it.
For years we built PHP customer facing software using PHP to display search results from our search engine and used common sense techniques to uncover and in many times “dress up” and “cover up” bottlenecks in code.
Some of the best tools to accelerate your PHP application include
- Use Code Reviews to unearth common developer mistakes
- Examine Slow Query Logs
- Use database abstraction with built in caching such as AdoDB
- Enable caching with Smarty, Memcache
- Use APC and other PHP Accelerators and compiling app into opcode/bytecode.
- Used distributed nodes with load balancers.
- Use of CloudFlare and Railgun to accelerate static and dynamic content.
So how do you unearth those pesky bottlenecks?
It used to be very hard and we relied on tools like Xdebug, and a slew of tools to track code bottleneck such as WebGrind and KCacheGrind on Linux. They did the job and got the team to find issues that were not observed otherwise. But then I stumbled upon an app that I really loved as a CTO. newrelic.com took us to the next level, as they describe on the site “… gets you immediate code-level visibility to build faster software, create better products, and delight your customers”, and I agree with this statement all full heartedly. What I also like about it that it supports Java, PHP, Ruby, .Net, Node.js & Python so enables CTOs to have a unified tool to access all of our projects.
After deploying NewRelic on our production servers, a slew of reports started pouring in, issues that were never seen on development started to emerge. We uncovered issues such as:
- Full database scans where happening on certain queries from our applications and other third party PHP applications running in production. Got our engineers on top of it and bam! Better response and lower use of resources.
- Third party API timeouts! Ok that is another gotcha! Like most software we connect to a slew of APIs out there and some were not very nice and made us wait, so we worked those issues with DNS changes, caching, timeouts, AJAX, use per-processing tools instead of real-time and so forth.
- Inclusion of PHP libraries and code that were no used, fixed that quickly to only load what we need instead of loading everything.
- The app also reported errors that users experienced and we knew about it and fixed it before it affected a larger group of users.
- Mobile coverage was also something was not easily available to us and newrelic allowed to explore that space and improve on the user experience.
There are several alternatives to newrelic out there, but for us we did not need to try anything else. It installed perfectly on CentOS 6.X nodes, did not interfere with our apps and helped us deliver 100% SLA on our SaaS application.
Adonis El Fakih, CEO and CTO of Ayna Corporation, 15+ years experience deploying PHP powered solutions ranging from CMS, eCommerce to search engines and Omni-channel marketing platforms. ( Open Adonis’ LinkedIn Profile )