Skip to content

Magento 2 Caching Technology

As Magento websites become bigger, bolder, and more complex, they’re known to take longer to load in web browsers. With that in mind, the proper application of caching technologies is important. Paired with great hosting and following web-development best practices, caching helps your site to load quickly and efficiently. The correct combination may even help you to cut down on your hosting infrastructure costs.

However, with so many caching technologies available, choosing the right mix can be a challenge. With that in mind, we’ve put together some helpful notes on some of our favorites:

Full Page Caching (FPC)

Leveraging an FPC solution allows you to save fully-generated web pages such as Product, Category, and CMS pages. In essence, this means that a copy of the page is ready to view; instead of having to retrieve individual blocks of code and database information every time a page is visited.

You do have some choice though. This includes Page Caching: 

  • Default Magento Caching: This is available off-the-shelf with Magento, and is great for beginners that are dabbling with Magento.
  • Varnish: This is our highest recommendation. It’s also the recommendation of Magento’s engineers:

At JetRails, we’ve gone as far as building a Magento 2 Varnish Extension for our clients. With this extension, admins and developers can utilize Varnish more easily. It is also fine-tuned to the highly-optimized JetRails Magento hosting stack.

You can (and should) also leverage supplemental Session Caching. We recommend Redis. Redis stores data and objects locally in RAM, cutting down on the frequency that external sources like APIs and databases need to be read.

Then, there are additional accelerators. We recommend Zend OpCache which leads to speedier PHP execution through opcode caching and optimization. By storing precompiled script bytecode, it improves PHP performance. 

Browser Based Caching
Progressive Web Apps (PWA): Starting with Magento 2.3.x, which debuted in November of 2018, Magento debuted their PWA studio. This technology is expected to be central to the creation of new Magento frontend themes:

Edge-Based

Content Delivery Network (CDN): Leveraging a CDN like Cloudflare for Magento can allow you to cache webpage elements, like images, on a separate edge network. Edge networks are often vast, with servers all over the world, leading to a better distribution of your server load, and fewer hops for browsers to access necessary webpage files.  

Cloudflare can also be configured to automatically compress images, minify HTML and CSS, bundle JavaScript files, and take other steps to enhance the loading speed of your website.

At JetRails, we’ve even created a Magento 1 and Magento 2 Cloudflare Extensions, to help make managing Cloudflare faster and easier from your Magento admin. 

Image CDN: Some CDNs focus solely on Images and offer better results for rich media specifically. These include platforms like Cloudinary and ImageEngine. These can be configured to work in conjunction with a primary file caching CDN like Cloudflare.

Deployment Caching

Composer Satis: This technology assists with build time during deployments and is used to ensure that your builds don’t fail due to a composer repository being down. It’s, in essence, a lightweight static composer repository generator.

https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md

https://github.com/composer/satis

When in doubt, call in experts for a Magento Hosting Consult. There are Magento hosting engineers who leverage these technologies day in and day out to improve loading speeds, security, and scalability of Magento sites.