April 23 2022

Improve Magento eCommerce speed by using Varnish Cache

The importance of an enterprise-grade Full Page Cache and the advantages of your Magento and Magento 2

Magento 2 Hosting Varnish Cache Banner

In recent times we have been literally bombarded with Magento Hosting and Magento 2 Hosting requests. We are talking about an average of about 6 requests per day which given the complexity and costs of Magento development, and given the reduced diffusion compared to the much more adopted WooCommerce and Prestashop however, it does a very high average.

In all the analyzes we have done for two months now we have noticed a common denominator, all those who contact us complaining about the slowness of their ecommerce, do not use Varnish.

Maybe many have adopted the Free version of CloudFlare, have adopted very expensive hardware resources on Amazon AWS with requests for over 1000 euros per month, but nevertheless they contact us because they complain about slowness, and from the analyzes we carried out we then discovered that the lack of Varnish is precisely the cause.

We have already talked about Varnish in a very exhaustive way in many posts on our blog, being in our opinion a tool that can really make a difference if used wisely.

What is Varnish?

You may be wondering what Varnish is. Well, if you're looking for blazingly fast caching technology (or reverse caching proxy), you're on the right track.

It works on the principle that a user reaches the Varnish server just before the request is redirected to the web server (if a cached version is not available). It will only take a few milliseconds for the page to be delivered from the Varnish cache in case a cached version of the request is available. Response time depends on hardware, but since loading a prepared response from memory is much faster than having the web server process everything on disk by running PHP and MySQL, using Varnish is much faster than just Magento cache mechanisms.

Varnish MagentoIn other words, Varnish is an HTTP booster. There are several ways to use this technology: as a failover system, reverse caching proxy, or load balancing. All of these ways will result in surprisingly increased Magento site performance.

The configuration language of this technology is known as Varnish Cache Language (VCL). It will be converted and compiled into C code. All the contents of the cache will be immediately provided by the service memory. You might think about applying Magento Varnish if your websites are having trouble getting traffic or are essentially cluttered.

Main advantages of Varnish and Magento

Caching is a frequently applied practice that helps to store data ready for recovery without the need to rerun all the processes to model this data. To make all this data available at any time, it is important to store it in RAM memory or on a disk with fast reading speeds. It excludes the need to download them again and thus saves a lot of time and nerves.

For example, your browser cache will cache resources such as images and JavaScript when you use appropriate caching tools. Varnish takes your site caching to a new level. Whenever a visitor comes to your website, a series of requests are sent to the server to load the page. The server starts looking for files that match the requests. It requires running any server-side code related to the request and then sending the fully rendered web page to the client.

 

Having Varnish means having a tool that will check for duplicate requests already received previously. After the first visit to a page, Varnish will create an exact copy of what is returned to the user. In other words, the next time a user accesses the same page, this proxy will recognize the previous request so that it responds faster with a cached version of the result.

With the help of this simple method, any online entrepreneur can increase the speed of his website 300-1000 times! Varnish is not a specific technology to use with Magento, but due to the large amount of Magento performance issues, it has now become a best practice and strong advice from the Magento and Adobe community,

Furthermore, whenever the site is hit with large amounts of traffic, it is sufficiently equipped to cope with it. It works so that the time it takes to return a cached result requires less processing power than completing requests from the beginning, while limiting CPU spikes.

Improved conversion and sales.

Together with Magento optimized with Varnish, you can notice a significant improvement in your conversion. Conversion potential is directly dependent on page loading speed. Going up, this feature contributes to the overall profitability of your website. There is a number of successful examples. For instance,in the case of Walmart, reduced page load time by 1 second and this resulted in up to 2% increase in conversions. As for Amazon, each 0,1 second increase in load time reduces sales by 1%. While these companies may operate on a different playing field, you should be able to spot the difference that page loading speed makes.

SEO improvement

According to the most important search engine in the world, page load time can have a positive or negative effect on your shop's ranking. Since one of Google's primary purposes is to only display those sites that offer the best user experience at the top, you risk failing if your website runs slowly. Even if you offer the best products at fair prices, if your competitor's online store loads faster, it will likely negatively affect your ranking for your desired keywords.

About a year ago, since Google declared that the site performance would become a ranking factor, the priorities of developers and digital marketing agencies have changed.

