Working with and overriding BOA cache settings

You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

Cache Overview

BOA provides several layers of robust automated caching for Drupal sites by default.

  • Redis Cache: An in-memory key-value based storage engine. BOA allocates 64M of memory to this cache by default. (**Verify if true for all systems**)
  • Boost: Popular Drupal module for file based caching. It stores a full page load as a static file.
  • Speed Booster is a robust cache that functions at the webserver (nginx) level and is fully optimized and functional for Drupal 5,6,7 and 8 sites.
  • Block Cache: Enabled by default in BOA sites, a native Drupal cache that stores all block data in a cache table resulting in a single query as opposed to several. In BOA managed sites, this means that when the Speed Booster cache is refreshed every 10 seconds, the block data is pulled from the cache table. (*** Needs to be verified ***)
  • Drupal CSS/JS aggregation: Not exactly caching, but related to this section: By default BOA enables Drupal's native CSS and JS aggregation.

Overriding the BOA built in caching mechanisms

Use a dev.* aliased subdomain

The easiest way to turn off all caches is to create a domain alias in Aegir that begins with the "dev" prefix. Eg: dev.site.example..com. This will turn off the BOA Speed Booster cache. You will need to manually disable the CSS/JS aggregation and Drupal default caches on /admin/settings/performance, depending on your overrides. See below.

The Speed Booster cache can also be turned off on the fly by adding ?nocache=1 to the end of your url. Eg. site.example.com?nocache=1

Testing (See below): curl -SI site.example.com will return:

...
X-Speed-Cache: BYPASS
X-Speed-Cache-Key: /?nocache=1
...

Using override.global.inc

The BOA install checks for the existence of a file called override.global.inc located in /data/conf/ which contains overrides that will be applied accross all of your platforms.
Add the following to /data/conf/override.global.inc to remove the hardcoded settings on /admin/settings/performance. You still need to manually turn off aggregation and page cache via the settings screen.

unset($conf['cache']); // stop hardcoding Page cache
unset($conf['preprocess_css']); // stop hardcoding css aggregation
unset($conf['preprocess_js']);  // stop hardcoding js aggregation

Using local.settings.php for a particular site

Edit local.settings.php and add the above code to override global settings for a particular site. Although not mentioned in the example above, one can hard code the switch for aggregation and caching with:

$conf['cache'] = 0;               // disable page caching
$conf['preprocess_css'] = 0;      // disable css aggregation
$conf['preprocess_js'] = 0;       // disable js aggregation

When these settings are hard coded, changes to /admin/settings/performance will not take effect.

Turn off Redis Cache with ../cache/NO.txt

Create a directory named "cache" as in: sites/all/modules/cache for platform wide effect -- or as in: sites/site.example.com/modules/cache to affect a particular site -- with an empty filed named NO.txt. Note the uppercase file name.

The Redis cache can also be turned off on the fly by appending "?noredis=1" to the url eg: site.example.com?noredis=1

Testing (See below): curl -SI site.example.com wil return: X-Allow-Redis: NO

Testing Cache Hits/Misses

On Linux use curl: curl -SI http://site.example.com
You'll see something like this:

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 05 Oct 2012 16:43:20 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
X-Cookie-Domain: site.example.com
X-Backend: C
X-Purge-Level: none
X-Allow-Redis: YES
Cache-Control: no-cache
Last-Modified: Fri, 05 Oct 2012 16:43:15 +0000
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Vary: Cookie
ETag: "1349455395"
X-Engine: Octopus 1.0 ET
X-Device: normal
X-Speed-Cache: HIT
X-Speed-Cache-Key: /
X-NoCache: Cache
X-GeoIP-Country-Code: ZA
X-GeoIP-Country-Name: South Africa
X-Server-Name: site.example.com

Resources

http://omega8.cc/speed-booster-cache-boost-and-advagg-108

http://drupalcode.org/project/barracuda.git/blob/HEAD:/aegir/conf/overri...

http://omega8.cc/how-to-disable-all-caching-and-aggregation-115

BOA

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week