Eviction
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 8 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How often does Redis’s sampled LRU pick a bad victim?

      How fast does Redis’s LFU counter climb?

        How much more can a better policy serve from the same memory?

          Build-up · 5 steps

          Follow keys through S3-FIFO

          Three plain FIFO queues that beat LRU on most traces. New keys must prove themselves before they get real space.

          Step 1 of 5

          New keys enter S

          S3-FIFO splits the cache into a small queue S, with 10% of the space, and a main queue M with the other 90%. Every new key starts in S.

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “Your Redis cache holds a sale catalogue whose hot products stay popular for days. Which maxmemory-policy do you set?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “You’re adding an in-process cache to a Java service whose keys mix steady favourites with sudden bursts. Which policy?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “Redis runs volatile-lru, but the app writes every key without a TTL. The cache fills up. What happens next?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “A blog post says S3-FIFO beats LRU by 18%. Should you switch your production cache’s policy?”

            Your move. Pick an approach: