another redis automatic failover solution for ruby

    13 Jan 2013

    Redis gets more and more popular as a backend storage, so the redis failover solution becomes important before you use redis as a critical resource.

    Currently the most popular automatic master/slave failover solution for ruby is redis_failover, it's based on ZooKeeper, if you already have ZooKeeper in your infrastructure, it's great.

    But I noticed that redis already has a built-in automatic failover solution, called Redis Sentinel. In case you didn't heard of it, please read the official document, it's simple and no other external dependency. I searched on github...

    Read More


    redis mget/mset vs get/set

    05 Apr 2012

    Our application uses redis a lot to perform large numbers of data reads/writes. But we didn't use it well enough, e.g. we call redis get and set in loop, just like touching mysql and memcache many times, it takes a long time to send multiple redis commands, if we can reduce the commands, it saves on round trip time.

    The following script is used to bencharmark different commands count.

    require 'redis'
    require 'benchmark'
    redis = do |bm| "redis set" do
    Read More


    passenger with redis

    12 Dec 2011

    Today I encountered an issue that passenger forks too many workers than what we set (6) on qa servers. I used strace, the passenger worker is blocked by failed to writing to a socket, like

    select(15, [], [13], [], [58, 915000])

    fd 13 is a socket.

    I also tried netstat and found the status for some redis socket connections are CLOSE_WAIT.

    So I judged this is the problem the ruby redis clients are not cl...

    Read More