Magento 2 is one of the most powerful, extensible ecommerce applications available. However, the architecture makes a fast loading website a challenge. In this paper, we describe the technologies needed to minimize page load times. We also document the testing to prove the recommendations
1.0 WHY SPEED MATTERS IN A MAGENTO WEBSITE
Let’s face it, visitors want to interact with fast loading websites; and it is not just website visitors, even search engines want sites that load within milliseconds. A fast loading Magento website is mandatory today, among other key features and functionalities of web stores. So if your e-commerce website is not delivering these customer demands, be assured your rival will. A true mark of success of an online store is how fast the pages load. In other words, customer conversion is only guaranteed by the optimum loading speed of your site, nothing less.
As noted in Section 1.0, the speed of your Magento website no longer depends entirely on the system hardware, as long as caching is done right with LiteMage, Redis, and CDN. The proximity to the data source is no longer a huge hindrance to your site’s speed, and everyone starting an online store is leaving nothing to chance.
To reiterate, a fast-speed website not only gives the visitors a stellar shopping experience but also ranks your site higher in search engines. The modern online buyer will use various devices to access your site, including mobile devices. Therefore, such versatile users will not wait for a site page to load for more than 3 seconds, but will quickly close the tab and reach out to a competitor’s site with faster load speeds. That’s rough.
In fact, research indicates that 18% of online buyers abandoned an order in the past quarter citing long checkout process. That means 1 out of 5 shopped abandoned the checkout process because the pages took too long to load. So it is never enough for visitors to visit the store’s homepage, browse the products, and pick the products they want; if the load times are slow, they will drop the shopping cart and leave. To wrap this up, faster page loading speeds is everything, not something.
That said, are you ready for practical Magento 2 testing?
2.0 WHAT IS LITEMAGE CACHE, REDIS AND CDN?
LiteMage Cache is the leading full-page caching solution for Magento 2. LiteMage is built on top of LiteSpeed Cache (LSCache), and is tailored specifically for Magento; and thus, able to assemble both public and private blocks using Edge Side Includes (ESI) in punching holes, for the best and fast performance.
The core function of the LSCache in a LiteMage Cache is to accelerate dynamic content (apart from PHP pages), aided by a customizable and efficient LiteSpeed Cache, resulting to reduced page load time and server load. In addition, LSCache removes the extra reverse proxy layer (s) needed by add-on cache packages (like Varnish), giving you a fast and efficient handling of static content, plus exceptional handling of dynamic content. That is what makes LiteMage Cache a world-leading fastest caching tech for Magento 2.
Figure 1: LiteMage Cache shortens server stack and eliminates overhead; credit: LITESPEED
Redis is an optional, backend cache solution, used as a Least Recently Used (LRU) cache, evicting old data automatically as you bring in new data. LRU, as a supported eviction method, serves to limit the memory usage to a specified or fixed amount for the data set. Redis offers a fast speed on Magento, making it a must-have, exceptional cache layer.
Magento Redis Cache can be used in multi-server situations, cases where there is more than a single web server. The end result is a stable, high performance in a Magento store, generating high traffic in return.
Lastly, a Content Delivery Network (CDN) is a tool that provides high-traffic Magento websites with a global reach with high-speed content delivery. Visitors to your Magento store demand flash sales, fast checkout process, HD videos, all at a lightning speed. With a CDN enabled, your website is able to handle such enormous amounts of data demands as fast speeds. In addition, a CDN servers cushion websites from huge surges in traffic, and accelerate the speed for visitors from any location in the world.
Now that you know what LiteMage Cache, Redis, and CDNs are, why does speed matter so much in a Magento Website? Why is the Google 2021 algorithm update focused on speed?
3.0 TESTING PHASE
There are several modifications that can be done to your website from the server level as well as the application that will greatly improve your response time and increase your requests per second. Magento recommends at the very least. that you enable a caching method on your webstore, such as the built-in cache or Varnish. And many websites stop their optimizations right there, at the very least. If you think that enabling Varnish cache is going to make your site fly, you might want to consider your cache option as a baseline requirement and not so much an optimization. In this section, we will prove that while caching will indeed speed up your website, adding further optimizations such as LiteMage Cache, Redis, and a CDN will take your site’s speed to the next level.
In order to measure performance on Magento we used the load testing tool provided by K6. We setup a server with Magento 2 using these specs:
- Memory Size: 9GB
- CPU: Intel Xeon Processor
- CPU number: 4
- CENTOS 7.9 kvm
- LiteSpeed Web Server v5.4.8
- Magento Open Source ver. 2.3.6
- Sample Data
- PHP ver. 7.3.26
We performed three tests in order to show the impact of caching on Magento 2 as well as the significant improvements achieved by adding further enhancements to your website. Using K6, we recorded a simple user scenario simulation of visiting a category page, product page, and adding to the cart. We then ran the scenario using 10 concurrent Virtual users over a period of 5 minutes.
3.1 TEST ONE: NON-CACHED
For this first test, we ran the simulation on a non-cached site.
The average response time of the system being tested was 249ms, and 9 428 requests were made with 9 failures, at an average request rate of 28 requests/second.
The AVG Response Time here is also a bit misleading since it does not include the failed requests which timed out trying to load the pages. When browsing this site as a regular user, page loads are roughly 11 seconds long when no caching method is applied.
What this test does show is a site with very poor performance as expected. With only 28 requests per second on average, it would be a frustrating store to shop for your end users.
3.2 TEST TWO: WITH CACHING ENABLED
For this second test we enabled the built-in cache feature in Magento and ran the same simulation in K6
The average response time of the system being tested was 66ms, and 36,241 requests were made at an average request rate of 110 requests/second.
This is a noticeable improvement from the first test. As we can see here the average request rate has more than tripled. Caching has made it possible to fulfill more requests per second and the response time for pages has greatly improved to an average of 66 ms.
This performance might be suitable if you only have a small amount of traffic on your website.
3.3 TEST THREE: FULLY OPTIMIZED
On this test, we enabled advanced optimization features including LiteMage Cache, REDIS, and a Content Delivery Network (CDN). We then ran the same simulation again in K6.
The average response time of the system being tested was 6.13ms, and 357,435 requests were made at an average request rate of 1,172 requests/second.
As we can see from this test, there has been an exceptional improvement to the site speed and throughput. The average request rate has improved to over 10 times faster than the previous test and the average response time per request nearly 6 ms. With these enhancements on your website, you will be able to serve pages quicker as well as handle an increased amount of contiguous user traffic.
Enabling cache on your Magento site will improve your speed and throughput but it is nowhere near the impact of having the further enhancements of LiteMage cache, CDN, and Redis enabled.
It is crystal clear that the higher the speed oy your webstore, the higher the conversation rates and search engine ranking. Online shoppers will leave your site in a whim if they experience slow loading times, regardless of the stage reached in the checkout process. There is no better, proven way for optimizing your store’s performance than having the further enhancements of LiteMage cache, CDN, and Redis enabled.
At Web 2 Market, we love winners in the game. It is such a delight to see visitors to your e-commerce store go through an unforgettable shopping experience marked by top browsing speed and optimized performance. Get in touch with us, and our team of professionals will take you through what a modern webstore should look like. At the end of day, we all want customer loyalty through high engagement and conversation rates, don’t we?