What is Turpentine?
Article Number: 940 | Rating: Unrated | Last Updated: Fri, Nov 11, 2016 at 12:45 PM
What is Turpentine?
Turpentine was developed by Nexcess to improve how Magento and Varnish work together.
Turpentine extension for Magento by Nexcess
Turpentine is a full-page cache extension for Magento that works with Varnish, a rapid caching reverse-proxy. By default, Varnish does not cache requests with cookies, as Magento sends a front-end cookie with every request, this is causes a near-zero hit-rate for the Varnish cache. Turpentine configures Varnish to work with Magento and modifies Magento to significantly improve the cache hit rate.
Attention: While Turpentine is considered a stable extension, Nexcess strongly recommends testing it on a developmental or staging site before deploying on a production site. This pre-testing explores the potential need to add custom ESI policies for blocks added by other extensions.
Some of Turpentine's most significant features are:
- Configurable administrative systems and layout XML using standard Magento methods; no manual editing of the Varnish configuration required in most cases.
- Instant VCL (Visual Component Library) generation without restarting, changing Varnish configuration files, or flushing the cache.
- Ability to blacklist requests from caching by URL (Uniform Resource Locator) or parameters like session SID (Information Framework), and store.
- Ability to configure cache TTL (time to live) by URL and by individual block.
- Support for multiple Varnish instances for clustered usage.
- Automatic cache-clearing on actions, such as clearing product, catalog, or CMS page after saving.
- Support for non-root Magento installs, such as putting Magento in /store/ instead of /, as well as multi-store and multi-site configurations.
- Support for site-crawlers for cache-warming, including a basic built-in site-crawler.
- SSL (Secure Sockets Layer) support through Pound (reverse-proxy tool) or Nginx (open-source, high-performance HTTP server and reverse proxy).
- Magento Community Edition v1.6+ or Magento Enterprise Edition v1.11+
- Varnish v2.1+
How it works
The extension works in two parts: page caching and block caching through ESI and AJAX.
- Pages Caching: Use Varnish to detect if a front-end cookie was submitted by a visitor. If the visitor did not submit the cookie, then Varnish generates a new session token. The page is then served with any blocks from ESI poligices from the cache or retrieved from the system backend, if it is not already in the cache.
Attention: The cookie checking functionality is bypassed for clients identified as crawlers.
- Blocks Caching: Turpentine monitors for the core_block_abstract_to_html_before event in Magento. Once this event triggers, Turpentine verifies at the attached block. If an ESI policy has been defined for the block, then the block's template is replaced with a simple ESI and AJAX template that advises Varnish to delete the block content from a separate URL. Varnish will verify another request to the same URL to retrieve the content for that block. This content can be cached separately from the page and may differ between different visitors and clients.
Notes and caveats
- The use of Turpentine does not directly increase the speed of adding items to the cart or checkout. It can only cache, so only the speed for site browsing can be increased. Using Turpentine will remove significant load on the system backend and allow acceleration of actions on heavily loaded sites, as backend resources are released.
- Varnish v2.1.x. has some technical limitations. For example, external ESI requests are not blocked, and per-block TTLs in ESI policies are not honored; all blocks use the default TTL.
- The core features of Turpentine, such as caching, ESI and AJAX injection, work with Magento CE v1.5, but a significant portion of the auxiliary functionality does not work due to changes to event names. However, it is possible to use Turpentine with Magento CE v1.5 with the understanding that it is not supported, and certain actions need to be performed manually. Both automatic and manual cache flushing, and cache warming do not operate due to missing events that trigger the cache flushing.
- Anonymous blocks cannot be hole-punched. For CMS pages, include the block in the page's layout updates in XML and give it a name, then it can use a normal ESI policy.
For more information about Turpentine, Magento, or Varnish, visit the Nexcess website.
For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.
There are no attachments for this article.
What is Varnish?
Added on Thu, Aug 28, 2014