Strange memcached behavior on stress test

Janning Vygen vygen at
Tue Jun 13 07:39:39 UTC 2006

Am Montag, 12. Juni 2006 18:17 schrieb Brad Fitzpatrick:
> On Mon, 12 Jun 2006, Janning Vygen wrote:
> > > (though that depends on your usage pattern) but this is one condition
> > > where you'll get a set problem and an out of memory error even if you
> > > have space left in individual slabs.
> >
> > Thank you garth for this detailed explanation. Now i think i understood
> > my problem. My session data is very different in size. So my allocated
> > "slabs" are "full" and a new slab can't be allocated.
> Janning,
> This problem is fixed in two different ways in later releases.  Try out
> this version for now:
> It pre-allocates a 1MB slab of each class on start, so people won't run
> into this confusion.

Ok, i would run a newer version of memcached IF memcached is the right thing 
for (PHP) session management. I am not sure about it anymore. Some people on 
the list told me it is not the right thing because it saves it's session in 
memory. But i dont think that this is a problem. But i think session 
management with memcached can run into problems if you have a peak with lots 
of pages as the oldest session data is moved out and you do not have a 
garanteed session time anymore.

If i have a memcached instance with 2GB memory and my average session data is 
8 KByte (slab size) i can save 262144 items. As the oldest value is pushed 
out, i will never have a guranteed session expiration time (in terms as you 
are still logged in after 20 minutes of inactivity). A memory is quite 
expensive it maybe does not make sense to use memcached as a session storage. 
An i am now convinced that sharedance might do it much better, because it 
uses disks to store session data.

Maybe i should take a look at sharedance which was always on my option list. 
But memached rocks at the moment (beside the memory problem i encountered 
once). And i feel that memcached is more used and better supported. 

kind regards,

PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10

More information about the memcached mailing list