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.
What happens when Redis runs out of memory?
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.
maxmemory plus noeviction — what does the app see?
Writes error, reads may work. Catch OOM, do not retry-storm. Alert. Raise memory, evict, or stop writers. Self-inflicted outage if ignored.
OS OOM killer versus Redis maxmemory?
Killer is worse — Redis dies, then a DB stampede. Always set maxmemory below the cgroup limit. I would rather evict keys.
How do you find what uses memory?
INFO memory, MEMORY USAGE, --bigkeys off-peak. I would not KEYS *. Look for huge lists, zsets, and cache keys with no TTL.
Large JSON blobs in Redis?
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