starting with memcached

Anatoly Vorobey mellon at pobox.com
Thu Mar 17 01:21:30 PST 2005


On Wed, Mar 16, 2005 at 06:34:53PM -0700, Cahill, Earl wrote:
> > 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.
> 
> [Cahill, Earl] 
> 
> Sorry, I mean I have fifty client boxes connecting to one host.  Dumb
> question, but I am in linux, how do I tell if I am using epoll?

See my previous message to the list.

I don't see a problem with any number of client boxes connecting to the
memcached server; what matters to the server is the number of 
connections, not the number of different machines they're coming from.
If you have really really huge traffic, memcached traffic may rise 
high enough to saturate your LAN, but that seems unlikely in your 
case (millions of hits per day).

> We did a partial launch today and want to finish this part of our launch
> tomorrow.  Today's launch cached a small number (under a thousand) of things
> that get hit a lot and tomorrow's launch will be a lot of things (maybe a
> couple million) that get hit a lot.  Kind of worried a bit about tomorrow.

Good luck!

> > Per a running memcached instance -- with a -c command line flag.
> 
> [Cahill, Earl] 
> 
> Yeah, sorry again, I mean per client, like I want at most ten connections
> per client.

I guess I don't understand you, or you're not asking the right question.

Cache::Memcached has an OO interface. Every object you create will 
connect, on demand, to every memcached server you gave it in the list
of servers when you created it (or changed later with the set_servers
call). If you only have one server, that will be one connection per 
object. It will not create more than one connection to the same server
(per object). If you have 8 separate processes each using one 
Cache::Memcached object 
(for instance 8 Apache subprocesses handling 8 requests simultaneously 
running Perl via mod_perl or CGI and creating one Cache::Memcached 
object each) you will have the total of 8*number-of-servers connections 
from clients on that box to memcached servers.

Does that answer your question?

> Well, I wrote something that will dump all the keys by host and attached it.
> Really, I just care what the keys are, not really even the values, but going
> forward, if I am interested in the values, I guess I could just do gets to
> get them.

Yeah. But note that if you don't specify a maximum number of items to 
dump, it will *not* dump all the items for that slab, but rather all the
items until the buffer that holds all that text reaches a predefined 
limit (2Mb, hardcoded into source code, currently). It's meant to be a 
debugging interface, not a reliable way to get all keys.

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



More information about the memcached mailing list