mdelete and Cache::Memcached::delete_multi()

Tomash Brechko tomash.brechko at gmail.com
Fri Nov 16 06:36:12 UTC 2007


On Thu, Nov 15, 2007 at 10:29:04 -0800, dormando wrote:
> >Hmm, maybe I don't get the code, but I think the server may switch
> >from conn_write to conn_read only on TRANSMIT_COMPLETE, i.e. it pushes
> >full responce before reading the next request.  The test case could
> >tell, but lazy to write one.
> 
> I didn't map the whole thing out, but it'll just create a 
> TRANSMIT_SOFT_ERROR each time, which just stops processing for the 
> write. Since the socket's listening on the "writable" event, it'll pull 
> from the iovecs the next time it's able to.

That's correct, the server won't block.  But it will stay in
conn_write state until TRANSMIT_COMPLETE, while next request may be
read only in conn_read state, so the client will block.  The following
script shows this (though you may have to increase $count):


#! /usr/bin/perl
#
use warnings;
use strict;

use IO::Socket::INET;

use FindBin;

@ARGV == 0 or @ARGV == 1
    or die "Usage: $FindBin::Script [COUNT]\n";

my $addr = "127.0.0.1:11211";
my $count = $ARGV[0] || 1_000_000;

my $sock = IO::Socket::INET->new(PeerAddr => $addr,
                                 Timeout  => 3);
die "$!\n" unless $sock;


foreach (1 .. $count) {
    print $sock "set foo 0 0 1\r\n1\r\n";
}
foreach (1 .. $count) {
    scalar <$sock>;
}



-- 
   Tomash Brechko


More information about the memcached mailing list