Skip to main content
InterviewHubPRO
Section Overview
Q37

Question 37 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

74%
Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

Redis Data Structures: Use Cases for ZSET, HyperLogLog, and Bitmaps.

senior LevelredisAdvanced Internals

In Simple Words:

  • Sorted Set (ZSET): Stores unique members with an associated floating-point score (backed by a SkipList and Hash). Ideal for real-time leaderboards (ZADD, ZRANK, ZREVRANGE) and rate limiters.
  • HyperLogLog (PFADD, PFCOUNT): Probabilistic data structure that estimates unique items (cardinality) with a standard error of $0.81%$, using a fixed maximum of only 12 KB of RAM to count billions of unique visitors!
  • Bitmaps (SETBIT, BITCOUNT): Manipulates individual bits within strings. Ideal for daily user login tracking (1 bit per user; tracking 100M active users takes only 12 MB RAM!).