PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Discord

Design leader election using Redis leases

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of distributed coordination and leader election using a central in-memory datastore, focusing on lease-based leadership, failover, and correctness under partitions and clock skew.

  • medium
  • Discord
  • System Design
  • Software Engineer

Design leader election using Redis leases

Company: Discord

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

## Leader/Follower via Redis (Lease-Based Leader Election) You have **N stateless service instances** running the same job. At any time, **exactly one** instance should act as the **leader** (performing a singleton task), and the rest should be followers/standby. You are allowed to use **Redis** as a coordination dependency (single primary Redis endpoint is fine for the interview). You may use any Redis features you want (e.g., `SET NX PX`, Lua scripts, Pub/Sub). ### Requirements - **Leader election:** at most one leader at a time. - **Failover:** if the leader crashes or becomes unhealthy, a new leader should be elected within a bounded time. - **Lease/heartbeat:** leadership should be time-bounded and renewed. - **Correctness concerns:** discuss how you avoid or mitigate: - split brain - leader “sticking” after a crash - clock skew assumptions - network hiccups / GC pauses - **Operational concerns:** metrics/logging you’d add, and what happens if Redis is unavailable. ### Deliverables - A clear algorithm/protocol description. - Key Redis data model (keys, TTLs, values). - Edge cases and how the system behaves.

Quick Answer: This question evaluates a candidate's understanding of distributed coordination and leader election using a central in-memory datastore, focusing on lease-based leadership, failover, and correctness under partitions and clock skew.

Related Interview Questions

  • Design a Local Leader Election System - Discord (medium)
  • Design Video Call Analytics Tables - Discord (hard)
  • Design Slack-like chat system - Discord (easy)
  • Design a TCP Discord-like chat server - Discord (medium)
Discord logo
Discord
Oct 25, 2025, 12:00 AM
Software Engineer
Onsite
System Design
26
0

Leader/Follower via Redis (Lease-Based Leader Election)

You have N stateless service instances running the same job. At any time, exactly one instance should act as the leader (performing a singleton task), and the rest should be followers/standby.

You are allowed to use Redis as a coordination dependency (single primary Redis endpoint is fine for the interview). You may use any Redis features you want (e.g., SET NX PX, Lua scripts, Pub/Sub).

Requirements

  • Leader election: at most one leader at a time.
  • Failover: if the leader crashes or becomes unhealthy, a new leader should be elected within a bounded time.
  • Lease/heartbeat: leadership should be time-bounded and renewed.
  • Correctness concerns: discuss how you avoid or mitigate:
    • split brain
    • leader “sticking” after a crash
    • clock skew assumptions
    • network hiccups / GC pauses
  • Operational concerns: metrics/logging you’d add, and what happens if Redis is unavailable.

Deliverables

  • A clear algorithm/protocol description.
  • Key Redis data model (keys, TTLs, values).
  • Edge cases and how the system behaves.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Discord•More Software Engineer•Discord Software Engineer•Discord System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.