Optimize Magento shop speed
Magento is a very powerful and comprehensive online shop solution. A disadvantage of this richness is the performance of Magento, which leaves a lot to be desired with a poorly optimized installation. If your online shop is too slow, you will lose customers and money. According to Amazon.com, a 100ms increase in load time accounts for a 1% drop in sales. It is therefore advisable to optimize an online shop for high speed.
Important note: Before you make the changes and adjustments below in your shop, you should first test them on a separate installation of your shop. It is possible that certain customizations are not compatible with your hosting server or extensions you are using. You should therefore generally check all changes you make to your shop first on a so-called “development environment” to avoid a possible failure of your shop.
Table of Contents
How to Optimize Magento shop speed?
Choose the right host and the right hosting plan
For hosting a Magento online shop, renting a so-called “virtual server” or “dedicated hosting” is recommended. With this type of hosting, your online shop has its own server and therefore more computing power. It is not advisable to run a Magento shop on shared hosting. With this type of hosting, you share your server with other tenants, which can lead to severe losses in speed, especially when there is a great rush to your shop.
There are various hosts whose servers are optimized for Magento from the ground up. Many of them are registered with Magento as “hosting partners” and are listed on the Magento website.
Increase «memory_limit» on the server
The more memory Magento has available, the better. Clarify the maximum available RAM with your host and assign it to your server.
gzip & zlib compression of all files
Before the data is sent from your server to the website visitor, it should be compressed. This reduces the load on the server (since it has to send less data) and also reduces the amount of data to be transferred.
php_flag zlib.output_compression on
Enable query caching in the MySQL database
With “Query Caching” frequently executed database queries can be cached. Magento accesses the internal database up to 300 times when a page is called up. If these frequently executed database queries are cached, the load on the database server is reduced and the retrieval time is minimized.
Repair & optimize database tables
The database tables should be repaired and optimized from time to time. Installing and uninstalling modules, as well as changes in Magento configuration can leave the database in a messy state, which slows down the query speed.
To repair the Magento database using phpMyAdmin, proceed as follows:
- Create security backup
- Select all tables in the overview
- Select the option «Repair table» and then «Optimize table»
- Increase browser cache duration
When a visitor visits your Magento online shop, certain content is cached in the visitor’s browser when it is loaded for the first time. This is useful when different content is used multiple times. For example, if you have a logo in the header of your shop that appears on every page, it will be cached in the visitor’s browser and only needs to be downloaded once. This of course reduces the load on your server and optimizes the transmission speed.
Optimize all images
If you upload images to your server, for example product photos or design elements of your theme, they should be optimized for web display. Also make sure that the resolution that is actually used is always uploaded. For example, if you take your product photos with a high-resolution SLR camera with a resolution of 3000x3000px, they should be cropped and optimized before uploading to the server.
Photoshop offers the “Save for web” function, which should definitely be used. In addition, there are some free programs that can compress many images at once. We have had good experiences with ImageOptim for Mac OS X. This means that even images saved with Photoshop can still be reduced by a few percent.
Compress and minify Javascript and CSS files
Magento uses a variety of different Javascript and CSS files for the design and functionality of your online store. If all of these files have to be retrieved individually from the server, this increases the loading time of your shop. Luckily, Magento offers a feature that combines these files and compresses them at the same time. This function should definitely be activated.
Disable Magento log
Magento keeps a very detailed log file in the background that logs all processes in the shop. This is very useful for finding bugs during development. In productive operation, on the other hand, this function is rather unnecessary because it places additional demands on the server.
Enable Magento compilation
The «Compiler» is a tool that combines the many different Magento files that are scattered in a complex folder structure. As a result, Magento needs less time to search for the various files, which optimizes the loading time.
Further optimization possibilities
This was a summary of the easiest and most commonly used optimization methods to increase the speed of your Magento store. In addition, there are thousands of other ways you can make your online shop and your server faster.