Redis

Out of Memory Interview Questions

What happens when Redis runs out of memory? — spoken sample answer for Indian interviews.

  • 5Questions with answers
  • 3Difficulty levels

Questions (5)

Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.

Question 1
Interview Intermediate
Question

What happens when Redis runs out of memory?

Answer:

If maxmemory is set, Redis either evicts keys or returns errors on writes, depending on policy. If maxmemory is not set, Redis grows until the OS kills it. That is a real incident I have seen people hit. Clients then get timeouts or connection resets. Prevention: set maxmemory, pick a policy, cap huge values, do not store unbounded lists, and make sure replicas have enough RAM for the same dataset. I would look at used_memory and evicted_keys before I blame the app. A replica that is smaller than the primary will fail in the same way during failover.

Question 2
Interview Intermediate
Question

maxmemory plus noeviction — what does the app see?

Answer:

Writes error, reads may work. Catch OOM, do not retry-storm. Alert. Raise memory, evict, or stop writers. Self-inflicted outage if ignored.

Question 3
Interview Advanced
Question

OS OOM killer versus Redis maxmemory?

Answer:

Killer is worse — Redis dies, then a DB stampede. Always set maxmemory below the cgroup limit. I would rather evict keys.

Question 4
Interview Intermediate
Question

How do you find what uses memory?

Answer:

INFO memory, MEMORY USAGE, --bigkeys off-peak. I would not KEYS *. Look for huge lists, zsets, and cache keys with no TTL.

Question 5
Interview Beginner
Question

Large JSON blobs in Redis?

Answer:

Small yes. Multi-MB JSON times a million users is the math I do in the interview. Compress, split, or S3 plus cached URL.

Practice with AI mock interviews

Run Redis mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.

Free to start · No credit card required