5 Tips to Speed Up Magento 2

38 ratings | 3660 views


5 Tips to Speed Up Magento 2

Magento 2 TTFB Optimization - 20 steps to speed up Magento - If you are still on Magento 1 - Upgrade before it's too late! Here is a guide to help in the process - Measure Performance Metrics - Hire 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 . 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. Subscribe and stay tuned. Bye.

Comments to the video: 5 Tips to Speed Up Magento 2

Alejandro Duque 2 months ago
Hi Konstantin, amazing video, i have a problem witm my ecommerce, when the customer buys a product, the system collapse for five minutes, but not at all, the plataform only process that sale, no other customer can buy a product in this 5 minutes. we try some things but no results, maybe you heard before about this problem, thank you so much for your answer, sorry for the bad english.
Konstantin G. 2 months ago
Hi Alejandro, nothing really comes to mind. I have a paid support service - contact me at [email protected] and I'd be able to help you.
Sasha Park 5 months ago
does nginx and varnish work together? my current provider says no, documentation on magento suggests atherwise
Konstantin G. 5 months ago
They can, depends on the setup.
Jason Smith 6 months ago
Thanks for this, what is median (good or bad) for an extension load time? Does the profiler check loading speed of each individual extension/module?
Konstantin G. 6 months ago
You are very welcome. I'd say anything that is above 100ms should raise a concern. Magento 2 profiler doesn't show you an individual extension's load time, although you can change that by putting custom profiler start/stop marks.
Natural Beauty Guide 8 months ago
Hello, can you show what preparation we need to do for magento 2 professional developer? How can we prepare dor exam?what type questions they ask and how can I clear it?
Konstantin G. 5 months ago
I'd recommend that one.
Natural Beauty Guide 5 months ago
+Konstantin G. yes I saw few guidelines. Is there any special you recommend?
Konstantin G. 5 months ago
There was this guide on the web, just google and you'll find it.
Natural Beauty Guide 8 months ago
Hey cool tips. Thanks for.it. Can you show what things we need to do on server to optimize magento 2 performance? What steps we need to follow to follow to optimize on server side? Also, how to write doc blocks during development? Which text editor are you using? Any special tools are you using for magento2?
Konstantin G. 8 months ago
You are very welcome. Please check out my guide for server optimization tricks. I am using vim. I don't use any special tools except the vim text editor which I love.
Abdulaziz Mohammed 10 months ago
That's a great guide Konstantin, but I want to ask what's the difference between Varnish and Redis, because my web admin set up Redis on AWS. So do I need Varnish with Redis or they do the same thing with the same performance?
Konstantin G. 5 months ago
Main difference is that Redis does speak HTTP. Varnish can.
Nepali Duniya 11 months ago
Your information is valuable.
Konstantin G. 11 months ago
Thank you.
Mohammad nasim 11 months ago
Hi could you add new video on Backend to add custom field on bundle option ?
Emil Shamloo 1 year ago
Thanks. Stores/configuration/advance/advance is moved. Anyboady know where it's been moved?
Konstantin G. 1 year ago
Correct, they removed it in M2.2+. You can now enable / disable modules by running: php bin/magento module:enable or php bin/magento module:disable. To check modules status run php bin/magento module:status
Peter Gustafson 1 year ago
Great information. I've heard you guys are the best at Magento optimization.
Konstantin G. 1 year ago
Thank you!