Magento is an open-source eCommerce platform used predominately by larger customers/merchants, with over 150’000 active online merchants using it. Magento’s great customisation and flexibility options come at the cost of a steeper learning curve that other CMS’. Magento’s built-in caching system introduces you to the slowest component of a computer, the hard drive, and how Magento makes maximum use of it. It will also help you to configure a set of loosely connected computers working together for handling more customers. Here is how to optimize Magento performance.
Using the Magento caching system
Table of Contents
A cache is a system that stores data so that future requests for that data can be served faster, stores copies of documents passing through it, and if a set of conditions exists subsequent requests may be satisfied from the cache .Though having a cache is definitely good, but the caching system of Magento is not more effective. There are many hypotheses present in order to explain the optimization. The main thing is that the Magento core has to parse the cache and check in MySQL to compare updated data, and this causes a huge delay. However people don’t use the full resources of their systems by allowing Magento to do these kinds of operations.
While running the Apache web server the keep-alive directive is used to keep an already established TCP session open between a user’s browser and the server for it to be reused. This increases the performance because creating a new TCP connection for every single asset to be downloaded from the server and the overhead of terminating is eliminated but it uses more memory on the web server.
Use a memory-based file system for caching
Hard drive is the slowest component of a computer but the Magento caching system makes massive use of this component. It would be great if we could store the Magento cache files directly inside the memory. You have to create a memory based file system so that all the caching mechanisms of Magento will now work with a memory-based file system instead of the classical file system. This newly created file system takes place in the RAM but is intended to appear as a mounted filesystem.All files created or updated are temporary because of the nature of this file system and the access time of this kind of file system is extremely slow in comparison with a classical hard drive. Nothing will be written in the hard drive, and everything will be lost if you reboot. You have to save the volatile files in your hard drive and unmount the memory-based system. You can then copy the saved data from tmpfs in the cache folder if you want to reboot your server.
If Magento is still slow even after applying all the techniques it means that you are a very prosperous online retailer and it’s time to leave the single server. For a single server, you can begin by separating your database in a dedicated server by investing in another server and installing MySQL on it. You can then extract your database from your first server and import it to your new server. The next step is using a CDN for your images, scripts and CSS. A CDN is an independent server optimized for delivering static content such as images, scripts and CSS. Our web server can focus on running Magento and the CDN can focus on displaying static content in this way.