BT

Redis 5.0 Released with New "Streams" Data Type

| by Alex Giamas Follow 10 Followers on Oct 26, 2018. Estimated reading time: 2 minutes |

Redis recently announced version 5 of its popular database, 15 months after the release of Redis 4. The headline feature of this version is the support for a new data type, "Streams", an append-only data structure which can be used for purposes like log processing using co-operative clients within consumer groups. The Streams implementation is based on Rax, a radix-tree library.

Streams support fast lookups and range queries which are useful building blocks for chat systems, message brokers, queueing systems and most systems that can benefit from the unified log pattern. Streams are similar in concept to Apache Kafka's message passing in their support of consumer groups, but also unique in nature. Streams also support message persistence and master/replica replication functionality. Originally planned for version 4, this data type is now available in version 5 along with extensive documentation.

Sorted set functionality has also improved in Redis 5, with the addition of new commands to pop elements from the start and end of sorted sets. ZPOPMAX / BZPOPMAX will return and remove the element with the highest score in a non-blocking and blocking fashion respectively. Similarly, ZPOPMIN / BZPOPMIN will return and remove elements with the lowest score. Using these commands a developer can simulate list functionality using sorted sets.

Redis modules have also been expanded in the newest version, with the introduction of Clusters and Timers APIs. The Timers API allows modules to create timers with precision duration down to milliseconds and a callback function. The Clusters API (not to be confused with Redis clustering of servers) provides an abstraction for implementing a clustered message bus. This allows a node to send messages to a particular node or all nodes, similar to a pub/sub system.

Several performance improvements under the hood like improved active memory defragmentation and an improved algorithm for HyperLogLog are also included in this release. Most commands now support quick command line HELP using "<command_name> HELP" on the cli, e.g. XINFO HELP for help on the new streams functionality.

The LOLWUT command was also added, which is more of an easter egg than technologically useful to Redis users, as LOLWUT will generate a random variation of computer art, Schotter by Georg Nees. LOLWUT was born out of the need to spend some technologically useless time in order to explore something of the 60s, an era in which the author believes that it was easier to "talk about technology with a hacking perspective, where there are no walls or pre-cooked ideas, and the limit is the exploration."

Finally, the newest Redis version also removed usage of the word "slave", replacing it with "replica", except for any cases that it's required for backwards compatibility.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT