Redis @ 30,000 Feet
- Revised: 2016-05-18
Redis is both a No-SQL data store and a caching layer. No-SQL data stores are databases that allow you to persist data but do not use the traditional SQL syntax, and do not organize the data in the relational table format dicated by the SQL standard. A caching layer is any layer in your architecture that serves to store often used data for quick access. Caching layers can be extremely useful in providing lightning-fast access to information that would otherwise be relatively slow to retrieve. Caching layers have numerous uses: Caching layers are very often employed by high volume websites to provide quick and responsive User Interfaces, and are also used as middle-tier layers to facilitate queuing mechanisms between disparate systems or to decouple existing systems.
Redis is known for its ability to store a large amount of data while allowing fast access even in high volume environments. Redis is commonly called a key-value-pair database (AKA "key-value store") due to the fact that almost all interactions with Redis involve passing a key and either setting or getting the resulting value. In a key-value store, the underlying system does not need to know the structure of your data. The simplicity of instructions in a key-value store are made up for with speed of access and, in the case of some operations, guaranteed ACID transactions (transactions that are Atomic, Consistent, Isolated, and Durable)
Redis allows developers to store practically anything in the "value" part of the key-value pair, and extensively supports: Lists (collections of string elements sorted by their order of insertion), Unsorted Sets (collections of unique and unsorted string elements), Sorted Sets (Sets where specific ranges can be selected), and Hashes (maps where numerous key:value pairs can be accessed after identifying a specific key). Redis also supports HyperLogLogs (Probabalistic data structure for counting unique items) and a Publish/Subscribe structure. When developers use these Redis data structures in creative ways, results can be achieved on very large data sets that would make similarly-structured SQL-based systems seem glacially slow by comparison. That being said, Redis is very often used in combination with a traditional SQL database - Redis handling high volume key lookups and responses, and the database handling persistence of large data sets.
By default, Redis is an in-memory but persistent on disk data store. The size of a Redis dataset is limited to the RAM available on the machine. Most SQL-based databases perform much faster if the entire database is in-RAM, but happily continue to perform when information must be swapped to disk. However, with Redis the all-in-memory limit is a hard limit and there is no disk swapping mechanism.
"When developers use these Redis data structures in creative ways, results can be achieved on very large data sets that would make similarly-structured SQL-based systems seem glacially slow by comparison"
Although Redis can be easily configured to backup the data to disk, the focus in Redis is on high speed and accurate operations. With two different persistence options (sometimes used simultaneously) Redis backups can be as safe, accurate, and near-real-time as a typical SQL-based database backup.
Due to the memory-intensive nature of Redis, development teams should take care to 'clean up after themselves' and their keys. Redis keys that are no longer needed by your systems need to either be forcibly deleted, or you must make use of a "TTL" (Time To Live) feature to auto-expire old keys. It is not uncommon for Redis implementations (at least those where the developers did not setup a key cleansing strategy) to suddenly run out of memory - at which time they will refuse to store new keys, but will gladly hand out the values of existing keys.
Redis is available on numerous cloud platforms. AWS offers Redis as part of its "Elasticache" offering, and AWS Redis instances that are multi-node and multi-zone available can easily be deployed. Heroku and Microsoft Azure both offer a "rediscloud" add-on by way of Redis Labs.
Ease of Installation and Configuration
Installing Redis on any Linux based machine is very straightforward with practically no configuration options required to get started. Redis is a true toolkit - the real magic comes in knowing how to use the tools.
As a key-value store, Redis is often compared to memcached and MongoDb - other open source key-value stores. Google's "Cloud Datastore" is a key-value store NoSQL offering similar to Redis. There are many other similarly-structured sytems in the "NoSQL" family including, but certainly not limited to: Cassandra, CouchDB, Riak, and Hyperdex.
History and Culture
Redis (which officially stands for REmote DIctionary Server) is an open-source project. The product is actively maintained and championed by many private companies (Engine Yard, Pivotal, and Redis Labs to name a few) with development services and funds contributed since at least 2009. Since 2015 Redis has had an annual conference around May -- With the 2016 RedisConf expecting to have approximately 400 attendees. Redis has 2.8 and 3.0 branches that are both stable.