In referencing your authcache session workflow: http://drupal.org/node/394840 ...I have a question about session management. Settings.php statement order has an effect, I've noticed.

I'm using postgresql database, cacherouter for apc/opcode cache, boost and varnish for anonymous users, and have enabled authcache for authenticated users (authenticated sessions) but not anonymous.

Which session manager do you recommend, authcache sessions, or by one of the two other session related modules, memcache-session.inc, or session-no-anon.inc?

There are two questions, anonymous sessions and authenticated sessions. Since authenticated sessions are managed by authcache, would memcache-session.inc or session-no-anon.inc interfere with the routing logic?

If it gives an advantage, I would like to use these settings.php statements:

# Sessions
'session_inc' => './sites/all/modules/memcache/memcache-session.inc',
#'session_inc' => './sites/all/modules/no_anon/session-no-anon.inc',

Thanks for any advice you can give me. I'll take a look at the code meantime.

Comments

threading_signals’s picture

Time to first byte after connect has been very poor, and I've been trying to eliminate trips to the database where possible before optimizing the database backend response times.

threading_signals’s picture

Title: Memcached Sessions configuration question » Authenticated Sessions configuration question
Jonah Ellison’s picture

Memcache would be best for session management to avoid additional database queries. Since Authcache serves pages using page_cache_fastpath(), anonymous users will only have a session if they receive a non-cached page or Authcache Ajax is used.

Check out http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/_drupa... to see the bootstrap phases in more detail.

threading_signals’s picture

Thanks for the link, it was very helpful.

After looking at the boot order, the order of $confs that I have is cache_inc, cache_inc_via_authcache (so that cacherouter gets set as handler), cacherouter, memcache_options, memcache_key_prefix, memcache_servers, memcache_bins, and then session_inc.

Memcache module requires 3 servers, and I see the sessions and users bin getting hits, but not the default bin, where there has been no writes or reads, which is as it should be. Question now is, which module sets the session handler to memcache?

Does it go like authcache > cacherouter > memcache for sessions, or is it one of the other two modules, then which folder? Is there a way to ensure that caching for sessions is working as intended, and that there's no duplicate caching...?

Thanks so much! =)

Jonah Ellison’s picture

Authcache and cacherouter don't do any session caching. Authcache only interacts on the cache_page level. Once $conf['session_inc'] is set, then Drupal uses the file for session handling instead of the core session.inc file.

threading_signals’s picture

Title: Authenticated Sessions configuration question » Authcache Authenticated Sessions configuration question
Status: Active » Closed (fixed)

Thanks for the tip. Rerouting the cache flow is a consideration: http://drupal.org/node/230101

Cacherouter has the retrieve from fast_cache option which is a good idea. Thanks! I'll play around with this.

Jonah Ellison’s picture

FYI, Authcache uses fast_cache and overrides CacheRouter's implementation.

threading_signals’s picture

Status: Closed (fixed) » Active

Authcache README.txt states this as example:
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'apc', // apc, memcache, db, file, eacc or xcache
'server' => array(), // memcached (host:port, e..g, 'localhost:11211')
'shared' => TRUE, // memcached shared single process
'prefix' => '', // cache key prefix (for multiple sites)
'path' => 'files/filecache', // file engine cache location
'static' => FALSE, // static array cache (advanced)
),
);
...while regular cacherouter allows an extra variable for fast_cache:

'default' => array('engine' => 'apc',
'servers' => array(),
'shared' => TRUE,
'prefix' => '',
'path' => 'files/filecache',
'fast_cache' => FALSE,
'static' => FALSE),

If Authcache overrides, does it disregard only specific bins, or will it not honor any settings meant for cacherouter?

threading_signals’s picture

Also, I'm wondering if the variable for this settings is deprecated Jonah:
$conf['page_cache_fastpath'] = 1;

Jonah Ellison’s picture

Status: Active » Closed (fixed)

fast_cache is only for the bootstrap process, mainly for the cache_page bin. See DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE under http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/_drupa...

