Redis – 100+ Lab Exercises (Basic, Intermediate, Advanced)
🔰 Basic Level (30+ Exercises)
Goal: Understand Redis fundamentals, installation, and core data structures.
Getting Started with Redis
Install Redis on Linux/Windows/macOS.
Start and stop Redis server and client.
Understand Redis data types: Strings, Lists, Sets, Hashes, Sorted Sets.
Perform basic CRUD operations on each data type.
Explore simple commands:
SET,GET,DEL,EXISTS.Use Redis CLI to interact with the server.
Understand key expiration and TTL commands (
EXPIRE,TTL).Use
INCR,DECR, and other atomic counters.Basic data structure operations: push/pop in lists, add/remove in sets.
Practice Exercises
Store and retrieve user session data using Strings.
Implement a simple leaderboard with Sorted Sets.
Use Lists to create a task queue.
Cache frequent API responses with expiration.
Create a user profile using Hashes and update fields.
🚀 Intermediate Level (40+ Exercises)
Goal: Enhance Redis usage with transactions, pub/sub, and performance tuning.
Transactions and Lua Scripting
Understand Redis transactions (
MULTI,EXEC,DISCARD).Explore optimistic locking with
WATCH.Write simple Lua scripts for atomic operations.
Use pipelines to batch commands and improve performance.
Pub/Sub Messaging
Implement Pub/Sub pattern for messaging between apps.
Subscribe and publish messages on channels.
Use Redis Streams for message queues and event sourcing.
Performance and Persistence
Configure Redis persistence modes: RDB and AOF.
Understand eviction policies and memory management.
Monitor Redis performance with
INFOcommand and logs.Use Redis Sentinel for high availability basics.
Practice Exercises
Implement a stock price update system using Pub/Sub.
Create an atomic counter with Lua script for concurrency safety.
Build a chat application using Redis Streams.
Simulate cache eviction policies under memory constraints.
Configure and test Redis persistence with RDB and AOF.
🧠 Advanced Level (40+ Exercises)
Goal: Master Redis clustering, advanced data structures, and real-world production scenarios.
Redis Clustering and High Availability
Set up Redis Cluster for sharding data.
Manage cluster nodes and slot rebalancing.
Implement Redis Sentinel for failover and monitoring.
Understand client-side sharding and proxy solutions.
Advanced Data Structures & Modules
Use HyperLogLog for approximate counting.
Implement Bitmaps and Geospatial indexes.
Work with Redis modules like RedisJSON, RediSearch, RedisGraph.
Optimize complex queries with Redis modules.
Security & Scaling
Configure Redis authentication and access control lists (ACLs).
Secure Redis communications with TLS.
Perform backups and disaster recovery planning.
Scale Redis for high throughput with sharding and pipelining.
Practice Exercises
Deploy a Redis Cluster and test distributed key management.
Build a real-time analytics dashboard using HyperLogLog and Bitmaps.
Implement geospatial queries for location-based services.
Secure a Redis instance with ACLs and TLS.
Integrate RedisJSON for storing and querying JSON documents.
Capstone Projects
Design and deploy a Redis-backed caching layer for a web app.
Build a real-time chat system using Redis Pub/Sub and Streams.
Create a scalable leaderboard using Sorted Sets and Redis Cluster.
Implement a session store with failover using Redis Sentinel.
Develop a geo-location tracking app with Redis Geospatial features.
✅ Tools & Platforms
Redis CLI and GUI clients (RedisInsight, Medis)
Dockerized Redis for rapid environment setup
Redis modules: RedisJSON, RediSearch, RedisGraph
Monitoring tools: Redis Monitor, Prometheus exporters
