Design a Social Graph Service at Billion-User Scale

Last updated: March 3, 2025

Quick Overview

Design follower/following relationships storage, read-heavy optimization, feed generation support, and consistency guarantees for mutual follows.

ByteDance
System Design
Software Engineer
ByteDance
March 3, 2025
Software Engineer
System Design Round
System Design
Hard

5

10

4,684 solved


Design follower/following relationships storage, read-heavy optimization, feed generation support, and consistency guarantees for mutual follows.

Core to TikTok's social features. Tests graph storage at extreme scale with read-heavy access patterns.

What the Interviewer Expects
  • Design graph storage with adjacency lists in distributed DB
  • Optimize for read-heavy access patterns with caching
  • Address sharding strategy by user ID
  • Handle consistency for mutual follow operations
  • Support efficient follower count and feed generation queries
Key Topics to Cover
Graph storage
Adjacency lists
Sharding
Read optimization
Follower systems
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 do you handle users with 100M+ followers?
  • How do you detect fake follower patterns?
  • What is your caching strategy for follower counts?
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 Requirements

  1. Follower/Following Relationships: Store relationships efficiently to allow users to follow/unfollow each other.
  2. Feed Generation: Generate personalized feeds b...
Capacity Estimation

Back-of-Envelope Calculations

  • User Base: Assume 1 billion active users.
  • Average Followers per User: Estimate an average of 200 followers per user.
  • Total Follower Relationships: A...

Submit Your Answer
Markdown supported

Related Questions