• Stars
    star
    524
  • Rank 84,541 (Top 2 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created about 12 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Varnish extension for Magento.

Nexcess.net Turpentine Extension for Magento

Build Status Scrutinizer

Turpentine is a full page cache extension for Magento that works with Varnish, a very fast caching reverse-proxy. By default, Varnish doesn't cache requests with cookies and Magento sends the frontend cookie with every request causing a (near) zero hit-rate for Varnish's cache. Turpentine configures Varnish to work with Magento and modifies Magento's behaviour to significantly improve the cache hit rate.

Note that while this extension is now considered stable, it is strongly recommended that it be tested on a development/staging site before deploying on a production site due to the potential need to add custom ESI policies for blocks added by other extensions.

Features

  • Full Page Caching, with hole-punching via Varnish ESI and/or AJAX, even for logged in visitors
  • Configurable via standard Magento methods (Admin system configuration and layout XML), no manual editing of Varnish config required for most cases
  • Able to generate and apply new Varnish VCLs (configurations) on the fly, without restarting/changing Varnish's config files or flushing the cache
  • Blacklist requests from caching by URL or parameters (SID, store, etc)
  • Configure cache TTL by URL and individual block's TTL
  • Supports multiple Varnish instances for clustered usage
  • Automatic cache clearing on actions (clearing product/catalog/cms page after saving)
  • Supports non-root Magento installs (i.e. putting Magento in /store/ instead of /) and multi-store/multi-site setups
  • Support for site-crawlers for cache warming, and includes a (basic) built-in site-crawler
  • SSL support through Pound or Nginx

Requirements

  • Magento Community Edition 1.6+ or Magento Enterprise Edition 1.11+
  • Varnish 2.1+ (including 3.0+)

Installation & Usage

See the Installation and Usage pages.

Support

If you have an issue, please read the FAQ then if you still need help, open a bug report in GitHub's issue tracker.

Please do not use Magento Connect's Reviews or (especially) the Q&A for support. There isn't a way for me to reply to reviews and the Q&A moderation is very slow.

Contributing

If you have a fix or feature for Turpentine, submit a pull request through GitHub to the devel branch. The master branch is only for stable releases. Please make sure the new code follows the same style and conventions as already written code.

How it works

The extension works in two parts, page caching and block (ESI/AJAX) caching. A simplified look at how they work:

For pages, Varnish first checks whether the visitor sent a frontend cookie. If they didn't, then Varnish will generate a new session token for them. The page is then served from cache (or fetched from the backend if it's not already in the cache), with any blocks with ESI polices filled in via ESI. Note that the cookie checking is bypassed for clients identified as crawlers (see the Crawler IP Addresses and Crawler User Agents settings).

For blocks, the extension listens for the core_block_abstract_to_html_before event in Magento. When this event is triggered, the extension looks at the block attached to it and if an ESI policy has been defined for the block then the block's template is replaced with a simple ESI (or AJAX) template that tells Varnish to pull the block content from a separate URL. Varnish then does another request to that URL to get the content for that block, which can be cached separately from the page and may differ between different visitors/clients.

Notes and Caveats

  • Turpentine will not help (directly) with the speed of "actions" like adding things to the cart or checking out. It only caches, so it can only speed up page load speed for site browsing. It will remove a lot of load on the backend though so for heavily loaded sites it can free up enough backend resources to have a noticeable effect on "actions".
  • There are some technical limitations when using Varnish 2.1.x: External ESI requests are not blocked, and per-block TTLs in ESI policies are not honored (all blocks use the default TTL)
  • The core parts of Turpentine (caching and ESI/AJAX injection) work under Magento CE 1.5, but a significant portion of the auxiliary functionality doesn't work due to changes to event names. That said, it would be possible to use Turpentine with Magento CE 1.5 with an understanding that it is not supported and what actions need to be taken manually. Both cache flushing (both automatic an manual) and cache warming (due to missing events that trigger the cache flushing) do not work.
  • Anonymous blocks are not able to be hole-punched. For CMS pages, it is recommended that you include the block in the page's layout updates XML and give it a name, then it can have an ESI policy like normal

Known Issues

  • Logging and statistics will show all requests as coming from the same IP address (usually localhost/127.0.0.1). It should be possible to work around this using Apache's mod_remoteip or mod_rpaf.

Demo

See the Demo Sites wiki page.

If you use Turpentine (on a production site), feel free to add your site to the list!

License

The code is licensed under GPLv2+, much of the ESI-specific code is taken from Hugues Alary's Magento-Varnish extension, which is licensed as GPLv3.

More Repositories

1

magento-gatling-tests

Gatling scenarios for stress-testing magento store with 100k sku sample data
Scala
54
star
2

whitepaper-v1-configs

Configuration files for the Nexcess Magento Performance Whitepaper
42
star
3

magento-alarmbell

PHP
35
star
4

wordpress-cli-installer

Script to assist with installing Wordpress completely from the command line.
PHP
30
star
5

magento-sentry-two-factor-authentication

JavaScript
28
star
6

magento

Mirror of Magento CE releases
PHP
18
star
7

limit-orders

Automatically disable WooCommerce's checkout process after reaching a maximum number of orders.
PHP
17
star
8

magento-whitepaper-april-2018

Lua
10
star
9

python-r1soft

R1soft CDP utilities and module
Python
7
star
10

apachetop

Fork of apachetop from webta.org
Shell
7
star
11

apache2nginx

Python script to convert Apache vhost config files to Nginx
Python
7
star
12

nexcess-api-docs

6
star
13

magento-two-factor-auth

A 2-Factor authentication extension for Magento.
Python
6
star
14

ee-whitepaper-v1-configs

Configuration files for the Nexcess ExpressionEngine Performance Whitepaper
PHP
6
star
15

puppet-maldet

Ruby
5
star
16

m2-whitepaper-v1-configs

5
star
17

Diagnosing-MySQL-performance-bottlenecks-with-Maatkit

Files that correlate with the blog.nexcess.net post from 3-5-2011 "Diagnosing MySQL performance bottlenecks with Maatkit"
4
star
18

wp-git-repo-starter

A starter template for keeping your WordPress sites under version control
Shell
4
star
19

ansible-role-magento

3
star
20

ansible-inventory-puppetdb

Ruby
3
star
21

ee-cli-installer

CLI utility for installing ExpressionEngine
PHP
3
star
22

woo-zero-orders-alert

Notify store owners when minimim daily order targets are missed.
PHP
3
star
23

ansible-role-server

Jinja
2
star
24

r1soft-admin-console

Admin console for multiple R1soft servers
JavaScript
2
star
25

puppet-r1soft

Ruby
2
star
26

ansible-role-centos-mirror

Shell
2
star
27

msync

rsync for IMAP4, mbox, and maildir
Python
2
star
28

ExpressionEngine-Memcached-patch

Public repo for memcached patch for ExpressionEngine
1
star
29

yum-lag

Yum plugin to allow excluding updates newer than a given period
Python
1
star
30

ansible-role-repo-nexcess

1
star
31

esgrep

Python
1
star
32

ansible-role-fedora-mirror

Shell
1
star
33

ansible-playbook-cloudhost

Shell
1
star
34

ansible-role-wordpress-w3tc

1
star
35

libr1soft2

PHP toolkit for working with R1soft CDP Server v2
PHP
1
star
36

puppet-auditd

Ruby
1
star
37

nexcess-cli

PHP
1
star
38

ansible-role-ssl-cert

1
star
39

ansible-role-wordpress

1
star
40

magento-extension-pkgr

Python script to build Magento extensions instead of using the "mage" command or the web interface.
Python
1
star