When redis first crossed my radar last year, I had some serious doubts about the numbers people were quoting, doubts my own testing1 inevitably prove to be completely unfounded.
Performance, though impressive, is but a small part of what makes this little database so amazing. Despite being clasified as a key-value store, what really sets redis apart is its rich set of datatypes, including not only strings, but lists, sets, and hashes as well.
Installing redis is ridiculous simple, and you can get it up and running in a matter of seconds. In a new terminal try:
$ wget http://redis.googlecode.com/files/redis-1.2.6.tar.gz $ tar -xzf redis-1.2.6.tar.gz $ cd redis-1.2.6 $ make $ ./redis-server
One of the simplest ways of interacting with redis is via the interactive console, in a new terminal you can launch the cli client with the following command:
$ cd redis-1.2.6 $ ./redis-cli
And you can now interact with redis via its rich yet simple set of commands
redis> KEYS * redis> SET foo bar OK redis> KEYS * foo redis> GET foo bar redis> SADD breakfast bacon (integer) 1 redis> SADD breakfast eggs (integer) 1 redis> SADD breakfast fruit (integer) 1 redis> SMEMBERS breakfast 1. bacon 2. fruit 3. eggs redis> SREM breakfast fruit (integer) 1 redis> SMEMBERS breakfast 1. bacon 2. eggs redis>
March brought with it my first opportunity to deploy redis into my works production environment, and I have since been de-normalizing much of the sore spots in our existing relational database into a cluster of redis servers.
So far redis has proven its self to be an ideal storage solution for:
Using redis has not only resulted performance gains, but in places its simplistic model has also lead to more readable code.
130,000 reads and 80,000 writes per second on my machine ↩
© 2010-2012 Daniel Knell