# The professional graph - degrees, and why it is not a join

> Why a degree badge on every name is a graph held in memory and searched from both ends, not a join. The entire architecture rests on the whole edge set living…

Source: https://tierslate.com/templates/linkedin-connections

Social & feeds · System design · deep · 8 step walkthrough · 5 tables

Why a degree badge on every name is a graph held in memory and searched from both ends, not a join.

**Own this board: 800 credits.** The first act plays on the page. Owned once with credits, never a subscription.

## What this board gets wrong on purpose

The tension: The entire architecture rests on the whole edge set living in RAM, and there is no partial-start path on this board: a graph node that restarts loads 1.2 TB from the durable store before it can answer anything, which is tens of minutes per replica, so the real recovery time of the system is a rolling restart measured in hours and nobody has ever timed it under load. The second hole is staleness on both sides of the same fact: the distance cache is expired by TTL rather than invalidated by the edge write, so a connection you just accepted still reads as 2nd degree for up to a minute, while PYMK is recomputed nightly, so accepting five connections today changes none of your suggestions until tomorrow - and the two disagree with each other in the meantime, on the same screen.

## Practise this as an interview

Take The professional graph - degrees, and why it is not a join as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

## Start here

### Why this design

"Show the 1st, 2nd or 3rd degree badge next to every person on the page" sounds like a join and is the question that teaches you when a relational engine is the wrong tool. Interviewers use it to probe whether you notice the read rate is set by list rendering rather than profile views, whether you can size a graph and see that it fits in RAM, and whether you know which questions must be answered offline. Every professional or social network that shows mutual connections and suggestions makes exactly this split between an online traversal and a nightly batch.

### What you will learn

- Why the read rate is**58,000 degree queries/s (200,000 at peak)**against**42 edge writes/s**- roughly**2,000 : 1**- and why that justifies everything else.
- Why the self-join loses: one 2nd-degree check for a 5,000-connection member materialises**1.5M intermediate rows**.
- Why**300 billion directed edges at 4 bytes is ~1.2 TB**- two dozen machines - and how sorted int32 arrays turn degree into a**set intersection**and a**bidirectional BFS that meets in the middle**.
- Why**people you may know**is a nightly triangle count producing**500 candidates per active member**(~3.6 TB), never a request-time query.
- The honest costs: a replica**cold-starts by loading 1.2 TB**, so rolling restarts take hours, and the distance cache and PYMK are stale on different clocks.

### How to read this board

1. Press play once: the walkthrough goes from the rendered list that asks the question to the two staleness windows on one screen.
2. **ONLINE · MICROSECONDS, 58,000/sec**(top): ask, traverse, answer - the graph service and its distance cache.
3. **DURABLE · OFF THE READ PATH**(below left): the edge store and the 42-a-second stream of edge events; no read touches them in steady state.
4. **OFFLINE · PEOPLE YOU MAY KNOW, NIGHTLY**(tall, right): snapshot, candidate generation, the candidate store and the ranker.
5. **THE DATA MODEL · GENERATE SQL READS THESE**: members, connections stored in both directions, invitations and candidates.
6. Then pages 1 to 6 in order: requirements, capacity, storage, availability, how it works, deployment.

## 1 · Requirements

### Clarifying questions to ask first

- How many**degrees**do we need? Stopping at 3 makes the problem bounded. Unbounded shortest path over a billion nodes is a different, much worse system.
- Are connections**symmetric**? On this product yes - a connection is mutual and requires acceptance - which halves the storage and makes the traversal undirected. Follows, if we also have them, are a separate directed edge and should not be mixed into the same adjacency.
- Is the**degree badge**required on every row of every list? If yes, the query rate is set by list rendering, not by profile views, and it is two orders of magnitude higher.
- May**PYMK be a day stale**? If yes it can be offline, and the entire online system gets simpler.
- What is the**maximum connection count**? A hard cap (30,000) turns "unbounded fan-out" into "a large but bounded array" and is the single most useful constraint in the design.
- Do we owe**privacy controls**on who can see connections? A filter on a traversal result is cheap; a filter*inside*a traversal is not.

### Functional

- Send, accept, ignore and withdraw a connection invitation.
- Show the**degree**(1st, 2nd, 3rd, out of network) between the viewer and any member, everywhere a member is displayed.
- List a member's connections, paginated.
- Show**mutual connections**with another member.
- Suggest**people you may know**, ranked.

### Non-functional

- **Degree lookup p99 under 10 ms**, because it happens 10-50 times per rendered page and sits inside somebody else's latency budget.
- **Mutual-connection count p99 under 50 ms.**
- **99.95% availability**on degree lookups. A missing badge degrades to "out of network", it does not fail the page.
- Connection writes may be**eventually consistent**for other viewers, but the two people involved must see the new connection immediately.
- PYMK may be**up to 24 hours stale**.

### Explicitly out of scope

Messaging, the feed, job matching, search relevance, and the PYMK ranking model itself. The ranker is one box.

## The rest of this board

This page publishes the question. The answer - 5 more written pages, an 8-step narrated walkthrough and a 5-table schema - is the board itself, and it opens in Tierslate.

- 5 written pages
- 8 walkthrough steps
- 5 tables (27 columns)

5 pages behind this one:

- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan

## Related system design templates

- [Social news feed system design](https://tierslate.com/templates/news-feed) - Fan-out on write against fan-out on read, and when each loses.
- [Media feed system design](https://tierslate.com/templates/instagram-feed) - Why the feed serves URLs and the edge serves bytes, and who actually pays for the pixels.
- [Comment trees system design](https://tierslate.com/templates/reddit-comments) - How a whole comment tree comes back in one range scan, and why every vote rewrites what it cached.
- [The social graph system design](https://tierslate.com/templates/social-graph) - Why every follow is written twice on two shards with no transaction between, and what that drift costs.
- [Home timeline system design](https://tierslate.com/templates/twitter-timeline) - Why one post is fanned out into hundreds of precomputed timelines, and why the celebrity cannot be.
- [Blog platform system design](https://tierslate.com/templates/blog-platform) - Why a blog is a read-heavy system where the cache is the product, and what publishing has to invalidate.
- [Link previews system design](https://tierslate.com/templates/link-preview) - Why unfurling a pasted URL is a server-side request forgery problem first and a caching problem second.
- [Reviews and ratings system design](https://tierslate.com/templates/reviews-ratings) - Why a star rating is an aggregate maintained on write, and how fake reviews are held back before they count.
- [Content moderation system design](https://tierslate.com/templates/content-moderation) - Why moderation is a fast automatic gate plus a slow human queue, and what is shown while it decides.
- [Stories system design](https://tierslate.com/templates/ephemeral-stories) - Why expiry is a read-time filter plus a background sweep, and why the viewer list is the expensive part.

All 100 system design templates: https://tierslate.com/templates (Markdown: https://tierslate.com/templates.md)