Also see authcache.inc: http://drupalcode.org/viewvc/drupal/contributions/modules/authcache/auth..., where $conf['page_cache_fastpath'] is forcible set to TRUE.

Old CacheRouter issue that allows Authcache+CacheRouter integration that may clear some things up: #422250: Integration with Authcache module

threading_signals’s picture

Category: support » feature
Status: Closed (fixed) » Needs review

Thanks for the additional info on #9. Api info on page_cache_fastpath states that it only handles the 'cache_page' table ("bin"): http://api.drupal.org/api/drupal/developer--hooks--core.php/function/pag...

..which I believe is the only bin you are working on from the link that you gave me, but this link here: http://groups.drupal.org/node/18177 [Subject - here you go." by Steve] ...shows that multiple bins can be used, and obviously multiple engines as well after reading the issue queue. He has fast_cache variable set to TRUE for default (placeholder for cache) and cache_page to load up at DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE, while the others are not absolutely required before hitting the database.

The line 47 of authcache.inc suggests that data under additional bins when using cacherouter never get stored into memory depending on the settings.php statement order. The better way to implement this module is to be a downstream module, sort of like ubuntu is to debian, since caching technologies come and go, and the use of a caching strategy based on roles would depend on the hardware and lower level technologies as well. Can you elaborate on the roadmap?

Jonah Ellison’s picture

Status: Needs review » Closed (fixed)

Please see the CacheRouter documentation @ http://drupal.org/project/cacherouter

fast_cache is new in beta8 for turning page_fast_cache on.

If you look at the CacheRouter code, you will find that CacheRouter's fast_cache is an alias for page_cache_fastpath.

I'm not clear on what you mean by roadmap. This module is not a caching engine. It is a layer directly above Drupal's page caching. Authcache modifies the HTML before saving to the page cache and uses Drupal core's page_fast_cache to avoid hitting the database to serve cached pages. That's pretty much all it does for cache interaction.

threading_signals’s picture

Status: Closed (fixed) » Closed (won't fix)

You're limiting the use of authcache and memcache's purpose of storing items in memory/other caches by implementing only one bin. The routing logic of your module only handles default thus breaking cacherouter functionality without documentation. Loading items into memory at DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE when calling cache.inc does not absolutely require the use of page_fast_cache, and this structure gives flexibility in the order of the bootstrap access of memory by functions. That is one concern.

The second concern is that, according to your documentation, cacherouter or memcache needs to be enabled first, then as stated, earlier your routing logic does not call other bins, leading to performance degradation and admins wondering why.

I didn't ask whether your module was a caching engine. I wanted the other modules to behave as intended when configuring the cacherouter bins. Because cache_inc is overridden by authcache, you essentially take over the caching engine layer. Calling other bins for memory avoids trips to the database during subsequent function calls. http://api.drupal.org/api/drupal/includes--cache.inc/function/cache_get/6

I'm sure there's numerous other uses as well which requires hacks: http://drupal.org/node/797610

Unless someone issues a patch, this is better marked as won't fix.

Jonah Ellison’s picture

Category: feature » support
Status: Closed (won't fix) » Closed (works as designed)

I don't think you have a clear understanding of how Drupal cache bins work. There is no "flexibility" in the bootstrap. Each bootstrap must be loaded in the correct order. The database must be loaded before the session can be initialized, for example. See http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal...

Authcache does not implement any cache bins. It simply interacts with the cache_page bin. It doesn't "break" any routing logic. This module does not "take over" the caching engine layer. See the Authcache handbook page @ http://drupal.org/node/996434

In a Drupal install, Authcache is configured as a cache handler in settings.php ("authcache.inc"), however Authcache does not implement a caching system. Instead Authcache detects which cache handler is configured in settings.php, then loads the correct include file. If no cache handler is used, Authcache defaults back to the Drupal core database cache bins (this is useful for testing).

In other words, it is a LAYER above the caching engine. If CacheRouter or Memcached is used as the cache engine, then it is responsible for saving/retrieving from cache bins.

Please stop arguing with how this module works. It works as intended. The caching logic is not faulty.

threading_signals’s picture

Hey, sorry about last time. No hard feelings.