See what's new

Testlify
Interview questions
Last updated on: 25 November 202619 min read

30 Redis interview questions with answers for 2027

Thirty Redis interview questions for backend and DevOps roles, each with a model answer, what to listen for and a simple scoring rubric.

30 Redis interview questions with answers for 2027

Redis interview questions check whether a candidate can run Redis, an in-memory data store, safely in production: picking the right data type, setting expiry and eviction, choosing persistence, and scaling without losing data or blocking the server. The 30 questions below go from basic to system design, and each one comes with a model answer and what a strong answer sounds like.

Summarise this post with:ChatGPTGeminiClaudeGrokPerplexity

TL;DR

  • Good Redis interview questions test six things: data types, expiry and eviction, persistence, concurrency, scaling and production operations.
  • Ask juniors about data types, TTL and caching. Ask seniors about Cluster, locks, hot keys, latency and security.
  • Persistence is the clearest dividing line: strong candidates explain RDB, AOF and the one-second loss window of the default AOF setting.
  • Score every answer on a 1 to 4 scale and listen for trade-offs, not command names.
  • Run a short Redis skills test before the interview, so live time goes to design questions that a test cannot cover.
  • Redis 7.4 changed its license and Redis 8 added AGPLv3. Senior candidates should know why some teams now run Valkey.
Build your dream team — Book a product demo

What do Redis interview questions test?

Redis interview questions test whether a candidate can use Redis as a fast, in-memory layer without breaking the system around it. The questions cover six skill areas: data types, expiry and eviction, persistence, concurrency, scaling, and day-to-day operations such as monitoring and security.

Redis shows up in most backend stacks, which is why it appears in so many interviews. The Stack Overflow Developer Survey 2025 found that 28% of all respondents and 30.7% of professional developers use Redis, behind only PostgreSQL and MySQL among the big databases in that list.

Six skill areas that Redis interview questions test, from data types to production operations

Skill area

What it covers

Level

Questions below

Data types

Strings, hashes, lists, sets, sorted sets, streams

All levels

1 to 6

Expiry and eviction

TTL, maxmemory, eviction policies

Junior and up

7 to 10, 14

Persistence

RDB, AOF, durability trade-offs

Mid and up

11 to 13

Concurrency

Single thread, transactions, Lua, pipelining

Mid and up

15 to 17

Scaling

Replication, Sentinel, Cluster

Senior

19 to 22

Operations

Memory, latency, security, monitoring

Senior

23 to 26

What basic Redis interview questions should you ask?

Basic Redis interview questions check that a candidate knows what Redis is, which data type fits which job, and how keys expire. Use them for junior developers and as a warm-up for everyone else. A strong candidate answers each in under a minute and gives a real use case, not a definition read from memory.

1. What is Redis and when would you use it?

Redis is an open-source, in-memory key-value data store used as a cache, a database, a message broker and a queue. Because data lives in RAM, reads and writes usually take well under a millisecond.

Listen for: Concrete uses such as caching database results, session storage, rate limiting and leaderboards, plus one case where Redis is the wrong choice.

2. How is Redis different from a relational database like MySQL?

Redis keeps data in memory and looks it up by key, while MySQL stores rows on disk and answers SQL queries with joins and indexes. Redis is faster for simple lookups but has no joins, no schema and weaker durability by default.

Listen for: The candidate treats Redis as a partner to the main database, not a replacement for it.

3. Which data types does Redis support?

Redis supports strings, hashes, lists, sets, sorted sets, streams, bitmaps, HyperLogLog and geospatial indexes. Redis 8 also brought JSON, time series and probabilistic types into Redis Open Source.

Listen for: A use case for each core type, for example a hash for a user profile and a sorted set for a ranking.

4. When would you use a hash instead of a string?

A hash stores several fields under one key, such as user:42 with name, email and plan. Use it when you read or update single fields, because HSET and HGET avoid rewriting a whole serialized JSON string.

Listen for: Awareness that small hashes are stored compactly, which saves memory at scale.

5. What is a sorted set and where is it useful?

A sorted set holds unique members, each with a numeric score, kept in score order. It suits leaderboards, priority queues and time-ordered feeds, with commands like ZADD, ZINCRBY and ZREVRANGE.

Listen for: Lookups and inserts run in logarithmic time, so rankings stay fast even with millions of members.

6. What is the difference between a list and a set?

A list keeps items in insertion order and allows duplicates, which fits queues and recent-activity feeds. A set stores unique, unordered members and supports fast membership checks, unions and intersections, which fits tags or unique visitors.

Listen for: The candidate picks the type from the access pattern, not from habit.

7. How does key expiry work in Redis?

