|Redis Adds Streams Support|
|Written by Kay Ewbank|
|Tuesday, 30 October 2018|
Redis 5 has been released with a new data structure, Streams. This is the first entirely new data structure in Redis for four years,and is a log-like data structure that allows you to store multiple fields and string values with an automatic, time-based sequence at a single key.
Redis is an open source, BSD licensed, advanced key-value store where the keys can contain strings, hashes, lists, sets and sorted sets. It’s increasing in popularity for web development as a session state store because of its simplicity and rich data structure support.
Redis streams are log-like data structures that can be used to store multiple fields and string values with an automatic, time-based sequence at a single key. A stream in Redis is conceptually like a list, where you can push and pop values. Unlike lists, in Redis streams, you can look up elements by ID.Redis streams are implemented with Rax, a radix-tree library that has also been released independently. It's a memory-efficient implementation optimized for fast lookups and range queries.
The advantages of using Streams in Redis include a set of blocking operations that consumers can use to wait for new data to be added to a stream by producers, and a new technique called consumer groups. These are similar to Kafka consumer groups, and mean that a group of clients can cooperate to each consume a different portion of the same stream of messages.
The next main improvement to the new version is when working with sorted sets. There are now commands that let you remove the highest or lowest scoring members of a sorted set. There are also blocking variants of these commands that wait for the maximum or minimum values to arrive, so not only can you now remove the highest or lowest values, but also you can wait for those members to arrive.
Redis modules have been improved with new API features. The modules API collection now includes features for timers and clusters. The Clusters support can be used to implement a clustered message bus, so a node can send a message to a particular node, or to all nodes. The Timers support means a module can now create high precision timers, where it can configure a duration in milliseconds and a callback.
Elsewhere, active memory defragmentation has been improved. Memory defragging while Redis is online was introduced in the previous version, meaning that Redis scans the keyspace and, for each pointer, asks the allocator if moving it to a new address would help to reduce the fragmentation. This release ships with an improved version that is faster, smarter, and has lower latency.
There's also a better and faster algorithm for HyperLogLogs, and inline help for redis-cli.
One final feature is the addition of a new command called LOLWUT that reproduces computer artistGeorg Nees' Schotter artwork. The idea is that this can be used to prove Redis is running correctly on systems you're not familiar with, and to also commemorate the 50-year anniversary of Schotter.
or email your comment to: firstname.lastname@example.org