What is Redis Used For?
Redis, an acronym for Remote Dictionary Server, is a type of data structure server. Redis is a key-value in-memory database, a type of nonrelational database that relies on main memory, instead of either HDD or SSD, for computer data storage. One of the main differences between typical key-value databases, that store data as an aggregation of key-value pairs, and Redis is the latter’s ability to store and compile high-level types. The data types are basic and commonly used data structures such as maps, lists and sets.
What is Redis Used For?
In contrast to traditional relational databases, Redis offers enhanced performance and operational simplicity while providing atomic manipulation of data structures. This allows Redis to solve problems too difficult or complex for conventional relational databases.
Benefits of Using Redis
High-Speed Caching: Due to its high performance, Redis can handle high-volume read and write operations that exceed the capacity of more traditional relational databases. This makes Redis’s ability of persisting data to disk superior to conventional general purpose memory-caching systems.
Publish/Subscribe Model: Redis versions 2.0 and later provides the capability to distribute data with an efficient publish and subscribe messaging method. This had led to many DBAs to move away from less efficient message queuing systems, like RabbitMQ, zeromq.
More Efficient Queues: Projects such as Resque, a Redis-backed Ruby library, uses Redis for queuing background processes.
Counter Simplicity and Consistency: Atomic commands, like HINCRBY, provide for quick and easy counter implementation. Adding a counter only requires naming a key and then executing the HINCRBY command. The data does not have to be read before it is incremented and it does not require updates to database schemas. Because these are process that run independently of any other processes, counters will maintain consistency across various application servers.
When answering the question “What is Redis used for?” it is important to understand it benefits. Here is an explanation of its key attributes:
Improved Data-Structure: Redis provides for the five possible data-value types of hashes, lists, strings, sets and sorted sets. Operations specific to the five data types are provided with Redis along with authenticated Big O’ notation.
Increased Performance: Redis’s in-memory structure and an event-based programming model allows for reducing increased simplicity and enhanced performance for read and write operations.
No External Dependencies: As the program is written in ANSI C, Redis has no external dependencies and will function well in any POSIX environment. While Redis is not officially supported by Windows, Microsoft does provide an experimental build.
High Data Availability: Redis provides support to assure high data availability. Redis Sentinel is a high-availability, asynchronous, non-blockingand master/slave replication that is designed to address a number of performance problems with backups of different databases. However, while Redis Sentinel is currently usable, it is considered a work in progress.
Big Names Using Redis
Twitter uses a Redis cluster to store all their user’s timelines and Twitter stores the most-recent 800 incoming tweets for each user with the Redis list-data structure.
Pinterest employes a Redis cluster to store their follower graphs to demonstration how data is sharded across hundreds of instances. Pinterest began using Redis when they found that MySQL distributed memory caching system was approaching it performance limits.
Github developed Resque, an open-source library that facilitates the execution of background jobs put on a queue. Github developers built on Redis’s ability of solving many of the challenging queuing issues to take on worker-scheduling issues.
With the ability to provide improved data-structure, increased performance, high data availability with no external dependencies and the overall intuitiveness of the program, Redis can easily be seen as the multi-tool of data storage for developers. Because of it built-in predictability in database operation, Redis is superior to its competition when resolving issues encountered during the development of real-time data-storage systems. Much of Redis’ performance is tied to the fact that data can be persisted to disk and stored data is always residing in-memory. However, it is important to note that incorrect configuration can lead to possible data loss if Redis is ever improperly shutdown.