On Fri, 17 Sep 2004 10:45:18 -0400 Perrin Harkins <[EMAIL PROTECTED]> wrote:
Hi Perrin, > Enrico Sorcinelli wrote: > > I'm glad to announce Apache::Session::Memcached. > > This module provides a way to use memcached as Apache::Session storage > > implementation > > I wouldn't recommend using memcached for storing sessions. Memcached is > explicitly unreliable storage. It is built with the premise that you > won't put anything into it that you care about losing. > If it gets full, > it will simply drop data from storage. The mechanism for failover > across multiple machines also counts on being able to lose all the data > from one machine without it being a big deal. Yes, I know. Probably, a RDBMS as session datastore is currently best (and economical) solution for multiple frontends. Another solution is a load-balancer with sticky sessions. I'm investigating in order to search fastest datastore, so, I wrote also A::S::M since I worked with memcached in the past and I there was not a Apache::Session implementation (moreover, this has been a good exercise in order to better hacking in deep Apache::Session :-)) I've done some basic benchmarks using Apache::Session::Flex with different datastores and memcached is very fast when sessions number grows (see below). > 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? Tnx, for comments! ;-) by - Enrico --- my Apache::Session(::Flex) benchmark results *** *** 10 *** *** ---------------- Store: File, Times: 50 ---------------- the code took: 0 wallclock secs ( 0.05 usr + 0.01 sys = 0.06 CPU) ---------------- Store: Memcached, Times: 50 ---------------- the code took: 0 wallclock secs ( 0.15 usr + 0.00 sys = 0.15 CPU) ---------------- Store: MySQL, Times: 50 ---------------- the code took: 1 wallclock secs ( 0.18 usr + 0.03 sys = 0.21 CPU) ---------------- Store: DB_File, Times: 50 ---------------- the code took: 0 wallclock secs ( 0.07 usr + 0.01 sys = 0.08 CPU) ---------------- Store: SharedMem, Times: 50 ---------------- the code took: 0 wallclock secs ( 0.11 usr + 0.00 sys = 0.11 CPU) *** *** 100 *** *** ---------------- Store: File, Times: 100 ---------------- the code took: 0 wallclock secs ( 0.09 usr + 0.02 sys = 0.11 CPU) ---------------- Store: Memcached, Times: 100 ---------------- the code took: 1 wallclock secs ( 0.14 usr + 0.04 sys = 0.18 CPU) ---------------- Store: MySQL, Times: 100 ---------------- the code took: 0 wallclock secs ( 0.38 usr + 0.00 sys = 0.38 CPU) ---------------- Store: DB_File, Times: 100 ---------------- the code took: 1 wallclock secs ( 0.22 usr + 0.02 sys = 0.24 CPU) ---------------- Store: SharedMem, Times: 100 ---------------- the code took: 0 wallclock secs ( 0.32 usr + 0.00 sys = 0.32 CPU) *** *** 1000 *** *** ---------------- Store: File, Times: 1000 ---------------- the code took: 1 wallclock secs ( 0.79 usr + 0.21 sys = 1.00 CPU) ---------------- Store: Memcached, Times: 1000 ---------------- the code took: 2 wallclock secs ( 1.21 usr + 0.08 sys = 1.29 CPU) ---------------- Store: MySQL, Times: 1000 ---------------- the code took: 5 wallclock secs ( 2.98 usr + 0.17 sys = 3.15 CPU) ---------------- Store: DB_File, Times: 1000 ---------------- the code took: 3 wallclock secs ( 1.73 usr + 0.29 sys = 2.02 CPU) ---------------- Store: SharedMem, Times: 1000 ---------------- the code took:19 wallclock secs (18.11 usr + 0.94 sys = 19.05 CPU) *** *** 10000 *** *** ---------------- Store: File, Times: 10000 ---------------- the code took:21 wallclock secs ( 9.33 usr + 11.12 sys = 20.45 CPU) ---------------- Store: Memcached, Times: 10000 ---------------- the code took:20 wallclock secs (12.45 usr + 1.09 sys = 13.54 CPU) ---------------- Store: MySQL, Times: 10000 ---------------- the code took:41 wallclock secs (29.34 usr + 1.25 sys = 30.59 CPU) ---------------- Store: DB_File, Times: 10000 ---------------- the code took:33 wallclock secs (14.90 usr + 1.89 sys = 16.79 CPU) ---------------- Store: SharedMem, Times: 10000 ---------------- the code took:2657 wallclock secs (2450.79 usr + 196.40 sys = 2647.19 CPU) -- 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