Redis is a lightweight, flexible, key-value store, open source DBMS. The name is derived from the term REmote DIctionary Server. Redis is frequently used for applications with high-availability and low-latency requirements, such as gaming, retail and mobile. The schema flexibility of key-value databases such as Redis helps them excel at session management, serving ad content and managing user or product profiles.
A key-value database is ideal when most of the access to data is by using a key, such as looking up product details by a product number. The details can be any type of information -- and can even vary from product to product.
Redis open source DBMS features
Enhancements to the latest version of Redis, 3.2.3, include a new GEO API that enables indexing by longitude and latitude, as well as other geographical commands and capabilities.
The new Bitfield data structure allows arbitrary-sized counters to be implemented in a memory-efficient manner. Enhancements to the Redis Cluster include support for rebalancing, which improves redistribution and migration of replicas. Additional improvements were made to the Lua scripts debugger, Redis' memory management, and monitoring using Sentinel.
Fundamentally, Redis is set up using a simple configuration file. Parameters are available to specify the working directory and control behavior, including how frequently data is saved, limits and replication. Redis also uses its own event library.
There are several higher-level libraries and tools available, including redis-mount (to use Redis as a filesystem) and Redis Desktop Manager (cross-platform desktop graphical user interface management tool). Additionally, Redis supports numerous languages, including C, C#, C++, Erlang, Haskell, Java, Perl, PHP, Python, R and Ruby.
Although the Redis open source DBMS is a key-value store, it supports various data structures. With traditional key-value stores, you associate string keys to string values; in Redis, the value isn't limited to a simple string. Rather, it can also hold more complex data structures. Redis supports the following data structures:
- Binary-safe strings.
- Lists or collections of string elements sorted according to the order of insertion.
- Sets, which are collections of unique, unsorted string elements.
- Sorted sets, which are similar to sets, but every string element is associated to a floating number value called a score. The elements are sorted by their score, which enables you to retrieve a range of elements.
- Hashes, which are maps composed of fields associated with values. Both the field and the value are strings.
- Bit arrays (bitmaps), which use special commands to handle string values like an array of bits; you can set and clear individual bits, count all the bits set to 1, or find the first set or unset bit.
- HyperLogLogs, which is a data structure that can estimate the number of items (cardinality) of a set (i.e., count unique things).
Redis runs on Linux. Although the Redis project doesn't directly support Windows, Microsoft Open Technologies develops and maintains a Windows port targeting Win64.
The Redis open source DBMS is available as a BSD license. The Redis community offers support through the official mailing list, as well as #redis on Freenode. Enterprise Redis is available both as Redis Labs Enterprise Cluster and Redis Cloud. It is a single line upgrade from open source Redis to RLEC, and can be accomplished without any downtime. Redis Cloud is available on all major infrastructure as a service platforms (AWS, Azure, Google Cloud and IBM Softlayer) as well as from platform as a service providers such as Heroku, CloudFoundry and OpenShift.
Redis is priced as an annual subscription based on the number of database shards required. Commercial support is available through Redis Labs, the official sponsor of the Redis Project. Redis Labs offers two levels of professional support: standard and premium. Standard support offers a one-business-day response. Premium support offers a response within two hours for urgent issues, within four hours for high-priority issues, and within one business day for low priority issues.
Performance benchmarks and example implementations and metrics are available from Redis Labs.
About the author
Craig S. Mullins is a data management strategist, researcher, consultant and author with more than 30 years of experience in all facets of database systems development. He is president and principal consultant of Mullins Consulting Inc. and publisher/editor of TheDatabaseSite.com. Email him at firstname.lastname@example.org.
This article was updated in September 2016.
The key to understanding new database technology
NoSQL databases are challenging the monopoly of the RDBMS
The growing market for database as a service