Design Real-Time Weekly Leagues for Millions of Learners

Last updated: November 29, 2026

Quick Overview

Design the backend for Leagues: every learner who earns XP is placed in a roughly 30-person cohort for the week, sees a live leaderboard as XP comes in, and is promoted or demoted when the week ends. Cover placement, XP ingestion, leaderboard reads and the week-end settlement.

Duolingo
System Design
Software Engineer
Duolingo
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design the backend for Leagues: every learner who earns XP is placed in a roughly 30-person cohort for the week, sees a live leaderboard as XP comes in, and is promoted or demoted when the week ends. Cover placement, XP ingestion, leaderboard reads and the week-end settlement.

Leagues turn individual practice into weekly competition at Duolingo scale, with spiky traffic around evenings and the end of the week. The interviewer checks that the candidate sees that each leaderboard is tiny while the number of them is huge, and designs placement, durable XP accounting and an idempotent settlement job.

What the Interviewer Expects
  • Notices each leaderboard has about 30 members, so the hard problem is count and write volume, not sorting
  • Places learners lazily on their first XP of the week, matched by tier and similar activity
  • Makes XP events idempotent and durable before updating the leaderboard
  • Uses a partitioned store keyed by league id with a cache for reads
  • Designs week-end settlement as a resumable, idempotent batch
  • Handles time zones for the week boundary and late events
Key Topics to Cover
Sharding by entity
Idempotent event processing
Caching
Batch settlement
Matchmaking
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you match learners so a League is competitive and not won by one person on day one?
  • What do you show if the leaderboard cache is stale or down?
  • How do you handle XP from an offline lesson synced after the week ends?
  • How would you detect and handle XP farming bots?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: join a League on first XP of the week, see rank and nearby learners live, settle at week end with promotion, demotion and rewards. Non-functional: tens of millions of weekly participants, ...

High-Level Design

Lesson service emits an XP event with a unique event id to a log such as Kafka. A League service consumes it: if the learner has no League this week, the placement service assigns one (tier from last ...


Submit Your Answer
Markdown supported

Related Questions