In Ecommerce Applications, Hosting Guides Magento Guides Part 2 – Cleaning and Optimising Posted by Stefan Welcome to the second part of our series of Magento Guides, highlighting some of the more useful posts and guides available on our site. In the last part we tackled some areas that are useful when starting a Magento store, and now for this instalment we’re going to look at some tips and tricks that can help improve the performance of your site and reduce the amount of web space your store uses (Magento stores can get quite bloated!) Reducing Magento Disk Usage To view the full guide click here. This guide is one that we frequently send out to our clients. Magento is a resource hungry application, and not just in terms of RAM or CPU usage; it can use a lot of disk space too. This is because Magento caches content heavily; three examples would be the sessions of users of your site (in the session and cache directories in the httpdocs/var/ folder); the sessions and all modules it downloads when you use Magento Connect (in the download and cache directories in the httpdocs/downloader/pearlib/ folder); and logs of all visitors and the links they visited in your database (in the a number of log_ tables). Whereas all of this is useful (and quite important), cached content will eventually need to be cleared, whether due to updated content, or outdated information. And sadly Magento doesn’t always do a very good job of clearing this content, particularly in the database. We often see clients over-using their disk space limits, despite the small amounts of products in their store – and as for busy, large SKU level stores, the disk usage in these areas can be very high indeed! This guide shows you how to implement a scheduled script that will clear these log files out of your database. You can also use the script to clear the logs manually if you wish, and even better, you can schedule it to clear the website cache as well. It includes some advanced concepts (such as scripting and scheduled tasks) but happily it’s a very clear guide that walks you through the entire process from start to finish. All in all it only requires a little bit of copying, pasting and clicking and you’ll be able to notice the differences in disk usage immediately. In theory it will also improve the performance of your Magento store… a smaller database is easier to search, so the less data you have in your database, the quicker the responses! Using gzip Compression To view the full guide click here for shared hosting or here for VPS hosting. Optimisation is often about getting a little bit of speed from a variety of sources, rather than a single fix-all solution, and utilising gzip compression is one of the tips that definitely produces results. It’s also really, really easy to setup – so we can’t recommend it enough, regardless of your site! Rather than sending an entire web page to your browser, use of gzip compression requests that the server compresses the page on the fly. This smaller packet of data is then sent to the browser, and the browser then unpacks the compressed data and displays your page. The differences in the amount of data sent from the server can be quite remarkable – make sure you compare your page sizes in the gzip checking tool before and after applying the guide! The real-time compression of the pages does add extra load to the CPU of the server your site is hosted on. It is worth pointing out that CPU overhead isn’t a problem we’ve encountered (in general or due to gzip compression) so you’re not likely to encounter any issues once you’ve implemented compression. Using Image Clean To view the full guide click here. Another major issue we have found with Magento stores are the media folders. All your product images and related temporary files are stored in this folder. As experienced users may know, Magento sites regularly expand in size, and the more products you have (not to mention the number of images those products may use) – the bigger the folder. Image optimisation will get you so far, but in the end a large catalogue will have a correspondingly large media folder. One problem we have encountered centres around deleted products. Whereas Magento will remove the product from your database, it won’t remove any images that relate to that product. Therefore, over time your media folder will fill with images that you really don’t need, and it’s not an easy task to clear the unused images out and free up the resources for data you actually need. Although the compatibility so far only reaches 22.214.171.124, a free Community module we heartily recommend is defcon2’s Image Clean module. This module will look through your images folder and compare it to your database, and lists all the images that you’re not using anymore. You’ll then be able to delete them if you like. Maybe not a great tip for new stores, but for older sites or a bookmark to use in time it will prove its worth. Many shared hosting clients have been spared an upgrade once they’ve used this module! That’s the end of our second series of guides. In the next instalment, we’ll be looking at some guides that we have, covering some very important aspects of the life of a Magento store – making a development copy of your site, as well as changing the URL or the location of your Magento store. NuBlue are a Magento specialist. If you have a Magento design and development project or a Magento Hosting Requirement please get in touch and we will be happy to discuss your requirements.