[Redis] Perl Redis Client news

Pavel Shaydo pshajdo at gmail.com
Tue Nov 19 15:51:55 GMT 2013


On Mon Nov 18 18:20:29 2013
melo at simplicidade.org (Pedro Melo) wrote:
> RedisDB (I *think* its RedisDB…) has a XS interface. We could
> compare it with our read()-based performance…

It was some time ago, and I have no time right now to repeat
benchmarks, but if I remember correctly RedisDB XS parser is about 30%
faster than RedisDB PP parser. You can compare them yourself if you
are interested, if REDISDB_PARSER_PP environment variable is true at
module load time it will use PP parser. Performance of RedisDB with XS
parser is about the same as of Redis with read-based parser. The reason
I keep IO and parser separate is not performance -- it allows me to
check if there are replies from server without blocking on input, so I
can do send and forget style sends:

    $redis->set('foo', 'bar', $RedisDB::IGNORE_REPLY);

which return immediately after sending command to server and without
waiting for the reply, or I can do pipelining without the need to
wait_all_responses periodically:

    while (<>) {
        # before sending GET it will check if there are replies to
        # previously sent commands and invoke callbacks
        $redis->get($_, sub { say $_[1] }));
    }
    # still need this in the end
    $redis->get_all_replies;

Which of course has its price -- its additional syscall before every
send, so I had to implement XS parser to compensate and not lag behind
Redis.

Pavel Shaydo



More information about the Redis mailing list