Key expiry lets you set a time to live with EXPIRE or SET key value EX 60. TTL returns the seconds left, -1 for a key with no expiry and -2 for a missing key. Redis deletes expired keys when they are accessed and through a background job that samples keys with a TTL.

Listen for: Knowing that expired keys are not all removed at the exact second they expire.

8. What happens when Redis runs out of memory?

Redis checks memory against the maxmemory limit. With the default noeviction policy, write commands that add data return an error while reads keep working. With another policy, Redis evicts keys to make room.

Listen for: The candidate sets maxmemory on purpose and never leaves a cache to fill the server's RAM.

9. Which eviction policies does Redis offer?

Redis offers noeviction, LRU, LFU, LRM (least recently modified), random and shortest-TTL policies, each in an allkeys or volatile (keys with a TTL only) version. The Redis eviction docs suggest allkeys-lru as a sensible default for caches.

Listen for: volatile policies act like noeviction when no keys have a TTL, a common production surprise.

10. Why should you avoid the KEYS command in production?

KEYS scans the whole keyspace in one go and blocks every other client until it finishes, which can freeze a busy server. SCAN walks the keyspace in small batches with a cursor, so other commands keep running.

Listen for: The same thinking applied to other slow commands, such as FLUSHALL without ASYNC or very large SMEMBERS calls.

What intermediate Redis interview questions should you ask?

Intermediate Redis interview questions cover persistence, caching patterns, transactions and messaging. They separate developers who have used Redis as a simple caching layer from those who have run it under real load. Ask them to mid-level backend developers and anyone who will own a Redis instance.

11. How does Redis persist data to disk?

Redis has four options: RDB snapshots at set intervals, an append-only file (AOF) that logs every write, both together, or no persistence at all. RDB gives compact backups and fast restarts. AOF loses less data after a crash.

Listen for: Matching the option to the data: no persistence for a pure cache, RDB plus AOF for data you cannot rebuild.

12. How much data can you lose with AOF?

With the default appendfsync everysec setting, Redis can lose up to one second of writes after a crash. appendfsync always is safer but much slower, and appendfsync no leaves flushing to the operating system. The Redis persistence docs recommend combining AOF with RDB snapshots for PostgreSQL-like safety.

Listen for: Precise numbers, not "AOF never loses data".

13. Why can RDB snapshots cause latency spikes?

RDB snapshots call fork() to create a child process that writes the file. On a large dataset, the fork itself can pause the server for milliseconds or even a second, and copy-on-write can sharply raise memory use while the child runs.

Listen for: Leaving spare RAM for persistence and watching fork time in INFO.

14. What is cache-aside and what is its main risk?

Cache-aside means the application reads Redis first and, on a miss, loads the value from the database and writes it to Redis with a TTL. The main risk is stale data when the database changes but the cached copy does not.

Listen for: Invalidation on write, sensible TTLs, and when write-through or write-behind would fit better.

15. How do Redis transactions work?

Redis transactions group commands between MULTI and EXEC, and Redis runs them in order with no other client's commands in between. There is no rollback: if one command fails at runtime, the rest still run. WATCH adds optimistic locking by aborting EXEC if a watched key changed.

Listen for: The no-rollback point. Candidates who expect SQL-style transactions will write buggy code.

16. What is pipelining and how is it different from a transaction?

Pipelining sends many commands in one network round trip and reads all the replies at the end, which cuts latency. It is not atomic: other clients can run commands between yours. A transaction is atomic but still needs its own round trips unless it is pipelined too.

Listen for: Using pipelining for bulk writes and imports, and knowing it is about network cost.

17. When would you use a Lua script?

A Lua script runs several commands as one atomic step on the server, for example "read a counter, check a limit, then increment". Use it when logic depends on values read inside the same operation. Keep scripts short, because a slow script blocks every other client.

Listen for: Mentioning Redis Functions (Redis 7 and later) as the managed way to store server-side scripts.

18. What is the difference between Pub/Sub and Streams?

Pub/Sub pushes messages to whoever is subscribed right now and keeps nothing, so offline subscribers miss messages. Streams store messages in an append-only log, support consumer groups with XREADGROUP and XACK, and let consumers replay or claim unprocessed messages.

Listen for: Picking Streams for job queues and events that must not be lost, and Pub/Sub for live notifications.

19. How does replication work in Redis?

A replica connects to a primary, receives a full copy of the data, then streams every new write. Replication is asynchronous by default, so a replica can lag and the last writes can be lost if the primary fails before they arrive.

Listen for: Using replicas to scale reads and for failover, and the WAIT command when a write must reach replicas first.

20. What does Redis Sentinel do?

Redis Sentinel monitors a primary and its replicas, promotes a replica if the primary fails, and tells clients the new primary's address. Run at least three Sentinels so they can agree on a failure without a single point of failure.

