Memcached as a Sessions Store (etc)
sgrimm at facebook.com
Wed Jun 28 20:41:31 UTC 2006
Interesting summary of what you're doing. Thanks for writing that up.
> (1) We don't run the Facebook patches, but since we're using our
> regular memcached cluster for our sessions store, essentially we've
> already pre-allocated slabs of every class that a session might land in.
The "no preallocation needed" fix is actually the least useful benefit
you'd get from running with our changes. A bigger benefit would be the
change to the way slab classes are allocated. In 1.1.12, if you need to
store a 513-byte item, memcached will use a 1024-byte chunk to do it.
Our change reduces the rate of increase of chunk sizes so you'll waste
less memory per item. And if you know your values tend to fall within a
particular range of sizes, you can adjust the chunk sizing further by
playing with a couple of command-line parameters.
Since it sounds like you're expiring items as quickly as you're
inserting new ones, this probably won't affect your hit ratio, but it'll
mean you can wait longer before buying additional memcached capacity.
You will also probably benefit from the CPU efficiency improvements.
More information about the memcached