Do you run your business on Magento 2 and does it loads very slow?
Or planning to migrate your store to Magento 2 for the sake of speed.
The importance of the fast loading page speed is well known. But with the Core Web Vitals and the mobile-first indexing, speed has become a competitive factor among e-Commerce stores.
Well, it turns out, you can dramatically speed up Magento 2 store with a few simple magento 2 speed optimizations.
15 Proven Ways to Speed Up Magento 2 Store
- Full Page Caching
- Choose Fastest Magento hosting
- Select Production Mode
- Enable flat catalog
- Merge & Minify CSS, JS Files
- Clean Magento Logs and Database
- Image Optimization
- Avoid JavaScript bundling
- Perform 3rd-party Plugins Audit
- Optimize TTFB
- HHVM (HipHop Virtual Machine)
- Optimize Your Code
- Have fewer modules and extension
- Install a CDN
- SQL Configuration
Why people prefer Magento over others?
Developers opt for Magento for building e-commerce sites for the following reasons:
1. Magento is Open Source
Yes! Magento is Open Source and free to use. The 3 versions of Magento are:
- Magento Community Edition (free)
- Magento Enterprise Edition (paid)
- Magento Go (paid)
Magento Community Edition is used the most by the developers’ community. Learn the difference between Magento Community and Magento Enterprise Edition.
2. No Incremental Charges
You don’t need to pay any extra charges when you grow bigger unlike other ‘made for e-commerce’ platforms like Volusion and Shopify.
3. SEO-Friendly
Magento is considered to deliver SEO benefits, hence giving you greater visibility and organic traffic.
Must Read: Magento 2.4 – Highlights
Slow Speed can Hurt your Business
The slow speed of your Magento store can impact your sales metrics negatively, and also harm your conversions.
According to Retail TouchPoints, a 0.1-second delay in your site can hurt 7% conversions!
You can’t afford to disappoint your customers due to the poor performance and speed of your Magento store.
Reasons for Slow Load Time of Magento Store
In my recent Magento store research, I found out 40.94 % of Magento stores are taking more than 3 seconds to open. And the primary reasons were:
- A surge in HTTPS requests.
- Failure to deploy a Cache system or a Content Delivery Network.
- Heavy-weighted Web pages.
- Server Latency
There could be other reasons too but can only be identified after thorough introspection of the magento 2 website.
Speed Up Magento 2 Infographic
15 Proven Ways to Speed Up Magento 2 Store
- Full Page Caching
- Choose Fastest Magento hosting
- Select Production Mode
- Enable flat catalog
- Merge & Minify CSS, JS Files
- Clean Magento Logs and Database
- Image Optimization
- Avoid JavaScript bundling
- Perform 3rd-party Plugins Audit
- Optimize TTFB
- HHVM (HipHop Virtual Machine)
- Optimize Your Code
- Have fewer modules and extension
- Install a CDN
- SQL Configuration
1. Full page Caching
Caching is the key to super fast speed. Your eCommerce store loads much faster when there is a minimum load on the server. It’s like feeling light and energetic when your mind is at peace.
Full-page caching works amazingly well when it comes to speed up your Magento 2 stores. The rule of thumb here is to keep your server as light as possible.
Here’s how you do it:
System > Cache Management > Select all > Enable > Submit
2. Choose the Fastest Magento Hosting
Well, it’s an obvious one! Hosting is the foundation of your M2 store. You can put everything in place perfectly still your site can go sluggish if you are with the wrong host.
You can’t have a fast Magento 2 store on a cheap VPS. Therefore, you must have a fast, reliable web host to improve Magento 2 performance.
Seek following 3 things from your Magento 2 web host:
- High-security standards
- High-speed connection
- 24*7 customer support
P.S. With a quality magento hosting provider also helps in magento 2 performance optimization. ServerGuy is there to provide 24*7 customer support and handle all your issues quickly and easily.
Read This: VPS vs Dedicated Hosting: Difference you Need to Know
3. Select Production Mode
When we talk about Magento 2 performance optimization checklist we can’t skip this one. Because it improves your store’s performance significantly and is specially crafted for Magento 2 platform.
M2 incorporates three running modes: default, developer, and production. Running your store on default or developer mode won’t do any good to your site speed.
So, in order to speed up Magento 2, always run your store on Production mode; amongst all, production mode is the fastest.
Here’s how you do it:
php bin/magento deploy:mode:set production
4. Enable Flat Catalog
Magento is based on EAV model (entity attribute value) to store product and customer data.
What happens when you enable the flat catalog?
- Merges data into one.
- Improves performance by responding to MySQL queries faster.
- Beneficial for those eCommerce stores having 1000+ products.
How to do?
- Go to “Stores” → “Configuration” → “Catalog.”
- Under “Storefront” change “Use Flat Catalog Category” and “Use Flat Catalog Product” to “Yes.”
- After this, “Save Config” and clear the cache.
5. Merge & Minify CSS, JS Files
Magento 2 comes with an option to merge, minify and bundle. Make the best use of it because you will get rewarded with enhanced Magento performance and great speed.
Merge and minify both CSS and JavaScript files to make the web page as light as possible, and ultimately speed up your Magento 2 store.
Here’s how you do it:
4.1 Merge & Minify CSS
- Open backend
- Stores > Configuration > Advanced > Developer > CSS Settings
- Set “Yes” for both Merge CSS Files and Minify CSS Files Options
4.2 Merge & Minify JS
- Open backend
- Stores > Configuration > Advanced > Developer > JavaScript Settings
- Set “Yes” for both Merge JavaScript Files and Minify JavaScript Files Options (like done in the image).
6. Clean Magento Logs and Database
Since Magento keeps logs up to 180 days, your database can become heavy.
It is advisable to change the setting to the lowest value, i.e. 14 days and clicks on “Save Config”.
For manually cleaning up the database, you can:
- In phpMyAdmin, select all of the log_% tables and select “Empty” from the drop-down.
- Select “Yes” when it asks to TRUNCATE the tables.
7. Image Optimization
Since images account for 50% to 60% of your web pages’ total weight (Radware, 2015), it becomes crucial to optimize images to speed up Magento.
Must Read: An Ultimate Magento Security Guide You Need
Benefits of optimizing images:-
- It can dramatically increase the speed of your pages.
- Images can be compressed before uploading with tools like PhotoShop or other auto-optimize tools.
For Magento version <2, users can choose the following magento 2 speed extensions:
- Compressor Extension
- TinyPNG Extension
8. Avoid JavaScript Bundling
Although bundling is an innovative feature brought by M2, JS bundling is not something you wanna do if you are already using HTTP/2 and really want your site to speed up.
Why? Because the bundled JS file is huge in size; it takes around 5-13 Mb of space. It can make your M2 store speed suffer significantly.
9. Perform 3rd-party Plugins Audit
This is probably one of the most important steps to enhance your store’s performance. Custom extensions make Magento 2 heavy and sluggish; the more is the no. of 3rd-party plugins the slower will be your store.
Thus, performing a 3rd-party extension audit can give you a sigh of relief.
Custom extensions do more harm than good. Many 3rd-party plugins are created by amateur coders whereas Magento 2 core is written by world-class professionals. So, which one would you choose?
Obviously, the one that comes straight from the experts and makes your Magento faster will be the right choice, and they speed up magento 2 development too.
Here’s how you do it:
- Disable all the custom extensions one by one
- Benchmark speed with and without an extension
- List out the extensions that take the most time to run
- Contact their vendors and ask to patch
- In case of no patch, just remove the extension and find a substitute
Tip: JMeter is our favorite tool for benchmarking. You can use this tool to check which custom extension is making your site slow.
10. Optimize TTFB
TTFB or Time To First Byte is the time a browser’s request travels to the server and the server responses back to it (latency).
This is why Time To First Byte is also referred to as Server Response Time. It is also the time when the server generates HTML.
Google suggests that your TTFB should be much lesser than 200ms. Otherwise, it’s considered bad TTFB. Thus, the Server Response Time Audit is a quintessential task to speed up Magento 2 and rank better on Google.
Read TTFB All you need to know about time to first byte
11. HHVM (HipHop Virtual Machine)
HHVM is a special open-source virtual machine or server software based on JIT (Just-In-Time) compilation that eCommerce store owners can install and hook up with Magento 2.
It replaces php-fpm and can work with Nginx or Apache.
Being a store owner you should use it because many famous brands like Facebook are also using HHVM to do better and load fast!
12. Optimize Your Code
There is no surprise that complex PHP code in Magento makes your site slow. Optimizing your code becomes a necessity when you are using a heavy platform like M2.
To make it easy on you, we have divided this point into several segments:
9.1 PHP Accelerators:
For the heavy PHP coding, you can use the PHP accelerators for code optimization.
The PHP accelerators cache the PHP scripts used in the web page and make your store faster.
9.2 Reduce third-party JavaScripts:
Inspect all the third-party JavaScript files in your Magento 2 store carefully. Use random, third-party JS codes with caution and always run a test for speed.
9.3 Disable/Limit PHP Modules:
Since many PHP modules do no good to your website speed and still sit back there to make your M2 store slow.
You must uninstall the unwanted PHP modules from your coding section to clean up space.
9.4 Don’t abuse jquery.ready:
Sometimes we put CPU intensive tasks in jquery(document).ready. This ultimately slows down the page loading speed. Therefore, choose onLoad events very carefully so as to avoid any lag.
13. Try to Have fewer Extensions & Modules
More the extensions, the more HTTP requests, CSS and Javascript files there will be.
This will result in increased load time. Keep your Magento with as few extensions as possible.
For disabling the modules, you can follow these steps:
- Navigate to “Stores” → “Configuration” → “Advanced”→ “Advanced”.
- Click “Disable” on the modules you don’t need. Further, select “Save Config.”
14. Install a CDN (Content Delivery Network)
With CDN, you can decrease the load time drastically.
A Content Delivery Network is a large distributed system of servers that store files and web content closer to the user requesting them.
- Closer the CDN server to a user = Faster content will be delivered to the shopper.
- It ensures that your product images, CSS, and Javascript are loading faster to your users.
- It also offloads some of the server’s stress and leads to fewer processes being required per customer, reduced bandwidth costs, and improved response times.
15. MySQL Configuration (Query Caching)
Every time a Magento page is loaded, there are a series of database queries made and the database server must go to work. The long query process takes times and there is slower disk access which results in lower performance.
Solution: MySQL has a built-in configuration parameter known as query_cache_size. This helps to store the result of the query in memory which is much faster than accessing from disk.
Conclusion
It’s not rocket science to speed up Magento 2 store’s performance and boost your sales. It’s as simple as practicing the given tips and tricks.
I hope this post helps you to know how to optimize magento 2 website and improve magento 2 performance.
Note: For an instant boost in your eCommerce performance combine all these amazing tips with the fastest managed Magento hosting in the market. Because above all, your eCommerce store requires a good host to work fast and be secure.
Don’t have the time or expertise? Talk to our experts and we will analyse, optimise, and manage your Magento site to the best.