Listen for: Sentinel handles high availability, not sharding. That job belongs to Redis Cluster.

What advanced Redis interview questions should you ask experienced engineers?

Advanced Redis interview questions test whether a senior engineer can scale Redis, keep it correct under concurrency and fix it at 2 a.m. Use them for senior backend, platform and site reliability roles. A strong answer names trade-offs, failure modes and the metric the candidate would check first.

21. How does Redis Cluster shard data?

Redis Cluster splits the keyspace into 16,384 hash slots and spreads them across primaries, each with its own replicas. A key's slot comes from a hash of its name, and clients that hit the wrong node get a MOVED reply pointing to the right one.

Listen for: Hash tags such as {user:42}:cart that force related keys into one slot, because multi-key commands only work within a slot.

22. How would you choose between Sentinel and Cluster?

Sentinel fits when the dataset fits on one server and you mainly need automatic failover. Cluster fits when data or write load outgrows one server, at the cost of limits on multi-key operations and more complex clients.

Listen for: A decision based on data size and write throughput, not on what sounds more advanced.

23. How do you build a distributed lock with Redis?

A basic lock uses SET lock:order:42 <random-token> NX PX 30000, which only succeeds if the key does not exist and expires after 30 seconds. To release it, a Lua script deletes the key only if it still holds your token, so you never delete someone else's lock.

Listen for: Limits of the approach: clock drift, long GC pauses, debates about Redlock, and fencing tokens when correctness really matters.

24. What are hot keys and big keys, and how do you fix them?

A hot key gets far more traffic than others and overloads one node. A big key, such as a hash with millions of fields, makes commands and deletes slow. Fixes include splitting keys, local in-process caching, read replicas and UNLINK for non-blocking deletes.

Listen for: Finding them first with redis-cli --bigkeys, --hotkeys (needs an LFU policy) and MEMORY USAGE.

25. A Redis instance shows sudden latency spikes. How do you diagnose it?

Start with SLOWLOG GET and LATENCY DOCTOR, then check INFO for fork time, memory, evictions and connected clients. Common causes are slow commands on big keys, KEYS calls, RDB or AOF rewrites, swapping and network saturation.

Listen for: A calm, ordered process, and checking whether the host is swapping before blaming Redis.

26. How do you secure a production Redis instance?

Never expose Redis to the internet. Bind it to private interfaces, keep protected mode on, use ACL users with the fewest commands they need, turn on TLS between services and rename or disable risky commands such as FLUSHALL and CONFIG.

Listen for: ACLs (Redis 6 and later) instead of one shared password for every service.

What Redis system design questions work best?

Redis system design questions ask candidates to build a small feature end to end, which shows how they reason, not just what they remember. Give one of these in a 20 to 30 minute design round for mid-level and senior roles, and ask follow-ups about failure and scale.

27. How would you build a rate limiter with Redis?

A fixed-window limiter uses INCR on a key like rate:user42:202611231405 and sets a 60-second expiry on first use. A sliding window uses a sorted set of request timestamps, removes old entries with ZREMRANGEBYSCORE, then counts the rest. A Lua script keeps each check atomic.

Listen for: Burst problems at window edges and what happens if Redis is down: fail open or fail closed.

28. How would you design a real-time leaderboard?

A leaderboard fits a sorted set: ZINCRBY updates a player's score, ZREVRANGE ... WITHSCORES returns the top 10, and ZREVRANK gives one player's position. For very large games, the candidate might shard by region or keep a separate top-N set.

Listen for: Ties, time-based boards (daily, weekly) and keys that expire when a season ends.

29. How would you store user sessions in Redis?

A session store keeps each session in a hash keyed by a random session ID, with a TTL that is refreshed on activity. Use replicas or Cluster for availability, and decide whether losing sessions on a crash is acceptable before you choose persistence settings.

Listen for: Security details: random IDs, no sensitive data in plain text, and logout that deletes the key.

30. How do you stop a cache stampede?

A cache stampede happens when a popular key expires and thousands of requests hit the database at once. Fixes include a short lock so only one request rebuilds the value, refreshing the key before it expires, and adding random jitter to TTLs so keys do not expire together.

Listen for: Related problems such as cache penetration (requests for keys that never exist), solved by caching empty results or a Bloom filter.

Which Redis questions fit which role?

Redis questions should match the job: backend developers need data types and caching patterns, while DevOps and SRE candidates need persistence, failover and monitoring. Pick 8 to 12 questions per interview from the rows below instead of asking all 30. Demand for these roles is steady: according to the US Bureau of Labor Statistics, jobs for software developers, QA analysts and testers are projected to grow 10% from 2025 to 2035, with about 106,100 openings a year.

Role

Focus

Suggested questions

Junior backend developer

Data types, expiry, basic caching

1 to 10, 14

