XHGui on VM, Storage on Host

I’m doing some performance tuning on a project at the moment and my favourite tool is still XHGui – but it’s designed to run on the same machine as its victim and since this is a vagrant VM, the chances of me destroying the machine and therefore the data are pretty high! Instead, I set it up to store the data onto the host and I thought I’d share how I did that. Continue reading

Quickly add Amazon Cloudfront as a CDN

Right now I’m working on an application which is experiencing lots of interest – and therefore lots of load! We needed to look at ways of trying to bring down the pressure on the servers, and decided to use a CDN (Content Delivery Network) for our image files. It was surprisingly painless to implement once I got into it so here it is in case it’s helpful. Continue reading

PHP Version Adoption

PHP runs over 75% of all websites whose technologies are known (source: w3techs), which makes for a really REALLY long tail of users who once installed wordpress, phpmyadmin, or some other open source project that helped their business needs at the time. What they don’t do is upgrade. PHP’s current usage statistics look like this (source and raw numbers are if you want them):

PHP Version Adoption

What’s alarming about this is that the left half of this graph represents unsupported versions of PHP. PHP 5.2 has been end of life since January 2011. This doesn’t mean that you can’t use it any more, but it does mean that in terms of security updates, you are out of luck. Some distributions will try to retro-fit some of the fixes but essentially your PHP applications seem a bit lacklustre because, well, you’re using technology from 2006. Continue reading

Installing XHGui

There’s a new version of XHGui (well, a few months old) and it’s fabulous! It’s got a few new dependencies though so I thought I’d write down how I set up my version, in case it’s helpful to anyone else (and so I feel like a pro next time I have to do this!). If you’re not familiar with XHGui it’s a fabulously easy and friendly way to profile your application; to understand which method calls in a page take the time and how many times they are made, so you can improve the performance of your application. All these instructions are for my 32-bit Ubuntu 12.10 system, hopefully they will work for you or you’ll be able to adapt them as appropriate.

Dependencies

XHGui needs version numbers or fluffy animal names, because this is a really major release and quite different to what went before in both technology and in looks. In particular, it now uses MongoDB. If you’re not familiar with MongoDB, it’s a super-friendly NoSQL database that makes a really handy backend for this kind of unstructured data – because every run of every page will look different. Therefore you will need:

  • MongoDB itself
  • The pecl extension for mongo
  • The xhprof pecl extension (read on if you’re using PHP 5.4, there’s a gotcha)

Continue reading