How would you use Redis for Exception Handling

exception handlingredis

I was reading this transcript of an interview with a GitHub developer and he was describing how they use Redis:

Q: You mentioned using Redis. How do you use that?
A: We use Redis for
exception handling
and for our queue. We tried a lot of Ruby-based
queuing mechanisms. Chris wrote an abstraction to the queuing
mechanism. We used to use BJ and DJ and in the super early days we
tried out Amazon SQS and a lot of queuing mechanisms and they all fell
over at one point or another with the amount of traffic that we were
doing on them and the types of queries that we were trying to get from
them. Eventually we moved to a Redis space that Chris also wrote,
called Resque.

Can anyone guess to what that means to use Redis for exception handling? Does it mean the logging of exceptions or something else?

You can see the video of him saying it here.

Best Answer

Yes, he meant logging. Redis is actually classical for logging - it's volatile data; writes should be extremely fast in order to not create an unnecessary load on the system/database; you are usually interested in only the last logs so you can easily run:

LPUSH log error_message
LTRIM log 0 1000

and always keep only the latest logs. Of course, this example is highly simplified, but this is the main idea.

See:

  1. http://redis.io/commands/ltrim
  2. http://simonwillison.net/static/2010/redis-tutorial/ - the slide that begins with Capped Collections