Contact Us
Optimise Magento 2 Performance with Caching
R&D

E-commerce Best Practice Part 1: Optimise Magento 2 Performance with Caching

E-commerce appears to be growing at an unprecedented rate, with retail businesses whose presence was limited to bricks and mortar now rushing to implement retail commerce platforms and open online stores. But even well-established online retailers are now scrambling to keep up with the ever-growing load on their platforms. According to a recent Alexa study, 20% of all e-commerce websites are powered by Magento. So finding ways to enhance Magento performance is crucial for e-tailers.

According to recent data from the Adobe Digital Economy Index, online shopping has now become the primary mode of commerce. In April 2020, U.S. e-commerce saw a 49% rise in daily sales compared with early March—before “stay at home” measures were introduced. Online grocery shopping has seen the biggest demand, with a 110% boost in sales figures for the month of April. Electronics sales were also up 58%, and purchases of books have doubled.

This trend has been mirrored throughout Europe. Since social distancing was introduced, 57% of European consumers have begun to shop online more—with about 30% spending more on virtual experiences. And it seems that essentials and books have become the key drivers of online shopping.

Daily order trends during the Coronavirus pandemic in Europe 2020
Optimise Magento 2 Performance with Caching

Source: Statista

Why is performance critical for e-commerce sites?

Statistics show that where loading time is prolonged by just one second, there’s a 7% reduction in conversion.  This has a knock-on effect for site ranking since Google’s search engine sees that visitors haven’t lingered on a page for long—adjusting the website’s ranking accordingly.

80%
of visitors will bounce—that’s to say, never return to a website—if they perceive the site to be slow.
KISSMetrics
40%
of users will leave a webpage if it takes more than three seconds to load.
KISSMetrics

While it’s considered one of the leading e-commerce platforms, Magento 2 has also gained a reputation for performance dips, caused by its heavyweight structure. If your e-store is powered by Magento 2, minimising the risk of a slow load speed is vital to your success and, ultimately, your bottom line. So, we’ve come up with easy-to-deploy solutions that can help you get the best performance from your Magento platform. We’ll cover this in our next article.

For now, we’ll offer some high-level insight on how to optimise Magento 2 performance via caching.

What do you get out-of-the-box with Magneto?

If you have a small e-commerce store with low traffic, Magento’s out-of-the-box offering provides a perfect solution. However, if you’re dealing with a large number of products and orders, one way to significantly enhance performance is to manage the cache more efficiently.

Let’s take a quick look at what Magento offers, out-of-the-box:

  • By default, Magento stores caches in files.
  • Caches are held on the disk, which means that the default cache can’t effectively manage a high number of requests.
  • The file system isn’t optimised for speed. The SSD disk and low load will enable you to work comfortably but, inevitably, this format presents a bottleneck for further growth.

Storing the cache in a database is an alternative to Magento 2’s default functionality. But this isn’t an ideal solution and even Magento developers don’t recommend it. Magento has many functionality issues as well as acceleration tools and, when performance needs to be improved, caching is often the first step. So here’s how to do it.

4 tools for optimising Magento 2 performance via the cache

When it comes to choosing a caching system, we recommend the following options:

1. Memcached

Memcached is a cache system which uses random-access memory (RAM). It is simple and easy to work with and, as such, it’s quite popular. This demand has influenced the creation of various tools to simplify the use of cached data.

Moving caches from slow memory in the file system to fast RAM results in significantly improved performance, but it’s still not necessarily the best solution. Memcached has its own imperfections when used in conjunction with Magento—for example, Memcached doesn’t support tags.

2. Redis

Redis offers rapid data storage within RAM, and it’s this speed which is one of its key advantages. Redis is very fast and, unlike systems such as Memcached, it’s able to handle tags and store data of different types—not just string. Configuring Redis to work with Magento is as straightforward as changing the configs in env.php. As well as this, Redis allows you to keep sessions, Magento configuration cache, and Magento full-page cache.

Due to its popularity, Redis has many interfaces to use with its database—such as phpRedisAdmin.

3. Varnish

Another alternative is Varnish—an HTTP accelerator. It is also able to hold caches in RAM and offers a massive performance boost while reducing server load. One of the biggest benefits of choosing this over another system is that Magento natively supports Varnish, and allows you to perform full-page caching directly from the Magento admin panel. What differentiates it from Redis is that Varnish caches the page after the first download, and can then retrieve the page from the cache and return the full HTML page code.

4. Cache Warmer

Whichever caching system you choose, using a Cache Warmer can effectively improve Magneto’s performance. Magento has ready modules for updating caches. They monitor the caches’ status and, when they’re cleared or missing, a robot opens the pages and fills the caches. So, when a user enters a page, he/she will receive the cached data as soon as they request it.

Conclusion

A sluggish website impacts your conversion rate and overall success. So increasing your site’s loading speed—while it may prove a challenge—will have a positive effect on performance.

If you’re using Magento 2, one of the first ways to enhance its performance is to use a caching system. Default Magento caching doesn’t perform well with a high load, which is why it may be beneficial to choose Varnish or Redis. It’s worth noting the differences between the two, and how they can complement each other. Varnish comes in handy for full-page caching and Redis for backend caches and sessions, for example. Using a Cache Warmer module can also help improve Magneto’s performance, regardless of which caching system you choose.

As you may have noticed from the title, this is just the first part of the series. Check out our article on how to optimise Magento 2 performance via disabled modules for more expert insights.

In the meantime, if you’re looking for ways to improve your website’s performance and boost customer engagement, we will be happy to discuss your needs. Our team at ELEKS has decades of experience providing custom retail software solutions to businesses globally. So don't hesitate to contact us for expert advice.

Have a question?
Speak to an expert
app development
Explore our application development services
Contact Us
  • We need your name to know how to address you
  • We need your phone number to reach you with response to your request
  • We need your country of business to know from what office to contact you
  • We need your company name to know your background and how we can use our experience to help you
  • Accepted file types: jpg, gif, png, pdf, doc, docx, xls, xlsx, ppt, pptx, Max. file size: 10 MB.
(jpg, gif, png, pdf, doc, docx, xls, xlsx, ppt, pptx, PNG)

We will add your info to our CRM for contacting you regarding your request. For more info please consult our privacy policy
  • This field is for validation purposes and should be left unchanged.

The breadth of knowledge and understanding that ELEKS has within its walls allows us to leverage that expertise to make superior deliverables for our customers. When you work with ELEKS, you are working with the top 1% of the aptitude and engineering excellence of the whole country.

sam fleming
Sam Fleming
President, Fleming-AOD

Right from the start, we really liked ELEKS’ commitment and engagement. They came to us with their best people to try to understand our context, our business idea, and developed the first prototype with us. They were very professional and very customer oriented. I think, without ELEKS it probably would not have been possible to have such a successful product in such a short period of time.

Caroline Aumeran
Caroline Aumeran
Head of Product Development, appygas

ELEKS has been involved in the development of a number of our consumer-facing websites and mobile applications that allow our customers to easily track their shipments, get the information they need as well as stay in touch with us. We’ve appreciated the level of ELEKS’ expertise, responsiveness and attention to details.

Samer Awajan
Samer Awajan
CTO, Aramex