5 Essential Magento Performance Tips Most Developers Neglect
These five tips will help you boost your Magento site's speed and user experience.
Join the DZone community and get the full member experience.Join For Free
2018 is almost over. Time to make a few New Year's resolutions for 2019. We suggest giving your Magento store some love. Speeding up Magento doesn’t have to be hard or long if you follow our list of five tips that will help you boost page load and improve user experience.
As a freelance developer, I keep seeing speed problems @ my clients' sites. This quick checklist will help you solve most of Magento speed issues.
You also don’t have to be a developer to use them. Our performance tips will not test your programming skills. They are exactly as advertised – improvements that are simple to implement, fast, and immediately noticeable.
So let’s give your Magento install a nice boost!
1. Kill the Extensions You Don’t Use
That’s right. The first tip is the easy one. You might have seen it before. But we want to emphasize one point. About a third of all installed extensions in your store do nothing except take up valuable resources.
Remember that neat module you checked out half a year ago and never used since? It’s still there. Doing its thing or just sitting around in your Magento install slowing you down.
But there’s something important you need to know first.
There’s a difference between disabling an extension and removing it completely from Magento. Disabling is a step in the right direction but it has a few shortcomings. Your extension is still present in the system which means it will still impact performance using up cron time and physical space in Magento Modules directory.
So the right choice is to completely delete unused extensions from the store.
Easy to fix. We’ll show you how.
Fire up SSH and get to your Magento install. We assume you already know the name of the extension you want to get rid of. Let’s call ours UselessExtension1.
php bin/magento module:disable UselessExtension1 --clear-static-content php bin/magento setup:upgrade cd app/code/UselessExtension1/ rm -rf UselessExtension1
With the first command, we disable our useless extension and clear all static content it might have been using. Then we order Magento to revise itself and clear cache after a significant change to its installation. The final step is to go to the extension folder and completely delete it. Done and done.
Nice job. Delete a few more extensions that you never use and let’s move on to the next tip.
2. Upgrade to a Faster DNS
This one is also simple and free. You’ll like it, we promise. So here’s the thing. In November 2018, Cloudflare introduced full platform support for its new DNS service which is 28% faster than Google or CISCO DNS and even more secure.
Showing some love to e-commerce community, Cloudflare also released a free Magento extension that you can download and install right now. Download the extension at the Magento Marketplace and enjoy faster domain resolution speeds.
3. Optimize Magento in Developer Mode
Magento 2 is constantly evolving but some things have to be done by hand. We are talking about the small tweaks that can make your customers’ shopping experience so much better.
For these tweaks, you’ll need to get Developer mode active.
Use SSH and execute the following line:
php bin/magento deploy:mode:set developer
Now go to Stores > Configuration > Advanced > Developer. The Developer tab will only appear when you are in Developer mode (obviously!) but any changes you implement will carry over to other modes as well.
What we are looking here is… well, a few things actually.
Next thing you want to check is whether CSS Merge and CSS Minify are on. They are in the same menu but a bit lower.
Get to Stores > Configuration > Advanced > Developer > CSS Settings, find the two CSS settings and turn them on.
php bin/magento deploy:mode:set production
Double-check that you have returned to Production mode. Enter this line:
php bin/magento deploy:mode:show
It should return the following:
Current application mode: production.
4. Turn On Varnish Caching
Have you already switched from Developer mode to Production? Don’t be in such a hurry. There’s another great tweak we want to share with you. It’s not available from either Default or Production mode, only Developer.
Cache management in a pristine Magento 2 installation is governed by a built-in Magento caching tool. This is not the best solution for your store.
Go to Stores > Configuration > Advanced > System, navigate to Full Page Cache, uncheck Use System Value option and turn on Varnish Cache. It’s a recommended option after all!
Don’t forget to hit Save Config to apply changes.
5. Use Redis for Backend Cache
If you have come this far and implemented all our recommendations, we have another one ready. Mind you, this last one is a bit tricky. Redis is an optional upgrade to your backend caching solution.
It replaces Zend_Cache_Backend_File and helps make Magento faster and more reliable.
Here’s how you do it. The quick start option:
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make sudo make install
These commands download and install Redis (the link always points to the latest version) and get the server ready.
To start Redis, use this:
Check if Redis is working:
$ redis-cli ping
The correct response to ping is PONG, of course.
Meet Your New, Fast, and Reliable Magento Store
You are all set! Congrats! Meet 2019 with a cool and snappy Magento web store. There are obviously many more advanced Magento speed optimization tactics, but you'd be surprised at how many people skip even these basics.
Opinions expressed by DZone contributors are their own.