6 Magento Performance Optimization Strategies
One of the biggest concerns with any ecommerce platform is performance. A fast-loading site is important to both traffic and conversion. Google recently added site speed and page load time into the algorithm which controls website ranking, meaning that a site that is a millisecond slower than a competitor may have trouble reaching the top of a search results page. Speedy ecommerce sites convert better because online shoppers are on the move, they want to find what they want, purchase it and move on. To an online shopper, there is no bigger turnoff than a slow checkout. The most common concern we hear is that in a default configuration and environment, Magento isn’t completely optimized for site performance out of the box. Here are some of the quickest ways to make the most out of your Magento install.
Combine CSS and Javascript: By default, each CSS and Javascript library exists as separate files that are output in the header. Most web browsers limit the number of concurrent connections they make to a server, and your customers – depending on the connection between you and them – may have a sub-par experience waiting for styles or JS widgets to load. Magento allows you to ‘combine’ these files, reducing the amount of HTTP calls to the server, resulting in an overall better experience for the end-user. Make sure you thoroughly test your site with ‘combining’ enabled before you launch, as poorly-written pieces of Javascript can introduce conflicts within the overall file.
Separate Media from Content: Somewhat related to the above point, another great way to speed up end-user experience – as well as potentially ease resource usage on your webserver(s) – is to separate your media from your content. Whether you simply give your webserver a separate sub-domain, or you push your media files to a dedicated CDN, you’re giving the browser more breathing room to gather all of the pieces of your site as quickly as possible.
Use PHP Op-Code Caching: The first two examples benefit the end-user, but the biggest performance wins are those that affect the system as a whole. One of the most important things you can do to your system is to utilize ‘Op-Code Caching.’ This is a system that caches the PHP instructions that drive Magento, so that the system doesn’t have to re-interpret them for every customer. Two excellent Op-code cachers are APC and Xcache.
Enable Magento’s ‘Compilation’ Mode: One of the great things about Magento is its flexibility in adding new modules, and overriding existing ones. You can quickly change core things about Magento by copying its module file to a similar path in app/code/local. However, all of that filesystem juggling comes at a cost - performance. ‘Compilation’ can mitigate that by figuring out exactly which modules and overrides will be used, and copying them to a common directory for easy access. You can enable this via System -> Tools -> Compilation.
Use a RAM-based FileSystem for ‘/var’: Make sure that Magento can keep its own data in an easily-accessible place. Traditionally, this is done through the same filesystem where Magento is installed, but hard drives are slow and memory is fast. Therefore, you can easily increase overall response time by creating a ‘RAM-disk’ - a filesystem that lives in a chunk of memory – to store at least the ‘cache’ and ‘session’ subdirectories. You may not want to use it for all of ‘var’, since RAM is volatile storage, and would be empty after a system reboot, leaving you without any logs or backups.
Memcache For Non-Standard Installs: There are many instances where you may want to run Memcache – a distributed in-memory storage daemon - on your Magento install. If you’re running a heavy site with a lot of visitors, splitting Magento between multiple front-end webservers, or have session length requirements that go above the norm, you may find yourself running into filesystem limitations, where PHP normally stores sessions. However, for many smaller Magento instances, you’ll take a slight performance hit over using a RAMDisk.
Many of these suggestions don’t require more than a few clicks to enable (or emails to your hosting provider), still many developers overlook them. By taking the time to prepare your system, you can serve more customers more quickly – leading to more sales!