Bug

I've got Authcache enabled, I get green lit debug messages for Authenticated users but only misses for anonymous users. Authenticated users seem to load slightly quicker but load testing still suggests some sort of caching and page render times similar.

Set-Up

LEMP Stack, Ubuntu Server 12.04
Varnish VCL from Authcache module
Varnish 3.05
Authcache 7.x-2.0-beta 1 - Varnish Backend enabled
Drupal settings.php
Browser - Firefox & Chrome - Private Browsing.

/*
 * Memcached Settings
 */


$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

/*
 * Varnish Set-up
 */

$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 21600;
#$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['omit_vary_cookie'] = TRUE;

/*
 * Authcache & Varnish
 */

$conf['authcache_varnish_header'] = FALSE;


/*
 * Enabled HTTPS
 */

$conf['https'] = TRUE;

Results

Authenticated User:

If I hammer refresh on my homepage I get debug reports similar to the following:

Authcache Debug
StatusCache Status: "HIT"
Page Render Time: "703.98 ms"
Page Age: "-29 seconds"
SettingsDebug Users: ["Harry Johnson","ThomasEmployer"]
Cache User: "286"
Cache Backends: "authcache_varnish"
Active Backend: "authcache_varnish"
Authcache Key: "173ac82"
Key props: {"base_url":"http://192.168.1.95","roles":[5]}
Cache-Control: "public, max-age=21600"
Via reverse proxy: "Yes"
HTML/JavaScript time: 49 ms

Anonymous User:

If I hammer refresh on my homepage I get debug reports similar to the following:

Authcache Debug
StatusCache Status: "MISS"
Page Render Time: "390.84 ms"
Page Age: "-29 seconds"
SettingsDebug Users: ["Harry Johnson","DominicEmployer"]
Cache User: 0
Cache Backends: "authcache_varnish"
Active Backend: "authcache_varnish"
Authcache Key: "http://192.168.1.95"
Cache-Control: "public, max-age=21600"
Via reverse proxy: "Yes"
HTML/JavaScript time: 52 ms

Despite the lower page render times the anonymous pages feel slower to respond.

On AB testing on ab -n 10 -c 5 http://192.168.1.95 I get in the area of ~ 2700 - 2900 requests for anon and ~3700 - 3800 for authenticated users. Which would definitely suggest caching. Without caching I'm lucky to get ~30.

Comments

znerol’s picture

The VCL shipping with Authcache Varnish needs to be adapted for Authcache Debug. The widget uses a cookie (aucdbg) with a unique value for each request in order to distinguish between cache hits and misses.

By default the standard cache policy kicks in for anonymous users. I.e. requests having a cookie will be passed to the backend by Varnish. When you use ab for testing, no cookies will be sent along with the request and therefore the cache actually kicks in. When testing with the browser, the aucdbg and js cookies are added by JavaScripts and therefore the requests are bypassing the cache.

Look for Example 4: Trigger key-retrieval for all users, including anonymous. in vcl_recv and enforce key-retrieval for all users. When this fragment is enabled, requests for anonymous users will be handled exactly like those for authenticated users and the default varnish cache policy will be disabled.

splitsplitsplit’s picture

Yep I need to read the default.vcl more carefully. Un-commented section 4 and it works correctly.

splitsplitsplit’s picture

Status: Active » Closed (works as designed)