Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is Active Defragmentation in Redis?
senior LevelMost AskedredisAdvanced Internals
In Simple Words: Frequent allocations and deallocations in RAM cause memory fragmentation (high RSS memory while actual data is small):
- Traditional restart reclaims memory but incurs downtime.
- Active Defragmentation (
activedefrag yes): Runs concurrently inside the event loop, allocating new contiguous memory blocks, copying data over, and freeing fragmented pages on-the-fly without downtime.