| CARVIEW |
|
|
| Code license: | New BSD License |
|---|---|
| Labels: | redis, KeyValue, AnsiC, database, networking, persistent, lists, sets, atomic, memcached, Posix, GPL, dictionary, hashTable |
| Blogs: | |
|---|---|
| Feeds: | |
| Groups: |
| Project owners: | |
|---|---|
| antirez | |
| Project committers: | |
| l...@qix.it | |
| Project contributors: | |
| simonwillisonnet | |
Redis 1.0 stable Released! Changelog: fixes of different types. The development will continue into the Git version and from time to time stable releases will be shipped as tar.gz. Thanks for the help you provided in this months!
Redis is a key-value database. It is similar to memcached but the dataset is not volatile, and values can be strings, exactly like in memcached, but also lists and sets with atomic operations to push/pop elements.
In order to be very fast but at the same time persistent the whole dataset is taken in memory and from time to time and/or when a number of changes to the dataset are performed it is written asynchronously on disk. You may lost the last few queries that is acceptable in many applications but it is as fast as an in memory DB (Redis supports non-blocking master-slave replication in order to solve this problem by redundancy).
Compression and other interesting features are a work in progress. Redis is written in ANSI C and works in most POSIX systems like Linux, *BSD, Mac OS X, and so on. Redis is free software released under the very liberal BSD license.
Beyond the key-value model
It is possible to think at Redis as a data structures server, it is not just another key-value DB, see all the commands supported by Redis to get the first feeling. Redis supports operations like atomic push and pop of elements on lists, taking ranges of elements from this lists at once, trimming of lists, server-side intersections of sets and even sorting data! To show our points we wrote a simple Twitter clone with PHP + Redis: it's a very simple but still a real world example of web application, the article explains step by step how to write scalable applications with Redis.
Supported languages
- Ruby main repository written by Ezra Zygmuntowicz (aka ezmobius)
- Python main repository written by Ludovico Magnocavallo (aka ludo)
- Twisted Python pypi link, thanks to Dorian Raymer.
- PHP main repository written by Ludovico Magnocavallo (aka ludo)
- PHP client lib written in C, as a PHP module! https://code.google.com/p/phpredis/ thanks to Alfonso Jimenez.
- Erlang main repository written by Valentino Volonghi of Adroll
- Tcl (the official version is included in the Redis tarball since it's maintained by myself, now you can find it in the Git repository).
- Perl bindings for Redis are available in this SVN repository thanks to Dobrica Pavlinusic.
- Lua bindings for Redis are available in this git repository (and as well as in the Redis git) thanks to Daniele Alessandri.
- Java has two client libraries projects: JDBC-Redis that as you can guess from the name is a client implementing the JDBC API, and JRedis that is JCA compliant. Both libs are actively developed and good quality, I suggest you to check both. Also note that JRedis plans to release support for asynchronous communication between the client and Redis.
- Scala bindings for Redis are available in this Git repository, thanks to Alejandro Crosa.
- Clojure bindings for Redis: redis-clojure thanks to Ragnar Dahlén.
All the client libraries are shipped in the same tar.gz together with Redis but if you want the latest versions check the main repositories. An exception is for both the Java clients that are not still included in the tar.gz since they reached stability recently.
Also there are other Redis related projects that are not library clients:
- Rack::Session, Rack::Cache and cache Redis stores for Ruby web frameworks written by Luca Guidi
- A datamapper adapter for Redis written by Whoahbot.
Speed
Redis is pretty fast!, 110000 SETs/second, 81000 GETs/second in an entry level Linux box. Check the benchmarks.
Sharding
I see a bit of misinformation in different articles around the net about Redis's ability to distribute the dataset across multiple servers. Redis can do it like any other key-value DB, basically it's up to the client library. For example the Ruby client supports consistent hashing out of the box, you can specify multiple servers and the library will take care of hashing the key and put different keys into different Redis servers. With client libraries not supporting consistent hashing you can do different things, hash the key yourself, split different User-IDs data into different servers using ranges (for example from UID 1 to 100000 to server 1, from 100001 to ... to server 2 and so on). Basically sharding is a feature that is natural in every kind of key-value DB, and even in SQL DBs if they are used just to access records by a single primary key.
In the long run I could like that all the client libraries for the most used languages will implement consistent hashing automatically, possibly using the same hashing algorithm, so that it will be possible to provide tools to redistribute the keys as fast as possible when adding or removing a node from a cluster of Redis boxes.
Learn more!
We have quite a bit of documentation, take a look.
To get fresh information about the development of Redis you can follow antirez's twitter.
Programming examples
- Retwis is a PHP+Retwis twitter clone. Live demo, article explaining it design. The code is in the Downloads tab.
- Retwis-rb is a port of Retwis to Ruby and Sinatra written by Daniel Lucraft! With full source code included of course, the git repository is linked at the end of the Retwis-RB page.
- A very simple example of Ruby+Redis app using Sinatra. It's a note taking example developed by Pieter Noordhuis
Replication Quick Start
By default you can run Redis without a config file. For replication, at least in the slave, you need to load one. Just use ./redis-server redis.conf. All you have to do to make a Redis instance a slave of some other Redis server is to uncomment the slaveof <hostname> <port> line in the config file and re-run the slave. The two servers will sync and you can ask for the same queries in both to check the slave is actually a copy of the master. Learn more about replication...
News
- 3 September 2009 - Redis 1.0 released.
- 21 April 2009 - Redis-Git now includes non blocking replication. This means that the master will continue to serve other clients while slaves are connecting doing the first synchronization. Also SUNION and SUNIONSTORE are now implemented.
- Redis-Git now has EXIPRE! timeouts in keys, but even timeouts are persistent on disk
- A new PHP programming example with Redis! In the form of an Ajax chat, released as open source, download and demo here, thanks to Александр Лозовюк.
- We have a video! watch the Ezra Zygmuntowicz talk about Redis to know the most important Redis ideas in few minutes
- The SVN version features the first implementation of the SORT command! This command is very powerful, check the README wiki page for more information about it, or read this article (but note that the actual Redis command is more powerful).
- Now Redis is under the BSD license. The past license was GPL, now abandoned in favor of a more liberal license that allows people to do almost everything with Redis in both commercial and non commercial environments. Check out the SVN version to have a BSD licensed Redis since beta-6 is still with the old license.
- Beta 6 Released.
- Now we have an example of a web application (a simple twitter clone) entirely written using PHP + Redis. No SQL at all. It's the hello world of Redis and I'm writing an article to explain step by step how it works. You can test this app here. and an article explaining how it works step by step.
Redis on the press
- (?? April 2009) Bob Ippolito talk Drop ACID and think about Data gives an overview of different key-value stores. Redis is included in the listing around minute 24 of the video.
- (16 April 2009) Redis featured on LWN. The article states that Redis does not support sharding. Actually it's up to the client and for example the Ruby client supports sharding.
- (9 April 2009) an overview of modern SQL free databases on 00f.net. Redis is included.
- (20 March 2009) Redis featured by Todd Hoff in the Highscalability.com blog.
- (11 March 2009) Antonio Cangiano wrote about us in his great blog.
Who is using Redis?
- Engine Yard
- Github
- Vidiowiki
- Wish Internet Consulting
- Ruby Minds
- LLOOGG
- Virgilio Film (Italian movies community)
Please if you use Redis in your startup drop me an email or tweet me @antirez and get listed here.
Road map
Redis 1.0 was released the 3 September 2009. We are making plans for the next roadmap that will lead to Redis 1.1.