Brendan Tully0 Comments
April 30, 2022
Trouble with Magento speed or the site is running slow? We’ve been running our agency for over 10 years and initially struggled whenever we took on a Magento client – the sites were usually slow, clunky and difficult to deal with.
Site speed is a critical component of user experience, conversion and also Google rankings – Google have publicly said many times that site speed is part of their algorithm.
In this post we’ll share how we fix slow Magento and also some additional Magento Site Speed Optimization action items so your site is running as fast as possible.
NOTE: Be clear on which version you’re running
It’s important that you’re clear on which version you’re running, it comes in two flavours version 1 and version 2. At the time of writing version 1 is up to 1.9.x and version 2 is upto 2.2.x
They have different system requirements and typically v2 will run faster than v1 but it’s important before you go changing settings that you know which version you’re running. If you log into the backend of your site you should see the current version you’re running in the footer.
Contents
What we found with our agency clients is that the Magento sites we were having trouble with were on poor performing hosting, many of which were dedicated VPS servers.
Most of these servers had huge amounts of processing power with 4 or 8 cores, often more, but the sites were still running slow. What we learnt is that while raw server performance is important, it’s only part of the picture.
The server stack (the software it’s running) and how that software is configured is at least as important as the raw power available.
A few years back we came across Cloudways who have now become our hosting provider of choice.
They have something called their Thunderstack – effectively it’s a speed optimized server stack that includes Memcached, PHP-FPM, Nginx and several other applications that are geared for speed.
The server stack your hosting uses is a key component of getting Magento to run FAST
A dedicated server with a speed optimized stack starts at $10/month and we’ve found these servers are often faster than $80/month dedicated VPS servers elsewhere.
Cloudways also handle migrations for us. Check them out at Cloudways.com – if you use the coupon code WPSPEEDFIX you’ll get $25 off your first invoice which is effectively month 1 for free.
Cloudflare.com is a service that sits in front of your website hosting and from a speed perspective is like magic!
They’re the fastest DNS hosting provider in the world (see http://dnsperf.com), they’re a content delivery network (CDN) and website acceleration service AND even the free plan will give you a serious speed boost. Because it’s a CDN it will significantly speed up your website for your international visitors.
A lot of hosting has Cloudflare functionality built-in into it with an option in the Cpanel – if you have that then turn it on.
Cloudflare is HTTP2 compatible so if your host doesn’t support this newer protocol Cloudflare will give you that functionality thus further speeding up the site.
Advanced Cloudflare If you want to take it to the next level the $20/month business version of Cloudflare is well worth a look.
It includes advanced image optimization that converts JPG and PNG to WEBP files where the browser supports it and there is a file size saving and includes a fairly powerful firewall to keep your site secure and also allows you to setup full edge caching.
The image audit tool will give you a good idea of how much compression you’d expect to see using the paid version of Cloudflare and .webp images: https://webspeedtest.cloudinary.com
When your site is running in HTTPS mode (encrypted) your web browser software will use the newer HTTP2 protocol (so long as your host supports it) which is significantly faster than the older HTTP 1.1 protocol.
Click play on the video below and you’ll see the speed difference between the two. Important note, your host needs to support HTTP2 and most cheap hosts don’t, use the link below to check your host for compatibility.
HTTPS is also important for SEO and Google rankings and is now also part of the ranking algorithm.
Contrary to a lot of things you’ll read around the web, HTTPS will not slow your site down if your host if HTTP2 compatible. Cloudflare also has a feature called 0RTT (zero round trip time) which speeds up the HTTPS encryption negotiation even further!
**Important** your host needs to support the HTTP2 protocol in order for this to work, use this tool to confirm support: https://tools.keycdn.com/http2-test
One of the ways Cloudways helps our Magento client sites load so fast is memory caching using applications called Memcached and Redis.
These are memory caching applications that allow the web server to store data commonly used, such as database queries, in the server memory instead of having to continually query the database.
The server memory or RAM is significantly faster that the database that is stored on the hard disk so this significantly speeds up the site.
This guide explains how to use Redis and Memcached – Cloudways comes with Memcached already installed out of the box, Redis needs to be installed (it’s a simple button click) so a lot of the hard work is already done for you.
https://devdocs.magento.com/guides/v2.0/config-guide/cache.html
For Magento 1.9 Memcached is also supported. Make sure caching is enabled as per this article:
https://docs.magento.com/m1/ce/user_guide/system-operations/cache-management.html
Here’s an article on configuring Memcached on v1.9:
magenticians.com/configure-memcached-with-magento/
**If you have a large site with high traffic it may be worth getting Varnish caching setup also. This will help further speed up the site but it does come with some added complexity which is outside the scope of this article.
PHP is the underlying language Magento is built on and it comes in different versions. V5.6, 7.0, 7.1 and 7.2
Magento 1.9 supports PHP upto version 5.6 so if you’re running anything less than this, eg 5.4 or 5.5 then changing/upgrading the php version to 5.6 will give you a speed boost.
Magento 2 supports PHP 7 and new versions, eg Magento 2.3 support PHP 7.2 which is faster than version 7.0. This article digs into specific PHP versions in more detail:
https://community.magento.com/t5/Magento-DevBlog/From-PHP-7-0-to-PHP-7-2-in-Magento-2-3/ba-p/91371
Image compression is an important part of speed optimization. Often images are uploaded with little or no compression which means their file size is larger than they need to be. Compression reduces the file size while retaining the quality.
There’s a lot of different image optimization tools out there – one of our favorite is Kraken
If you want to see how “compressible” your images are check out this image audit tool: https://webspeedtest.cloudinary.com
It’ll give you a good idea of how compressible your images are and how much the size of your pages/site can be reduced.
Generally we use sitespeedbot.com for speed testing as it’s the closest to real world speed. Ultimately our goal is under 1 second load times, thats where the page load begins to feel instant. Most sites on good quality hosting should be able to get to 1.5 second load times with relative ease.
* Denotes Required Field