starting with memcached

Anatoly Vorobey mellon at pobox.com
Wed Mar 16 15:42:46 PST 2005


On Wed, Mar 16, 2005 at 04:29:04PM -0700, Cahill, Earl wrote:
> Well, starting, but in a big way.  Want to cache some conf file lookups for
> several million hits a day.  Looks like the default for max simultaneous
> connections is 1024, and just wondering how well a single box handles that
> many connections.  Let supposing I have 50 boxes all doing 20 connections
> each, for a thousand total connections, is that a reasonable thing?  

Not at all, you'd be wasting boxes. Memcached is optimised for a lot of
connections, and (provided you use epoll on linux or kqueue on 
BSD) easily handles 300, 500 or 700 of them still using 
very little CPU. With memcached, the reason to add more boxes is to 
increase the total amount of memory available to memcached rather 
than to distribute connections.

> Is
> there a way to limit the number of connections per host?  

Per a running memcached instance -- with a -c command line flag.

> My implementation is in perl, and I am trying to use Cache::Memcached to get
> some stats about the server, and have tried each key listed under stats, but
> have yet to find one that will just show me what is actually in the cache.
> Does such a method exist?  Even some commandline way would be very helpful.
> Or some guidance and maybe I could contribute such a method.

There is "stats cachedump <slab id> <total number of items to display>".
It's undocumented and you need to understand the internal memory 
architecture of memcached (the slabs allocation method, there's an 
explanation on the website or in the distribution somewhre) if you want 
to use it. It's not a great idea to use it for anything other than 
debugging the server. I don't think Cache::Memcached gives you access
to it, you need to actually telnet into the server, as if you were a 
client, and type it in.

-- 
avva
"There's nothing simply good, nor ill alone" -- John Donne



More information about the memcached mailing list