If you are still on Magento 1 – Upgrade before it’s too late! Here is a guide to help in the process –
Hire a Magento Certified Developer –
Hello! I am Konstantin, a Magento certified developer with goivvy.com. In today’s video I will share my 5 field-proven steps to help speed up Magento 2.
Why do we need to speed up Magento 2?
But first, why do we need to speed up Magento 2? Well, the answer is simple: no one likes slow checkouts. An e-commerce site should be fast, and Magento is known to be quite sluggish.
So, my 5 steps to optimize the performance of your Magento 2 site are:
1. Run a time to first byte TTFB audit.
2. Perform a 3rd-party extensions audit.
3. Choose the right hosting.
4. Set up production mode.
5. Use Full Page Cache and Varnish.
Step 1: Time to first byte TTFB audit
Time to first byte is how long Magento takes to generate HTML. This is your main performance metric. Good TTFB, or server response times, are around half a second. In fact, half a second is the TTFB for a fresh copy of Magento 2.
Things that could affect TTFB are customizations, custom themes, and 3rd-party extensions. If you struggle with a slow M2 site, a time to first byte audit is the first step you should take to speed things up.
To help yourself with a TTFB audit you can use XHProf. XHProft is a PHP extension that profiles code and then outputs a trace like this.
To find abusive functions you just sort by Excl. Wall Time then analyze the first couple of entries to see which ones are taking long.
By the way I composed an extensive tutorial on how to optimize Magento 2 TTFB. You might find it interesting. I put the link to it in the video description.
Step 2: 3rd-party extensions audit.
Now Step 2. Remember how I said that one of the reasons Magento 2 sites are slow is because of 3rd-party extensions? Now we are going to find all of those abusive plugins and eliminate them.
How do we do that? Easy. Let’s go to the Magento 2 backend menu by clicking Stores – Configuration – Advanced – Advanced and get a list of all extensions that are installed. You’ll want to ignore those that start with Magento_.
Now go through the list and disable the plugins one by one. Benchmark the speed each time with www.webpagetest.org. If you notice a significant difference in speed once you disable an extension, then that plugin is an abuser. You should contact its vendor and ask for help or just uninstall it.
Step 3: the right hosting plan
A hosting plan is the foundation of a fast website. Magento 2 will give poor performance when paired with poor hardware.
How do you know if you need to change or upgrade your hosting plan? Here is a simple test to help you decide. Go and install a fresh copy of M2 on the very same server your live site is running on. This fresh M2 should be the same version as your live M2. Then benchmark the fresh copy against your live store. Is the fresh copy significantly faster? Then your hosting is alright. You don’t have to change anything. Is the fresh copy as slow as your live site? Then your hosting resources are not powerful enough to run Magento 2. Get a different plan. Sign up for a Magento optimized server instead.
Step 4: Production Mode.
This part is very easy. But from my experience many people are just completely skipping this step.
Magento 2 has three running modes: default, developer, and production. If you want maximum performance you need to switch on production mode.
To find out what mode you are in now run this command:
php bin/magento deploy:mode:show
To switch to production mode run this command: php bin/magento deploy:mode:set production
Step 5: Full Page Cache and Varnish
Magento 2 comes with Full Page Cache functionality. This means it can cache whole pages and can “hide” your performance issues under a caching layer.
You need to take advantage of this. Go to System – Cache Management and double check that Full Page Cache is on.
Full Page Cache supports Varnish as a Caching Application. Varnish is a special program that could cache and serve web resources efficiently. To setup Magento and Varnish go to Stores – Configuration – Advanced – System – Full Page Cache and set Caching Application to Varnish. Then you have to install and setup Varnish. You might need help from a system administrator. Or your hosting support team can help you. Just ask them.
So, those were my 5 field proven tips to speed up a Magento 2 site. They really work. I hope you enjoyed this video. If you have a question – please leave a comment. I will try and answer it. More Magento videos are coming up.