Mid-level backend developer

Persistence, transactions, Streams, patterns

3 to 5, 9 to 18, 27 or 28

Senior backend or platform engineer

Cluster, locks, hot keys, design

12 to 15, 17, 21 to 25, 30

DevOps or site reliability engineer

Persistence, failover, security, latency

8 to 13, 19 to 22, 25, 26

Data or streaming engineer

Streams, memory, throughput

3, 16, 18, 19, 24, 27

For broader role coverage, pair this list with backend developer interview questions or NoSQL developer interview questions.

How do you score answers to Redis interview questions?

Answers to Redis interview questions are easiest to compare on a simple 1 to 4 scale agreed before the first interview. A 1 means wrong or missing, a 2 means a textbook definition, a 3 means a correct answer with a real use case, and a 4 adds trade-offs, limits and how the candidate would check it in production.

Redis interview scoring rubric on a 1 to 4 scale, from wrong answer to production-ready trade-offs

Score

What the answer sounds like

Example for "How much data can AOF lose?"

1

Wrong or no answer

"Redis does not save data to disk."

2

Definition only

"AOF logs every write."

3

Correct with context

"With everysec you can lose about a second of writes."

4

Trade-offs and checks

Adds the cost of always, pairing with RDB and checking INFO persistence.

Watch for these red flags in any answer:

  • Redis as the only copy of critical data: with no persistence plan or backup, one restart can wipe it.
  • SQL-style transaction thinking: expecting rollback from MULTI and EXEC.
  • Command lists with no reasons: naming SET, GET and HSET but never saying why one fits.
  • No memory limit: running a cache without maxmemory or an eviction policy.
  • Blocking commands in production: using KEYS or deleting huge keys with DEL.
Pro tip: Have two interviewers score each answer separately, then compare. Gaps of two points or more usually mean the question or the rubric needs a clearer model answer. A structured interview keeps these comparisons fair across candidates.

What has changed in Redis that strong candidates should know?

Redis changed its licensing twice and added new data types between 2024 and 2026, and senior candidates should be able to explain why that matters to an employer. A candidate who knows the current state of Redis has usually worked with it recently, not just read about it years ago.

  • Licensing: Redis 7.2 and earlier used the BSD license. Redis 7.4 moved to a dual RSALv2 or SSPLv1 license in March 2024, and Redis 8 added AGPLv3 as a third option, according to the Redis license page.
  • Valkey: After the 2024 change, the Linux Foundation backed Valkey, an open-source fork of Redis 7.2, and several cloud providers now offer it. Strong candidates know the two are close for everyday use and can name where they differ for their stack.
  • Redis 8 data types: JSON, time series and probabilistic types such as Bloom filters moved into Redis Open Source, so features that once needed separate modules now ship by default.
  • New eviction controls: Recent releases added LRM eviction policies (Redis 8.6) and the BLESS commands that protect chosen keys from eviction (Redis 8.12).
Key takeaway: Ask one "what changed recently?" question to every senior candidate. It is a fast check for hands-on, current Redis experience that a memorized answer list cannot fake.

How can you test Redis skills before the interview?

Redis skills are easiest to test before the interview with a short, timed assessment, so live interview time goes to design and trade-off questions. A skills test checks commands, data types and persistence for every applicant in the same way, and only candidates who pass reach a hiring manager.

Redis hiring flow: skills test, structured question round, system design round, scored debrief
  1. Screen with a Redis test: Send the Testlify Redis test to every applicant and shortlist on the score, not the resume.
  2. Add a coding task: Pair it with one of Testlify's coding tests to see how the candidate writes code that talks to a cache.
  3. Run a structured round: Ask 8 to 12 questions from this list, matched to the role, and score each on the 1 to 4 scale.
  4. Finish with design: Give one system design question from the list above and score the trade-offs.

Testlify's library holds 3,500+ tests, including Redis, NoSQL and backend developer tests, and every assessment runs with 20+ proctoring checks such as tab tracking and AI assistance detection. See anti-cheating and proctoring for how results stay trustworthy in remote hiring, and how to hire a backend developer for the full hiring process.

Ready to screen Redis skills faster?

Send the Redis test to your next batch of backend or DevOps applicants and spend live interviews only on the strongest. Browse the Testlify test library or start a 7-day free trial, no credit card required.

Frequently asked questions

Yashika Khandelwal
Yashika Khandelwal

Content Writer

Yashika Khandelwal is a Content Writer with 3+ years of experience creating research-backed content on hiring, talent assessment, and HR technology. She is a registered Organizational Psychologist and subject matter expert who combines behavioral science with practical recruitment insights to produce accurate, evidence-based content.

LinkedIn

Get started.

Hire on proof, not resumes.

Run your first skills-based assessment free — no credit card required.

We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.