You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Enrico Sorcinelli <be...@perl.it> on 2004/09/17 11:28:28 UTC

[ANNOUNCE] Apache::Session::Memcached 0.02

The uploaded file

    Apache-Session-Memcached-0.02.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/E/EN/ENRYS/Apache-Session-Memcached-0.02.tar.gz
  size: 4141 bytes
   md5: 15481d872dc8dd2cf8e319903d139b17

---

I'm glad to announce Apache::Session::Memcached.
This module provides a way to use memcached as Apache::Session storage
implementation (more informations about memcached are available at
http://www.danga.com/memcached).

Any comment and/or criticism are welcome :-)

by

	- Enrico

PS: Sorry if Apache::Session::Memcached isn't strictly tied to mod_perl, but
historically we use this list for Apache::Session related things (until the list
kick us off :-)

-- 
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


Re: [ANNOUNCE] Apache::Session::Memcached 0.02

Posted by Casey West <ca...@geeknest.com>.
It was Tuesday, September 21, 2004 when Enrico took the soap box, saying:
: It would be a nice thing to set up a bechmark suite and also include it in
: Apache::Session distribution (the raison I've CC to Casey)

There are some benchmarks in the A-S distribution already. No more
will be added, however, until the test suite is acceptable. See under
b/, Jeffery wrote them.

I have not tried to run them.

  Casey West

-- 
Good Idea: Playing cops'n'robbers in the park.
Bad Idea:  Playing cops'n'robbers in the bank. 


-- 
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


Re: [ANNOUNCE] Apache::Session::Memcached 0.02

Posted by Enrico <be...@perl.it>.
On Mon, 20 Sep 2004 15:00:15 -0400
Perrin Harkins <pe...@elem.com> wrote:

Hi Perrin,

> 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.

In my bacis tests, I haven't used at all any cache layer other than
Apache::Session::Flex and related datastore. 
I attached the simple test script I've used. And probably is a bad script :-)

Also I'm interested in your benchmarks :-)

It would be a nice thing to set up a bechmark suite and also include it in
Apache::Session distribution (the raison I've CC to Casey)

by

	- Enrico


Re: [ANNOUNCE] Apache::Session::Memcached 0.02

Posted by Perrin Harkins <pe...@elem.com>.
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


Re: [ANNOUNCE] Apache::Session::Memcached 0.02

Posted by Enrico <be...@perl.it>.
On Fri, 17 Sep 2004 10:45:18 -0400
Perrin Harkins <pe...@elem.com> 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


Re: [ANNOUNCE] Apache::Session::Memcached 0.02

Posted by Perrin Harkins <pe...@elem.com>.
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.

Memcached would be better suited to acting as a write-through cache for 
session data that you store in a database.

- 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