Project Spotlight: Redis, a fast data-structure database

This is the first in a series of blog posts where we will highlight open-source projects that we find interesting or that we are using at messagepub.

Redis is a key-value storage database, similar to memcached or Tokyo Cabinet. Redis was written in C by Salvatore Sanfilippo.

Redis is super fast: about 110,000 SETs per second, about 81,000 GETs per second (see benchmarks). Unlike memcached, the data is persisted asynchronously to disk from time to time. You can still lose data if your redis-server crashes, but you will only lose the data since the last dump to disk. You can configure how often you want to write to disk.

Redis is more than a key-value store. It is more like a data-structure server. Besides storing string values, you can also store lists or sets. For example, on a list, you can do things such as pushing an element to the tail (RPUSH) or the end of head (LPUSH) of the list, return the length of the list, trim the list, get or set a value at any position in the list, pop values at the tail (RPOP) or head (LPOP) of the list, etc…

My favorite thing about Redis, besides the blazing fast performance, is how simple the API is. You can easily start testing Redis with just telnet and the list of commands. That simple interface is probably one of the reasons why even though the project is very new, there has already been client libraries written in 9 languages, with at least one more in the works.

At messagepub, we are using Redis to enforce the rate limit on our API (i.e. Api Throttling). It’s been super-stable in production and is the perfect tool for this purpose.

In a future blog post, I will share a bit more about our experience deploying and monitoring Redis.

Resources

1 comment so far

  1. [...] is where Redis comes in. Redis is a super-fast key-value database that we’ve highlighted in a previous blog post. It can do about 110,000 SETs per second, about 81,000 GETs per second. That’s the kind of [...]


Leave a reply