I'm putting Drupal onto a high traffic site and I'm concerned with the scalability of the anonymous sessions. I asked about disabling the sessions in #drupal on freenode and there was interest in the solution, but no one had done it before, so I'm bringing the question here.

A lot of the modules (both built in and 3rd party like CCK) use $_SESSION, but it looks like that is only for administration forms or functions that a user will have to be logged in to use anyway. includes/session.inc specifically mentions the throttle module and the "Who's Online" block - both of which I won't be using, so I don't see anything that jumps out at me as requiring an anonymous session.

Two ways of avoiding the sessions come to mind at first glance:

Firstly, I think I could tap into DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE which calls the currently-non-existant page_cache_fastpath(). If I create that function, and inside of it I bootstrap Drupal and just skip over DRUPAL_BOOTSTRAP_SESSION for anyone that isn't logged in, I think I might avoid the problems.

Secondly, I could edit bootstrap.inc (I'd rather not edit core code) to do the same thing - check for a cookie or something before calling session_start() on anonymous sessions.

Anyone have experience with this before? Any other ideas?

Thanks.

Comments

carlmcdade’s picture

We just ran a test a few minutes ago using one of the higher traffic sites and a Drupal site. We plugged in a iframe from the high traffic site so that it would load the the frontpage of the Drupal site as an anoanymous user. Then we just sat back and watched the mysql processes using HeidiSQL. Not only did the dev server die under the load but one of the major contributors to the crash was the sessions table.

Caching was not an option since we had to turn off table locking for the cache table to get anything to perform under the load. Total time before crashing (with 11,000 users, 15 page loads per second, approximates for low periods) 40 seconds on Drupal 4.7

Hiveminds Magazine - for web publishers and community builders
http://www.hiveminds.co.uk
http://demo.hiveminds.co.uk
Drupal Support Wiki | Drupal Sverige

clouserw’s picture

I filed a bug about it if you'd like to follow along: http://drupal.org/node/201122

We'll see how it goes.