A Layman Approach to Magento Varnish
Everybody wants faster websites but there is no cut-and-dried process to achieve one.
In the ecommerce world, sites often rely on conveying lots of information along with a mandate to showcase large product and lifestyle images. Even if the amount of data is not negotiable, the speed at which that information is presented can be optimized. Magento web stores, which are notoriously discounted as slow beasts, can be dramatically improved using a tool called Varnish.
Ok, so I have also heard a bunch of hype around Varnish. What exactly is this “Varnish”?
Warning – Tech Speak: Varnish is a type of “reverse proxy cache“. It is employed between the visitor and the website and works to optimize the interaction between the two. Specifically, Varnish can store already-assembled content in memory and determine when it is appropriate to reply with this version rather than asking the underlying application to build the content from scratch. For a complex application like Magento, this can yield significant decreases in response time and server load.
Contact us now and we’ll finish the article over the phone.
Even better, Varnish can be configured to handle parts of a page independently. This means that portions of the page that rarely change can be summoned from the cache while more dynamic content is fully refreshed.
So is there some sort of example where Varnish is best deployed?
Consider a Magento category page. A significant amount of the content is unlikely to differ each time the page is loaded. The top navigation may require update only when the business expands into new categories. The products that appear on the page may change more frequently, but not often enough to justify engaging the intensive process of building this content every few seconds. At the same time, alerts, shopping cart contents and other results of user interactions must always be as current as possible. Even within the product grid, it may be useful to keep availability or prices constantly up-to date. Varnish has the flexibility to accommodate all of these requirements.
Great, so how do I get it?
Effectively wielding the flexibility that Varnish provides is complex. Turpentine, an extension developed by a Magento hosting specialist Nexcess, makes this complexity manageable by bringing the Varnish configuration process into the Magento framework. Turpentine integrates Varnish-specific configurations into the Magento layout system, underscoring the natural fit between Magento’s modular “block” concept and Varnish’s ability to manage these blocks to optimize the user’s experience.
Turpentine does an excellent job of making Varnish accessible. However, it is important to recognize that it does not reduce Varnish to a simple “plug-in”. Turpentine is an extension, Varnish is a foundation. Even with the convenience of Turpentine, fully realizing Varnish’s potential requires careful consideration.
As with all extensions, Turpentine is optimized for a default Magento installation. Full integration with customizations or third-party extensions may require additional Magento development. Even an unmodified Magento installation may require customization to achieve certain goals. Turpentine is designed to integrate with what may be considered the “official” method of defining Magento page layouts. However, even within the core code, alternative methods are occasionally employed (for perfectly valid reasons). These are areas where Varnish may require complex workarounds.
Further challenges extend beyond the details of technical implementation. A great benefit of Magento is that so much of what is needed to create a rich e-commerce site is included natively, or “out of the box”. With Varnish, business owners, designers and developers will likely find the need to scrutinize features that previously took care of themselves. Customer interactions, inventory changes, mini-carts, promotional content, related products — these are all areas where built-in dynamism can often be taken for granted. With Varnish, it is necessary to carefully consider how these should be optimized for a given site. Moreover, it is vital to keep an eye on the overall effect so that the user experience remains polished and intuitive, rather than disjointed due to content appearing at unpredictable intervals.
Varnish is a powerful technology, yet it requires considered direction and careful implementation to employ effectively. Turpentine brings this process well within the range of experienced Magento developers and allows them to tailor its benefits to suit an organization’s business goals and complement its design standards.