On Mon, 2004-09-20 at 12:21, Enrico wrote:
> I've done some basic benchmarks using Apache::Session::Flex with different
> datastores and memcached is very fast when sessions number grows (see below).

Either the MySQL store needs some work, or your MySQL server is
performing very differently from mine.  When I run benchmarks (with my
own caching code) between Memcached and MySQL, there is hardly any
difference.

With a little bit of adjustment, the BDB store would beat all of the
others, but it would not work for multi-machine environments.

> > Memcached would be better suited to acting as a write-through cache for 
> > session data that you store in a database.
> 
> Please, can you better explain?

Sure.  With a write-through cache you send all reads to the cache and
all writes to both the cache and the database.  That way, if you have an
application that reads more than it writes, you will get excellent
performance, but you also get the safety of a backing store in the
database.  If your read request to the cache doesn't find the record,
you check the database to see if there was one that the cache dropped
for some reason.

I'm not sure that was very clear explanation.  I can show you
pseudo-code if you like.

What I would love to see is a version of Apache::Session that can take a
Cache::Cache class to use for a write-through cache.  I will be
releasing a Cache::Cache subclass for Memcached soon, as well as some
other caching options.  This would allow Apache::Session users to take
advantage of caching without changing their existing backing storage.

- Perrin 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to