Redis (REmote Dictionary Server)
is an in-memory database engine developed from 2009 by an Italian developer named Salvatore Sanfilippo.
The latter as well as a major contributor to Redis (Pieter Noordhuis) were recruited by VMWare in 2010 to devote themselves full-time to the development of Redis while leaving the BSD free license.
Redis is written with the ANSI C programming language.
Redis is part of the NoSQL solutions and it stands out for its speed, efficiency and lightness.
For example, in terms of speed it is very hard to beat, both in reading and in writing. It can process over 100,000 operations per second.
A vibrant, open source database
Voted the most-loved database for 5 years running, Redis is at the center of an engaged community of developers, architects, and open source contributors
Overview
Redis is a non-relational engine that operates primarily in memory. It manipulates key-value data structures. It is both a manager of these types of data and a data cache in the manner of memcached (a general purpose system for managing distributed memory caching. It is often used to increase the response speed of websites ( Facebook, Twitter, Wikipedia) created from databases It manages data and objects in RAM so as to reduce the number of times the same data stored in an external device is read.
Types Of Data
Unlike other NoSQL solutions that operate on documents (json, xml, etc.), Redis manipulates key-value pairs, values can be of five data types: strings, lists, sets, hashes and sorted sets. Below, we detail these five types of data.
Strings
A string in Redis is more than a standard string. It can also be used to store numeric values and binary values. The latter make it possible, for example, to store an image in memory. This is to avoid image format encoding and decoding. The maximum size is 512 MB. Other commands are built in specifically for modifying numeric type strings INCR, INCRBY, DECR, DECRBY.
Lists
Lists are simply lists of strings.
Sets
A set is an unordered collection of strings. Some set operators are available at the Redis server level: union, intersection and difference.
Hashes
It represents a dictionary, which makes it possible to store objects for example (in the same way as a JSON document).
Storage is optimized, so the hash takes up less memory space
Sorted sets
The sorted set behaves like a set where each element of the set is associated with a weight or a score which makes it possible to sort the set.
Streams
The Stream is a new data type introduced with Redis 5.0, which models a log data structure in a more abstract way. However the essence of a log is still intact: like a log file, often implemented as a file open in append-only mode, Redis Streams are primarily an append-only data structure. At least conceptually, because being an abstract data type represented in memory, Redis Streams implement powerful operations to overcome the limitations of a log file.
What makes Redis streams the most complex type of Redis, despite the data structure itself being quite simple, is the fact that it implements additional, non-mandatory features: a set of blocking operations allowing consumers to wait for new data added to a stream by producers, and in addition to that a concept called Consumer Groups.
Consumer groups were initially introduced by the popular messaging system Kafka (TM). Redis reimplements a similar idea in completely different terms, but the goal is the same: to allow a group of clients to cooperate in consuming a different portion of the same stream of messages.
Pub/Sub
SUBSCRIBE
, UNSUBSCRIBE
and PUBLISH
implement the Publish/Subscribe messaging paradigm where (citing Wikipedia) senders (publishers) are not programmed to send their messages to specific receivers (subscribers). Rather, published messages are characterized into channels, without knowledge of what (if any) subscribers there may be. Subscribers express interest in one or more channels, and only receive messages that are of interest, without knowledge of what (if any) publishers there are. This decoupling of publishers and subscribers can allow for greater scalability and a more dynamic network topology.
Redis key points
Performance
Redis comes with a benchmark tool called redis-benchmark. This program can be used to simulate an arbitrary number of clients connecting at the same time and performing actions on the server, measuring how long it takes for the requests to be completed. The resulting data will give you an idea of the average number of requests that your Redis server is able to handle per second.
Simplicity
Redis Enterprise maintain the simplicity and high performance of Redis, while adding many enterprise-grade capabilities, such as linear scaling to hundreds of millions of operations per second, Active-Active geo-replication with local latency, Redis on Flash to tier data across dynamic and persistent memory and solid-state disk (SSD) to reduce total cost of ownership, and five-nines (99.999%) uptime based on built-in durability and single-digit-seconds failover.
Extensibility
In tech, everyone wants to be a platform, the center of an ever-growing universe of applications. Achieving that dream, however, is a combination of dumb luck and smart strategy. In the case of Redis, its decision to make the popular database extensible through Redis Modules is an incredibly smart strategy and a “big deal,” as 451 Research analyst Donnie Berkholz said. Now, Redis just needs some dumb luck.
