various optimizations in the i/o handling, everything is much faster now

a brief comparison against memecached gave me the following results:
(running 3 instances of both memcached and shardcached)

nt@xnt:~$ ps ax | egrep "(memcache|shardcache)" | grep -v grep
62025 s000  S+     0:05.79 ./shardcached -n peer1:localhost:4441,peer2:localhost:4442,peer3:localhost:4443 -m peer1 -H
62032 s001  S+     0:06.08 ./shardcached -n peer1:localhost:4441,peer2:localhost:4442,peer3:localhost:4443 -m peer2 -H
62038 s008  S+     0:06.08 ./shardcached -n peer1:localhost:4441,peer2:localhost:4442,peer3:localhost:4443 -m peer3 -H
62059 s009  S      0:05.95 memcached -p 5553 -vv
62065 s009  S      0:05.82 memcached -p 5552 -vv
62071 s009  S      0:04.90 memcached -p 5551 -vv

running something like this as benchmarking test (but alternating between only reads, writes or both)
$results = timethese(100,
    {
        'memcached r/w' => sub {
                foreach my $i (0..1000) {
                    unless ($memd->set("test$i", "value$i", 60)) {
                        print "Err\n";
                    }
                    $memd->get("test$i") eq "value$i" or warn "Err";
                }
         },
        'shardcached r/w' => sub {
                foreach my $i (0..1000) {
                    unless ($c->set("test$i", "value$i", 60)) {
                        print "Err\n";
                    }
                    $c->get("test$i") eq "value$i" or warn "Err";
                }
        },
    });
cmpthese( $results ) ;

Benchmark: timing 100 iterations of memcached w, shardcached w...
memcached w: 10 wallclock secs ( 1.19 usr +  2.74 sys =  3.93 CPU) @ 25.45/s (n=100)
shardcached w:  8 wallclock secs ( 1.32 usr +  2.28 sys =  3.60 CPU) @ 27.78/s (n=100)
                Rate   memcached w shardcached w
memcached w   25.4/s            --           -8%
shardcached w 27.8/s            9%            --
Benchmark: timing 100 iterations of memcached r/w, shardcached r/w...
memcached r/w: 19 wallclock secs ( 2.22 usr +  5.39 sys =  7.61 CPU) @ 13.14/s (n=100)
shardcached r/w: 16 wallclock secs ( 2.66 usr +  4.51 sys =  7.17 CPU) @ 13.95/s (n=100)
                  Rate   memcached r/w shardcached r/w
memcached r/w   13.1/s              --             -6%
shardcached r/w 13.9/s              6%              --
Benchmark: timing 100 iterations of memcached r, shardcached r...
memcached r:  9 wallclock secs ( 0.93 usr +  2.62 sys =  3.55 CPU) @ 28.17/s (n=100)
shardcached r:  8 wallclock secs ( 1.29 usr +  2.24 sys =  3.53 CPU) @ 28.33/s (n=100)
                Rate   memcached r shardcached r
memcached r   28.2/s            --           -1%
shardcached r 28.3/s            1%            --
no need to lock the object, it will always be vaild until we call arc_release_resource() on it
fixed a leak