How to optimize Magento using admin panel tweaks
At the last count, more than 235,000 websites use Magento. It is by far the most popular eCommerce platform, primarily because it is feature rich and flexible. However, many Magento site owners grapple with poor page loading speeds. It leads to lost sales. However, with a proper knowledge of admin panel settings, Magento sites can be configured to load fast.
Of course, no amount of admin panel tweaks will make a big difference if you use a server infrastructure that’s not Magento optimized. If you’re not sure your servers are Magento optimized, here’s a quick read on how to do it.
Once you have the basics down the right way, here are the list of admin tweaks that’ll boost your site speed.
As we explained in a previous article, Magento loads slow because for each page access, it executes several database queries, and loads multiple PHP files/templates. A fast way to cut down this time is to enable Caching in Magento admin panel. It can be enabled by going to “System > Cache Management > Select All > Actions (Enable)”.
This setting asks Magento to store processed sections of products and pages in a directory called “Var/Cache”. So, the next time a visitor asks for the same page, Magento doesn’t have to load PHP files or send out database queries. It can just get the page from “Var/Cache” and send it to the visitor. When new pages are added, or templates are updated, the cached copies will be outdated. So, whenever a change is made, the “Refresh” option should be used to update the cache.
Now, an important thing to note here is that “Var/Cache” is a directory on a hard disk. Hard disks are the slowest components in a server – which makes even the “Var/Cache” access a bottleneck in high traffic websites.
For eg., we maintain the website of a large apparel brand which receives hundreds of visitors simultaneously. During new fashion releases, we noticed high disk I/O waits due to cache access. To fix this, we moved all disk based caching to system memory, by creating a “virtual” drive called “tmpfs”. This effectively resolved the bottleneck and gave a 30x improvement to access speed.
Enable full page cache to serve full pages from memory
The regular Magento caching described above stores only sections of the page as cache data. Each time a request comes in, it has to build a page from different sections of cached data. This is faster than the default Magento setting, but not as fast as “Full Page Cache”.
Magento Enterprise comes with an option to store cached versions of a whole page. So, no time is wasted trying to piece a page together. This option is available under “Stores > Configuration > Advanced > System > Full Page Cache”.
For community edition, the same feature is available through various plugins. We prefer plugins that use Varnish as its cache manager, as it gives us an additional layer of fine grain customization to match the traffic of each site.
For eg., we support a managed Magento web host who provides business hosting solutions. The traffic volume, frequency of update, and website architecture is different for each website. Varnish helps us to custom configure several website specific settings such as page expiry time, block expiry time, and resource black-listing based on the changing business needs of each customer.
Enable flat catalog to decrease database queries
Magento performs several database queries fetch information for a single page. By enabling options called “Flat Catalog Category” and “Flat Catalog Product”, you can ask Magento to merge all category and product data into one table. So, instead of executing multiple queries, Magento just has to execute one database query, thereby saving significant amount of time.
It can be enabled under “System > Configuration > Catalog > Frontend” (for both Categories and Products).
While Flat Catalog significantly reduces the time for queries, it still requires Magento to query the database, which in turn fetches the data from hard disks. For high traffic websites, this can quickly become a major bottleneck.
We support several high traffic websites that serve up to 7000 hits/hr. To avoid the I/O bottleneck in these sites, we employ several methods that include database query caching, load-balanced querying and SSD disks.
Enable Magento compiler to reduce disk access
As we discussed in an earlier post, Magento loads several linked PHP scripts in order to display each page. This leads to a lot of search, locate, and retrieve operations to get all the files from different locations. Needless to say, it leads to a perceptible lag in page display.
Magento provides a feature called “Compilation” that puts all the commonly accessed files into one single directory, making access to PHP scripts super fast. It can be enabled by going to “System > Tools > Compilation”, and hitting “Run Compilation Process”.
Enable log cleaning to keep the database lean
Magento stores everything in its database. This includes product data, page data, and activity logs. It records visitor details, what products they viewed, how many times it was viewed, etc. The default option for Magento is to store this information indefinitely, which can easily take the size of a database to several GBs.
Cleaning out these logs on a regular basis makes the database lean, and responds faster to queries. It can be enabled by going to “System > Configuration > Advanced > System > Log Cleaning > Enable Log Cleaning”.
It must be noted that these frequent database cleaning can leave the tables un-optimized, which can lead to a slow database. So, we audit Magento databases at least once a week for the websites we support, and use the “OPTIMIZE” feature of MySQL/MariaDB/Percona to keep the tables lightning fast.
It can be enabled by going to “System > Configuration > Advanced > Developer”.
Re-index data periodically to enable faster product display
One way Magento tries to reduce load time is by using “Index tables” that query product data, and put them into a single database table. This allows Magento to quickly issue one database query to display a page instead of constructing many complex queries. When a new product is added, these index tables are automatically updated, but its known to contain stale data – which reduces performance.
So, we manually Re-Index all products at least once weekly (for sites that keep adding/removing products). This keeps the Index tables clean and fast. Re-indexing is done by going to “System > Index Management > Reindex Data”.
Disable unneeded Magento modules to make Magento light
We’ve seen Magento website owners try out various extensions, and then leave it enabled in the site. This is an additional set of code added to the website, and possibly executes every time someone accesses a page. To make sure the website remains lean and mean, we periodically audit all Magento websites of our customers, and disable extensions that are not required.
This is done by going to “System > Configuration > Advanced > Advanced”, and selecting “Disable”.
Disable Magento logging to further minimize disk access
The lesser number of operations Magento has to perform for each page access, the faster it will load. I say this because, Magento records store status information and errors to two log files called “system log” and “exception log”. These logs are needed when you want to troubleshooting some error, not on a daily basis. So, this can be safely disabled by going to “System -> Configuration -> Advanced -> Developer -> Log Settings”.
Keep Magento updated to get faster code
New versions of Magento not only gives you more features and bug/security fixes, but with every update Magento performs better. So, no matter how small the update, we make sure Magento is current in all the websites we support.
Compress images for reduce page size
Page load speed is determined in part by the size of the page. If the page contains large files, it’ll take longer to load. Image size is often overlooked while creating a page. A quick way to improve your site speed is to optimize all images in skin, products and categories. Various online tools like TinyPNG and TinyJPG are available to reduce image size without compromising quality.
eCommerce customers expect websites to load within 2 seconds. In this aspect, Magento shops are intrinsically at a disadvantage because of its complex design. Today we’ve seen how to optimize Magento by tweaking admin panel settings. However, these settings need to be supported with Magento optimized servers where the web servers and database servers are specially tuned to fix Magento bottlenecks.
Bobcares helps business websites of all sizes achieve world-class performance and uptime, using tried and tested website architectures. If you’d like to know how to make your Magento store more reliable, we’d be happy to talk to you.