Redis Interview Questions (Top 100 Questions with Answers)
Master Redis Interview Questions with production-oriented questions covering Redis Architecture, Data Structures, Caching, Persistence, Replication, Sentinel, Cluster, Pub/Sub, Streams, Performance Tuning, and real-world production troubleshooting.
Introduction
Redis (Remote Dictionary Server) is one of the fastest in-memory NoSQL databases.
It is widely used for
- Distributed Caching
- Session Storage
- Leaderboards
- Rate Limiting
- Real-time Analytics
- Message Queues
- Distributed Locks
Popular companies using Redis include
- Twitter (X)
- GitHub
- Stack Overflow
- Uber
- Airbnb
- Netflix
- IBM
This guide contains the Top 100 Redis Interview Questions frequently asked in Java, Spring Boot, Backend, DevOps, Cloud, and Database interviews.
Redis Interview Roadmap
Redis Basics
│
▼
Architecture
│
▼
Data Structures
│
▼
Caching
│
▼
Persistence
│
▼
Replication
│
▼
Sentinel
│
▼
Cluster
│
▼
Performance
Redis Fundamentals
1. What is Redis?
Redis is an open-source, in-memory key-value database that supports multiple data structures.
2. Why Redis?
- Extremely Fast
- In-Memory Storage
- Persistence Support
- High Availability
- Clustering
- Pub/Sub
- Streams
3. Redis vs Memcached?
| Redis | Memcached |
|---|---|
| Multiple Data Structures | Key-Value Only |
| Persistence | No Persistence |
| Replication | Limited |
| Clustering | Better |
| Pub/Sub | No |
4. Redis vs Database?
Redis stores data primarily in memory, making it much faster than disk-based databases.
5. Common Redis Use Cases?
- Cache
- Session Store
- Queue
- Leaderboard
- Counter
- Rate Limiter
- Distributed Lock
Architecture
6. Explain Redis Architecture.
Components
- Client
- Redis Server
- Memory
- Persistence
- Replication
- Cluster
7. Is Redis Single Threaded?
Redis uses a single-threaded event loop for command execution while newer versions use additional threads for networking and background operations.
8. Why is Redis so fast?
- Memory Storage
- Efficient Data Structures
- Event-driven Architecture
- Minimal Context Switching
9. What protocol does Redis use?
RESP (Redis Serialization Protocol).
10. Maximum Key Size?
512 MB.
Data Structures
11. Redis String?
Stores
- Text
- Numbers
- JSON
- Binary Data
12. Redis List?
Ordered collection.
13. Redis Set?
Unique unordered values.
14. Redis Sorted Set?
Unique values with scores.
15. Redis Hash?
Stores key-value pairs inside a single key.
16. Bitmap?
Efficient bit storage.
17. HyperLogLog?
Approximate unique counting.
18. Streams?
Persistent event stream.
19. Geospatial?
Stores latitude and longitude.
20. Which structure is used for Leaderboards?
Sorted Set.
Caching
21. What is Cache?
Temporary storage for frequently accessed data.
22. Cache Aside Pattern?
Application checks cache first.
23. Read Through Cache?
Cache loads missing data automatically.
24. Write Through Cache?
Database and cache updated together.
25. Write Behind Cache?
Cache updates immediately.
Database updated later.
26. Cache Eviction?
Removing old cache entries.
27. LRU?
Least Recently Used.
28. LFU?
Least Frequently Used.
29. TTL?
Time To Live.
30. Cache Stampede?
Many requests regenerate expired cache simultaneously.
Persistence
31. Does Redis support persistence?
Yes.
32. RDB?
Snapshot persistence.
33. AOF?
Append Only File.
34. RDB vs AOF?
| RDB | AOF |
|---|---|
| Faster | Safer |
| Smaller | Larger |
| Snapshot | Command Log |
35. Can both RDB and AOF be enabled?
Yes.
Replication
36. Redis Replication?
Primary
↓
Replica.
37. Replica Advantages?
- Read Scaling
- High Availability
38. Asynchronous Replication?
Default behavior.
39. Replica Promotion?
Occurs during failover.
40. Replication Backlog?
Temporary buffer for synchronization.
Sentinel
41. What is Redis Sentinel?
High Availability solution.
42. Sentinel Responsibilities?
- Monitoring
- Failover
- Configuration
- Notification
43. Automatic Failover?
Supported.
44. Quorum?
Minimum Sentinel votes required for failover.
45. Sentinel vs Cluster?
| Sentinel | Cluster |
|---|---|
| High Availability | High Availability + Sharding |
| No Sharding | Automatic Sharding |
Cluster
46. Redis Cluster?
Distributed Redis deployment.
47. Number of Hash Slots?
48. What is Hash Slot?
Partition used for key distribution.
49. Key Distribution?
CRC16 Hash
↓
Hash Slot
↓
Node
50. Cluster Benefits?
- Scalability
- High Availability
- Fault Tolerance
Pub/Sub & Streams
51. What is Pub/Sub?
Publish-Subscribe messaging.
52. Publisher?
Sends messages.
53. Subscriber?
Receives messages.
54. Are Pub/Sub messages persistent?
No.
Messages are delivered only to currently connected subscribers.
55. Redis Streams?
Persistent message streaming.
56. Consumer Groups?
Allow multiple consumers to process streams.
57. Difference between Pub/Sub and Streams?
| Pub/Sub | Streams |
|---|---|
| Temporary | Persistent |
| No Replay | Replay Supported |
| No Consumer Groups | Consumer Groups |
58. Stream ID?
Unique message identifier.
59. Pending Entries List?
Tracks unacknowledged stream messages.
60. Stream Acknowledgement?
Confirms successful processing.
Transactions
61. Does Redis support Transactions?
Yes.
62. MULTI?
Starts transaction.
63. EXEC?
Executes queued commands.
64. DISCARD?
Cancels transaction.
65. WATCH?
Optimistic locking.
Distributed Lock
66. How do you implement Distributed Lock?
SET
NX
PX
67. Redlock Algorithm?
Distributed locking across multiple Redis instances.
68. Lock Expiration?
Prevents permanent locking.
69. Why use UUID in locks?
Ensures only the lock owner can release the lock.
70. Lock Release?
Compare value
↓
Delete.
Performance
71. Memory Optimization?
Use appropriate data structures.
72. Memory Fragmentation?
Unused memory caused by allocation patterns.
73. Eviction Policies?
- noeviction
- allkeys-lru
- volatile-lru
- allkeys-lfu
- volatile-ttl
74. Pipeline?
Sends multiple commands together.
75. Lua Scripts?
Execute multiple commands atomically.
76. Slow Log?
Records slow commands.
77. INFO Command?
Displays server statistics.
78. MONITOR?
Shows real-time commands.
79. SCAN vs KEYS?
SCAN is incremental and safe for production.
KEYS can block the server on large datasets.
80. Memory Usage Command?
MEMORY USAGE.
Production Scenarios
81. Cache Misses Increased?
Check TTL.
Check eviction.
82. High Memory Usage?
Review eviction policy.
83. High CPU?
Large Lua scripts
or
expensive commands.
84. Slow Redis?
Check
- Slow Log
- Network
- Memory
85. Frequent Evictions?
Increase memory.
86. Large Keys?
Split data.
87. Replication Delay?
Check
Network
Disk
Load.
88. Cluster Node Down?
Automatic failover.
89. Cache Inconsistency?
Review cache invalidation strategy.
90. Session Loss?
Enable persistence and replication.
Senior-Level Questions
91. Redis vs Kafka?
Redis Streams are suitable for lightweight messaging, while Kafka is designed for durable, large-scale event streaming.
92. Redis vs RabbitMQ?
Redis focuses on speed.
RabbitMQ provides richer messaging features.
93. Redis vs MongoDB?
Memory
vs
Document Database.
94. Redis vs DynamoDB?
Memory
vs
Managed NoSQL.
95. Explain Redis Event Loop.
Single-threaded command processing.
Non-blocking I/O.
96. Explain Redis Persistence Internals.
RDB
Snapshots
AOF Logging.
97. Explain Redis Cluster Internals.
Hash Slots
↓
Nodes
↓
Automatic Routing.
98. Explain Sentinel Internals.
Health Checks
↓
Election
↓
Promotion.
99. Best Redis Monitoring Tools?
- Redis Insight
- Prometheus
- Grafana
- INFO
- Slow Log
100. Redis Performance Checklist?
- Proper TTL
- Pipeline
- Lua Scripts
- Cluster
- Sentinel
- Memory Optimization
- Connection Pooling
- Avoid KEYS in Production
Redis Production Workflow
Application
│
▼
Redis Client
│
▼
Redis Server
│
▼
Memory
│
▼
Persistence
│
▼
Replication
│
▼
Sentinel / Cluster
Quick Revision
| Area | Focus |
|---|---|
| Architecture | Event Loop |
| Storage | In-Memory |
| Data Structures | String, Hash, Set |
| Caching | Cache Aside |
| Persistence | RDB, AOF |
| Replication | Primary-Replica |
| Sentinel | Failover |
| Cluster | 16384 Hash Slots |
| Streams | Consumer Groups |
| Performance | Pipeline |
Interview Tips
During Redis interviews
- Explain why Redis is an in-memory database.
- Understand all Redis data structures and their use cases.
- Explain RDB vs AOF persistence clearly.
- Know Sentinel, Cluster, and replication architecture.
- Discuss Redis Streams and Pub/Sub differences.
- Explain distributed locking using
SET NX PXand Redlock. - Mention performance techniques like pipelining, Lua scripting, and proper eviction policies.
- Always relate Redis concepts to real-world use cases such as caching, session management, and rate limiting.
Summary
Redis is one of the fastest NoSQL databases and a key component in modern distributed systems. Strong Redis interview performance requires understanding architecture, data structures, caching strategies, persistence, replication, Sentinel, Cluster, Pub/Sub, Streams, distributed locking, and performance tuning.
Mastering these 100 Redis interview questions prepares you for Backend Developer, Java Developer, Spring Boot Developer, DevOps Engineer, Solution Architect, and Distributed Systems Engineer interviews.