[horde] memcache caching for all session stores..
Michael M Slusarz
slusarz at horde.org
Fri May 2 20:42:10 UTC 2008
Quoting liamr at umich.edu:
> But now, all session handlers can cache session data in memcache.
>
> http://marc.info/?l=horde-cvs&m=120719156728337&w=2
> Add memcache caching support to all session backends. (Will merge
> to 3.2.1).
[snip]
> I'm just curious as to why the new version came into existance? You
> still end
> up potentially querying the memcache and DB servers with every page
> load. It doesn't seem that much different than the original idea
> (tho, it /is/ more flexible)
You don't query the DB server on each page load when getting the
session from memcache, except in the rare case where the session info
is not in the memcache store (saving 1 sql query). Additionally, if
the session data does not change during the page load, neither the
memcache nor the sql server is hit with a store (saving another sql
query). So in normal usage, you are saving at least 1 sql query per
page hit, and on many hits (depending on how often your session data
changes), you are saving 2 sql queries.
The difference from the previous implementation is that check to see
if the session data changes. This check is done for all storage
backends, btw, so sql/memcache drivers are not the only place this
helps. (In the memcache case, there is a slight chance that a long
string of session accesses without a change could cause a session
timeout because the session timestamp isn't updated. We work around
this by guaranteeing that the session is written at least once every
session_timeout/2 seconds.)
michael
--
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the horde
mailing list