With the term "Page Experience" Google summarizes numerous factors that make the usability of a site measurable: together with the use of HTTPs, optimization for mobile devices and the abandonment of Interstitials, Core Web Vitals have a particularly prominent place.

Thanks to them Google can in fact measure the performance of a site through 3 different metrics: the loading time (Largest Contentful Paint, LCP), The reaction rate (First Input Delay, IN) and the visual stability page (Cumulative Layout Shift, CLS).

Improved user experience

Pretend you are moving around the website and watching the upload icon rotate for a while. Most likely, you will return to the search engine to choose another similar site that loads faster. Keep in mind that a shorter page load period could potentially reduce the bounce rate from your page.

One-time installation

Many Magento applications or extensions require regular updates due to the rapid progress of e-commerce. But it's different for Varnish.

Once installed, this caching technology will, in theory, last for the life of your website.

You don't need to do any additional work to configure this proxy thanks to some specialized Magento extensions. Modify the Varnish configuration to fit Magento. Magento behaviors are also modified to stimulate caching rates.

To sum it up, fast page loading offers any online business four benefits:

  1. The increase in conversion rates.
  2. Reduced rate of abandoned carts on your website
  3. Reduced waiting time for viewers to view your content.
  4. Improved SEO value.

Together with Magento native Full Page Caching, Varnish becomes the best solution for full site optimization and page loading speed. After installing this caching technology, Varnish will immediately lighten the load on your web server. All the benefits it boasts will be noticed if your site generates high traffic. Magento and Magento 2 sites make the most of Varnish as they use a large number of web server resources when generating the pages. By choosing Varnish and configuring it correctly, you will see significant speed improvements very soon.

Reduced costs in the short, medium and long term

One of the concerns we see most often is that of costs.

"Eh but the costs?", "It costs a lot"?

These are the classic questions and the most recurring concerns once we finish a call with a potential client. A little as if Varnish were a very expensive software or service and must necessarily cost prohibitive figures.

Let's immediately dispel this myth by making the following premises:

  1. Varnish is an Open Source software, free, you can download and install it for free.
  2. Varnish has strong documentation for Magento and MAgento 2 and vice versa, Magento and Magento 2 have strong documentation for Varnish
  3. The cost of putting into production / configuration / testing usually takes half a working day for painstaking work done with gloves.
  4. Therefore, the cost can be really cheap and indicatively it can have a value of € 250 which is normally preferred to "spread" in the cost of Hosting.
  5. The costs of European services are notoriously much cheaper than the same services provided in high-income countries (the United States above all)
  6. Having 16 CPUs with 64 GB of RAM on a dedicated server is much cheaper and more profitable than having the same ones on Cloud instances on Amazon AWS eg.

For example, a customer who buys Varnish Hosting on a high-end dedicated server (12 threads, 64GB of RAM, 2 × 512 SSD nVME in RAID1) will not pay the cost of the Varnish installation, but will simply find the service included in the Magento Hosting service rental from 150 € per month.

We already know that there will probably be competing companies that are making you spend 300, 500, 1000 euros a month for a trivial hosting, giving you less hardware power and no system optimization, let alone Varnish.

Maybe you add unnecessarily CDNs, AWS instances in which you pay every single byte out and you are doing it only because you have seen others do it or because your company that follows you at the IT level does not know how to use the right tools correctly.

You can easily eat the minister with a fork and say that it works, but don't complain if it takes longer and the experience is not the best.

Conclusions

Varnish Cache is beneficial both for users who need assistance to perform essential functions and for advanced users who have extensive experience in technology.

Since i Magento sites they use a lot of web server resources, makes the most of Varnish.

Once the Varnish cache was installed correctly and configured to work with Magento, we'll look at a few significant speed improvements.

Let's start your journey together to become a professional and high performing Magento site.
Contact now and we will find the best Magento hosting solution for you.

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.

0256569681

Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.

INFORMATION

Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds owns the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Facebook, Inc. owns the rights to Facebook®; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV This site is not affiliated, sponsored, or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a registered trademark at European level by MANAGED SERVER SRL Via Enzo Ferrari, 9 62012 Civitanova Marche (MC) Italy.

Back to top