In-Depth Review: Exploring Redis Data Structures on Redis University
Learn when and how to use Redis, and practically apply its features. Also, where Class Central uses Redis.
Introduction to Redis Data Structures is an introductory data course from Redis University. This course is best suitable for developers who are new to Redis and want to learn more about its features or practically apply them in their real world applications. The course is taught by Alvin Richards and Kyle banker from Redis Labs.
At Class Central, we use Redis mainly for
- Caching – We use Redis to cache our course page details. The cache is refreshed every hour. We use the Redis TTL (Time To Live) feature to invalidate the older entries automatically. Almost 75% of traffic of Class Central course pages is being served from Redis Cache.
- Event Processing – We use Redis Streams (Publish / Subscribe) to process events asynchronously. All Course and Review related updates are being handled via Redis Streams.
The 6 week course covers Redis most used data structures, including strings, hashes, lists, sets, and sorted sets along with their real world use cases. This course requires installation of Redis for hands-on exercises as well as basic python programming knowledge. If you don’t want to install Redis on your machine, you can also sign up for Redis Cloud (Free tier), which should be sufficient to complete hands-on exercises in this course by connecting to Redis cloud via browser. You can access the weekly quizzes, the assignments and get the completion certificate without paying for the course by scoring more than 65% marks overall.
What will you learn from this course?
Redis is often used for high-throughput, low-latency applications. This course covers the time-complexity of the various Redis commands, so that you can select the appropriate data structure to solve your domain problem.
To make the material interesting and practical, the course examples model a system for hosting the Redis Games, a worldwide sporting event! You’ll use the Redis CLI to interact with the data models, and few coded solutions will be provided in python.
Week 1
Redis data structures and basic operations on
- Keys & Expiration
- Strings
- Hashes
- Lists
- Sets
- Sorted Sets
Out of these, I want to particularly highlight the Sorted Sets as this can be used in building real world use cases in a fast and scalable manner, like Gaming/Competition Leaderboards. Redis is obviously optimized for faster reads which can easily scale for millions of reads. If you are interested in this topic, please check out my article on Creating Realtime Indian Premier League Leaderboards using Redis.
Week 2
Capped collections & Set operations, include Union, Intersection, etc.
Faceted search is shown as one of the use cases for Set operations. However, I feel implementing faceted search applyingRedis can be used only for small data sized applications. It is very basic. If you want to implement advanced level faceted search capabilities, you can look out for other options, like ElasticSearch or Apache Solr, which have filtering and aggregations features.
Week 3
Transactions, Optimistic Concurrency Control, Storing Simple Objects & Complex objects using Hashes.
In the diagram above, command 3 (C3) and command 4 (C4) are both executed, but C4 fails for some reason. The outcome of this group of commands should be atomic. This is what is commonly referred to as a transaction. So when the application considers these commands as a single operation -as seen in command 3 & 4 in this example – then the transaction has to be created around them. This way, the server manages them appropriately by encapsulating those commands that are guaranteed to be atomic.
It also covers use cases, such as Implementing Transactions for Inventory Management for Redis Games Event, including:
- Inventory Validation – Validate if requested Inventory qty is available during user checkout
- Reserve Inventory – Reserve the requested quantity if inventory is available and complete the transaction.
Example: If a user requested 7 tickets for the event, Redis Transactions can be used to validate if tickets are available or not and reserve the inventory until payment is successfully completed.
Week 4
BitFields, Publish/Subscribe
Bit Fields:
Publish/Subscribe:
It also covers use cases, like Fan Out of events, using Redis publish/subscribe, where one event needs to be consumed by multiple consumers. This is best suitable for use cases like sending notifications on any particular event. Example: Sending Email/Push Notification to user on Successful Order Completion.
Week 5
Geospatial and Lua scripting
Redis has support to store Geospatial Objects and do queries, like finding the nearest venues from any location and calculating distances between them.
Week 6
Final Exam
This week is for the final exam which has questions on all the concepts covered in the previous weeks.
Each week has roughly 1-2 hours of lecture, split into 5-10 minute video segments which are followed by weekly quizzes and assignments. The programming assignments are very well done, providing great instructions, explanations, and examples. Moreover every weekly topic explains about the corresponding real world use cases which makes it exciting and easy to connect to the course content.
Introduction to Redis Data Structures is the best course to learn about Redis capabilities. At times, you may feel the course is tedious. You need to remember a decent number of redis commands while implementing the real world use cases, which few developers may find it difficult at times. Having said that, Redis documentation does the job for you as far as you remember which data structure needs to be used for the given problem.
Overall, I would like to give
RU101 – Introduction to Redis Data Structures 5 stars out of 5 : Excellent!