starting with memcached
Cahill, Earl
ecahill at corp.untd.com
Wed Mar 16 17:34:53 PST 2005
> 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? Rght now I
have a load of 0.07 and 640 connections.
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.
> > Is
> > there a way to limit the number of connections per host?
>
> 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 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.
[Cahill, Earl]
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.
Thanks,
Earl
-------------- next part --------------
sub dump_all {
my $self = shift;
my $hosts = shift || 'all';
my $ref = $self->stats("slabs");
my $slabs = {};
foreach my $host (keys %{$ref->{hosts}}) {
$slabs->{$host} ||= {};
while($ref->{hosts}{$host}{slabs} =~ /^(.+)$/mg) {
my $line = $1;
next unless($line =~ /^STAT\s+(\d+)/);
$slabs->{$host}{$1} = 1;
};
my $count = 0;
foreach my $host (keys %{$slabs}) {
my $_self = Memcache->new({ servers => [$host]});
print "$host\n" . ('-' x length($host)) . "\n";
foreach my $slab (keys %{$slabs->{$host}}) {
my $command = "cachedump $slab";
my $ref = $_self->stats($command);
while($ref->{hosts}{$host}{$command} =~ /^ITEM\s+(\S+)/mg) {
print "$1\n";
$count++;
}
}
}
print "$count\n";
}
}
More information about the memcached
mailing list