System Design Arena
System Design: LinkedIn
Connect hundreds of millions of professionals with feeds, jobs, messaging, and analytics.
Case Study
Professional Network
Same conversation, diagrams, and wrap-up you expectβnow framed with clearer scaffolding and iconography.
Prompt
Design LinkedIn for one billion professionals. Support profile graph, feed ranking, recruiter workflows, and enterprise-grade privacy.
Interview snapshot
- β’ Topic: Professional Network
- β’ Expected depth: 45 - 60 minutes
- β’ Focus areas: APIs, scale estimation, resilient architecture
- β’ Wrap-up: risk, monitoring, disaster recovery
Key takeaways
- β’ Profiles, connections, endorsements, skills, company pages.
- β’ Feed load < 300 ms, messaging < 200 ms.
- β’ GET /api/feed - personalized feed.
ποΈ Interview mode
Practice this like a real interview
Don't read the answer first. Work the framework against the bare prompt, then compare against what the interviewer expected at each step.
Scorecard
What the interviewer is evaluating
Staff-level signal
Does the candidate model the social graph as its own service with its own store, and reason about second-degree queries (the β500+ connectionsβ problem) explicitly?
π§ Staff engineer judgment
Do not run graph traversals at request time. Anything second-degree is a precomputation problem pretending to be a query.
Calibration
The common (bad) answer
User β API β Profile Service β SQL (users, connections tables)
β Why this scores poorly: A connections join-table works until someone asks for 2nd-degree connections or "people you may know" β a graph traversal that brings a relational store to its knees.
β What a strong answer adds
- Separate the graph (adjacency, traversals) from profiles (documents) β different stores.
- Precompute second-degree counts and PYMK offline; serve them, never compute on request.
- Feed follows the Twitter hybrid fan-out lesson, ranked not chronological.
- Search over profiles is its own index (Elasticsearch-style) fed by change streams.
- Privacy rules (who can see what) evaluated at the edge of every read path.
Build it up
Step-by-Step Walkthrough
LinkedIn looks like Twitter with suits on, but the graph is the product: ~1B members and hundreds of billions of connection edges that feed ranking, jobs, and recruiting. Build the graph first, then hang the surfaces off it.
Profiles and connections in one database
Start with a profiles table and a connections table in Postgres. Viewing a profile is a row read; connecting is an edge insert; the feed is a query over your connections' recent posts. Profile metadata is genuinely small β ~2 KB each is only a couple of terabytes for a billion members.
The edges are what break. ~1B users with ~500 connections each is on the order of 500B edges, and the queries that matter are graph-shaped: second-degree connections, 'people you may know', shortest paths for intro requests. A relational join over 500B rows is not a query plan, it is an outage.
Split the graph out, index the people
Promote the edges into a dedicated distributed graph store partitioned by member ID, serving adjacency lists and bounded second-degree traversals from memory. Profile edits stay strongly consistent in the profile service β your own name must never be stale β while the profile service also publishes changes into a search index so member and company lookup becomes a search problem instead of a scan.
This split is the pattern for the whole design: one write path (the profile service) fanning into purpose-built read stores (graph, search). Say explicitly which store is authoritative β the profile DB β and that the graph and index are derived, rebuildable views.
The feed: an ML ranking pipeline, not a timeline
The naive feed β recent posts from connections, newest first β is where most candidates stop, and it is wrong for LinkedIn: a member who logs in weekly should see the best of the week, not the last hour. Feed actions (~5B/day, ~58K/s) flow into Kafka; a feature pipeline computes signals (relationship strength, dwell time, content type) and an ML ranking service scores candidate posts into per-user feed caches.
The fan-out lesson from consumer social still applies: push ranked candidates for typical members, pull-and-merge at read time for mega-connectors and company pages with millions of followers. The hybrid is the same shape as Twitter's β say so, then point out the difference: here a ranking model, not recency, decides ordering.
?The question that separates levels
'How do you evaluate a feed ranking change?' β online A/B tests on engagement plus offline replay against logged sessions, with guardrail metrics (complaints, unfollows) so a model that juices clicks by showing rage-bait gets caught. Feeds are ML systems; naming the eval loop is the senior signal.
Jobs, recruiters, and messaging are separate planes
The money is not the feed. The jobs service indexes postings into the same search infrastructure (filter by title, location, company) and powers a recruiter CRM whose queries β 'senior data engineers open to work in Berlin' β run against the search index and graph together. Applicant tracking is transactional and lives in its own store; a lost application is a lawsuit, not a stale cache entry.
Messaging (~200M messages/day, only ~2.3K/s) is modest in throughput but long in retention: conversations persist for years, so back it with Cassandra partitioned by conversation ID, with a push-notification bridge into APNs/FCM. Keep it a separate service β its consistency and retention needs share nothing with the feed.
The privacy engine sits in front of everything
Enterprise sales make privacy a feature, not a checkbox: per-section profile visibility, anonymous profile viewing, recruiter license boundaries, legal hold. Enforce it in a central privacy engine consulted on every read path β profile views, search results, feed items β rather than re-implementing ACL checks in each service, where one team's miss becomes a breach.
GDPR deletion is the follow-up interviewers love: a member's data lives in the profile DB, graph store, search index, feed caches, and message archives. A deletion pipeline walks every derived store from the authoritative record and proves completion into an audit log. If you designed clear derived-data lineage in step 2, this is a pipeline; if you did not, it is a manual incident.
!Do not bolt privacy on last
If ACL filtering happens after search ranking, result counts leak existence ('3 hidden results' tells a recruiter the person exists). Filter before ranking, everywhere. This exact trap also appears in RAG retrieval β interviewers reuse it.
Blueprint
Architecture Diagram
The narrated components above, laid out as an actual flow β so you can see how a request moves through the system, not just read a list of pieces.
Profile service writes
Profile service writes to graph DB
search index
Activity stream
Activity stream
Kafka
ranking service
feed caches
Job service integrates
Job service integrates with search
recruiter tooling
Messaging service backed
Messaging service backed by Cassandra
push notifications
Privacy engine enforces
Privacy engine enforces ACLs
Privacy engine enforces ACLs, GDPR deletion, audit logs
Flow Diagram
How the API maps to this flow
- 1
GET /api/feedβ personalized feed. - 2
POST /api/postsβ create post with attachments. - 3
GET /api/jobs/searchβ filter by title/location/company. - 4
POST /api/messagesβ send message. - 5
GET /api/profiles/{id}β profile view respecting privacy.
?But why does this actually hold up at scale?
Graph: 1B users * 500 connections -> 500B edges (need distributed graph store).
Video walkthrough
"Design LinkedIn" β system design mock
IGotAnOffer: Engineering Β· 52 min
A full mock with a senior engineer, covering the connection graph and feed together.
Work the prompt yourself first β guided practice grades your own answer step by step. Watching someone else design it feels like progress and teaches you far less.
Interview flow
Dialogue timeline
Interviewer
List the primary product surfaces.
Candidate
Profile graph, connections, feed, jobs/recruiter, messaging, notifications, search/learning.
Interviewer
How do you ship the feed?
Candidate
Activities flow into Kafka, we compute features, rank with ML models, cache per user. Hybrid push/pull to balance high-fanout users.
Interviewer
Privacy/compliance story?
Candidate
Access control per profile section, audit logs, GDPR deletion pipeline, encryption, enterprise admin controls.
Scoping
Requirements & trade-offs
Functional Requirements
- βProfiles, connections, endorsements, skills, company pages.
- βNews feed with articles, images, video, and share/comment flows.
- βJob postings, recruiter CRM, applicant tracking.
- βMessaging, notifications, groups/events, learning modules.
- βAnalytics dashboards for recruiters/advertisers.
Non-Functional Requirements
- βFeed load < 300 ms, messaging < 200 ms.
- βAvailability 99.95%+, strong consistency for profile edits.
- βPrivacy for enterprise tenants, legal hold, auditing.
- βScale to hundreds of millions of users and hundreds of billions of edges.
Blueprint
Architecture modules
Module 1
API Endpoints
- β’GET /api/feed - personalized feed.
- β’POST /api/posts - create post with attachments.
- β’GET /api/jobs/search - filter by title/location/company.
- β’POST /api/messages - send message.
- β’GET /api/profiles/{id} - profile view respecting privacy.
Module 2
Back-of-the-Envelope
- β’Graph: 1B users * 500 connections -> 500B edges (need distributed graph store).
- β’Feed events: 5B daily actions -> ~58K/s average, spikes 5x.
- β’Messaging: 200M messages/day -> 2.3K/s; long retention with sharding.
- β’Storage: profile metadata ~2 KB each -> 2 TB, manageable with partitioning.
Module 3
System Diagram Notes
- β’Profile service writes to graph DB + search index.
- β’Activity stream -> Kafka -> ranking service -> feed caches.
- β’Job service integrates with search + recruiter tooling.
- β’Messaging service backed by Cassandra + push notifications.
- β’Privacy engine enforces ACLs, GDPR deletion, audit logs.
Module 4
Design Playbook
- β’Clarify graph operations and feed ranking signals.
- β’Explain job search + recruiter workflows.
- β’Discuss messaging and notifications.
- β’Cover abuse prevention, fake accounts, spam.
- β’Highlight analytics/monetization and compliance obligations.