What causes Magento version 1 and 2 to run slowly?

January 15, 2017

There are a number of reasons that causes Magento to run slowly. All too often this is the case with a new client. One thing clients with Magento websites don't realize is that in order to run an efficient Magento installation, a lot of thing must be considered.

Magento themes is a huge driver in how fast your Magento website will run.

"I'm getting a Magento website and my developer is using a premade theme" or ''I just bought a premade theme for my Magento website". These are two sentenced that raises a red flag in the back of my mind. A magento theme should not be purchased to be used as a baseline for a new look. Nine out of ten times, that theme is filled with unneeded javascript and css elements. Furthermore, it's always questionable if the developer only loaded elements that the page needs to load. All too often i've seen developers load elements sitewide. The problem is different pages need a different amount of resources to load. Why not optimize to only load what's needed? After all, it is an ecommerce website and speed is the biggest drive for conversion rates.


Conversion Rate - The rate in percentage of the total number of sales divided by the number of leads or website visitors. In layman's terms, a high conversion rate means your website is making more money per visit. A low conversion rate means your website is making less money per visit. If your website conversion rate is 50%. That means 50% of your visitors are buying something on your website.


To sum it up, stay away from pre-made theme or view the demo for the theme. When viewing the demo, pay attention to the amount of elements loading on the theme. Pay attention to the amount of files labeled .js and .css. Secondly, ask the developer if the theme can handle Magento's compress css and compress js functionality. If the developer says no, run for the hills. Although I advise against premade themes. If getting one is a must, find out as much of the theme as possible. To be safe, consult an experienced Magento developer. We've added a contact form on the footer of our pages for your convenience.

 Web server technology can affect speed.

It's debatable to say which web server technology is best for Magento. I've seen fast Magento website's run on NGINX, and i've seen fast Magento websites run on Apache. What is important in this category is configuration. The configuration of the technologies must be correct. Example: You cannot utilize Apache optimization modules such as mod deflate if your hosting provider has not installed/enabled it.


Mod Deflate - is an Apache module which “provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.” (from its web). This means that you save some bandwidth in exchange for some CPU cycles compressing the data your Apache server sends. In layman's terms, it compresses the data making your site speed faster.


The most important part of your web server technology that is THE most important but is often missed is php configuration. Magento is mostly a php driven website with a little bit of javascript. With that said it would make sense to ensure that the php configuration is correct right? Apparently it doesn't make sense to many. Furthermore there is a technology called PHP-FPM that i've found to complement php very well. I'm not going to go into the specifics but you should find out if your server is running this technology.

Your database and catalog is the core of everything

We're going to discuss 3 things in this category. Proper configuration of your database server, the management of your catalog and an important technology called FPC(Full Page Cache).

Database

Your database server has to be optimized to run Magento. Example: As your visitors increase, your database server will need to handle more therefore max_connections may be a configuration that will need to be visited.  Before launching your website, it is always a good idea to run a load test. It is always good to know how much your website can handle before having to revisit your configuration settings. If your Magento website is in the cloud, this doesn't mean you're protected. More recently, I had a seasoned server admin go against my advise of load testing. "I've been doing this a while" he claims. A week later, the Magento website got a DDOS attack by a single ip address. It didn't crash the website but it brought it down to a crawl.


DDOS Attack - A typical method used by hackers to attempt to bring down a website. They conduct the attack by hacking multiple computers and use those hacked computers as additional resources to visit a website simultaneously. Linux, the operating system most web servers use, will attempt to keep itself running by shutting down services. Unfortunately, the database server is usually the first to go and this is how your site is taken down.


Catalog

Your catalog organization is important. A well organized catalog will prevent your Magento website from connecting to the database unnecessarily. The more the unneeded connections are avoided, the more resources can be used for more important connections. Imagine you visit a category on your website. It is ideal that the connections to your database is only to fulfil the need for that category. Gathering information for other categories is a waste of resources and your Magento website will run slowly when visiting categories. Make proper use of your attributes and attribute sets. Your attribute sets help to keep unneeded attributes from loading therefore saving resources. Keep your categories to a minimum. Categories are only to be used as general guidance. The categories should then turn over the rest of the navigation to your attributes to point your visitors in the right direction. The goal is to allow your site to help your visitors find exactly what they want. I'll post a more in depth guide to a better catalog later that will be for Magento 1 and Magento 2 store owners.

Full Page Cache

How does full page cache fit into the database and catalog area, you may ask? Well, Magento 1.0 has it's own caching mechanism but it doesn't include full page cache.   Recently, Magento 2 was released with Full Page Cache. I guess the Magento team caught on. Full page cache helps to prevent database connections by serving pre cached html pages. The less database connections, the faster the website. The faster your website, the higher the conversion rate. For those who do not have the funds to buy Amasty's Full Page cache. Lesti full page cache is a great replacement. Note:Lesti FPC is only for Magento 1.x users. The only difference is that Lesti Full Page cache has less user friendly options and doesn't include a crawler that automatically caches the pages for you. Without the crawler, live users trigger the creation of cached pages.

Speeding up Magento 2

The past few days i've been running tests on server technologies for Magento 2. I've yet to test with NGINX but i've found that Apache 2, PHP 7 and PHP-FPM works the best. More to come in future posts.

I hope you've found my post useful. Thanks and come again!

Copyright © Mage H.D. Inc.
envelopephonemap-marker linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram