Quick revision
The short answer
I would separate the online needs from the offline ones. Online paths, such as follow checks and lists, are one-hop lookups at very high rates, which a partitioned edge store serves well, while friend suggestions and most multi-hop features can be hours stale and suit offline or near-line graph jobs that write precomputed results back for fast reads. A graph database makes traversals easy to write, but at 100 billion edges spread over many machines a multi-hop query crosses many partitions, so I would require a prototype at our real scale before trusting it, compute mutual counts by intersecting sorted lists or estimating with sketches, and keep the serving API stable so the storage can change later.
What to remember
In this answer, we saw that the decision starts with classifying features by query shape, rate and freshness: online paths are one-hop lookups that a partitioned edge store serves well, while suggestions are multi-hop but can be hours stale. Graph databases make traversals easy but cross many partitions at 100 billion edges, so they need proof at real scale. The common pattern serves from the edge store, computes in offline graph jobs and writes back precomputed results. Mutual counts use sorted-list intersection or sketches, and a stable serving API keeps the choice reversible.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would separate the online needs from the offline ones. Online paths, such as follow checks and lists, are one-hop lookups at very high rates, which a partitioned edge store serves well, while friend suggestions and most multi-hop features can be hours stale and suit offline or near-line graph jobs that write precomputed results back for fast reads. A graph database makes traversals easy to write, but at 100 billion edges spread over many machines a multi-hop query crosses many partitions, so I would require a prototype at our real scale before trusting it, compute mutual counts by intersecting sorted lists or estimating with sketches, and keep the serving API stable so the storage can change later.
Why this question is asked
Proposals to adopt a graph database come up whenever a product asks graph-shaped questions, and they often come with an impressive demo on a sample dataset. The leadership skill is to look past the demo to the actual query patterns, their required freshness and rates, and the behaviour of each option at full scale. Interviewers ask this to see how a senior leader frames a technology choice with evidence rather than preference. In this answer, we will classify the features by their needs, look honestly at what graph databases do at this scale, describe the common hybrid pattern, work through mutual counts and the multi-hop query, and set out how to decide.
1Classify the Features by What They Need
The three requested features look similar but have very different needs. Mutual-follow counts appear on profiles and are read constantly, but they only need to be roughly right. Friend suggestions need two or three hops through the graph, but nobody notices if they are a few hours old. People you follow who follow a given page is a two-hop query that should be fresh and fast, but it starts from a small set: the 200 or so accounts the viewer follows.
So before choosing storage, we write down each feature's query shape, rate, latency target and acceptable staleness. That table usually ends the debate, because it shows that very few of the features need online multi-hop traversal over the whole graph.
| Feature | Query shape | Freshness | Rate |
|---|---|---|---|
| Follow check, lists | one hop, single partition | immediate | hundreds of thousands/s |
| Friends you follow who follow X | 200 point checks | seconds | high |
| Mutual-follow count | intersection or estimate | minutes | high |
| Friend suggestions | two or three hops, scoring | hours | low, precomputed |
2What a Graph Database Brings, and Where It Struggles
Graph databases such as Neo4j, or distributed ones such as JanusGraph and TigerGraph, store each node with direct references to its neighbours, so following edges is cheap and queries like two hops from me, filtered by a page, are short and readable in a language such as Cypher or Gremlin. On a graph that fits on one machine, multi-hop traversals are fast.
Our graph does not fit on one machine. With 100 billion edges partitioned across many servers, a user's neighbours live on many partitions, and each hop multiplies the partitions touched: 200 followees, each with 200 followees, means reading lists from up to 40,000 users scattered across the cluster. No partitioning scheme keeps a social graph local, because real social graphs are densely connected. A demo on 10 million edges shows none of this. So I would ask the proposing team for a prototype on a realistic share of the real graph, with real query mixes, measuring latency at the 99th percentile and cost per query, before any decision.
3The Common Pattern: Serve, Compute, Precompute
Large social products usually converge on three layers. The partitioned edge store, which we already run, serves one-hop reads and writes at high rates. A graph processing system, such as Spark with GraphFrames or a dedicated batch graph engine, reads a daily or hourly snapshot of the edges and computes expensive things: friend suggestions with scores, communities, influence measures. Its results, such as the top 50 suggestions per user, are written back into a key-value store, so serving a suggestion is a single fast read.
- Serving APIstable contract: checks, lists, counts, suggestions
- Partitioned edge storeone-hop reads and writes, fresh
- Precomputed results storetop suggestions per user, key-value
- Offline graph jobsSpark or similar, hourly or daily snapshots
- Edge snapshots and change logfeed the jobs from the edge store
5 layers, from the top down. Step through them one at a time.
Deep traversals run offline; serving stays one hop or a key lookup.
This keeps the expensive work off the serving path, lets each layer scale independently, and makes it easy to change the suggestion algorithm without touching the store users write to.
4Mutual Counts and the Two-Hop Query
For ordinary accounts, a mutual-follow count is an intersection of two sorted lists: the accounts I follow and the accounts the other person follows, each a few hundred ids from one partition. Merging two sorted lists of 300 ids takes microseconds. For very large accounts, exact intersection is too expensive, so we estimate with sketches, small summaries such as MinHash or HyperLogLog that estimate set overlap within a few percent, and show rounded numbers such as about 1.2K mutual followers.
People you follow who follow page X starts from my following list of about 200 ids and asks, for each, whether they follow X. That is 200 point lookups, batched and run in parallel against the edge store, a few milliseconds in total. The query sounded like a graph traversal, but it fits the existing store well.
5How I Would Decide
I would run a time-boxed evaluation, perhaps six weeks, with both teams. The graph database team prototypes the features on a realistic slice of production data; the edge store team builds the same features with the hybrid pattern. We compare on agreed criteria: latency percentiles under load, cost per month at full scale, operational maturity (backups, upgrades, on-call experience, failure behaviour), and development speed for the next likely features. I also count the cost of running a second primary store, which is significant for a small infrastructure team.
Whatever wins, I keep the serving API stable: features call a graph service with operations such as checkFollow, listFollowers, mutualCount and suggestions, not the storage directly. That makes the decision reversible, and it lets a graph database be added later for a specific workload, such as fraud ring detection, without moving the core follow graph.
6Follow-up questions
Is there any case where you would move the whole graph into a graph database?
If the graph were small enough to fit on one machine or a few, or if most product queries were online multi-hop traversals that could not be precomputed, a graph database would be a strong choice. At 100 billion edges with mostly one-hop online queries, those conditions do not hold.
How fresh can the suggestions be with batch jobs?
Daily jobs are common, and hourly is achievable. For freshness after a specific action, such as just followed someone, a near-line job can listen to the follow stream and adjust that user's suggestions within minutes, for example by adding the new followee's popular followees.
How do you handle the team whose proposal was not chosen?
By making the decision on criteria both teams agreed beforehand and sharing the measurements openly. Often part of the proposal survives, for example a graph database for an analytics or fraud use case, and the team's prototype work becomes the evidence that informed the decision.
7Conclusion
In this answer, we saw that the decision starts with classifying features by query shape, rate and freshness: online paths are one-hop lookups that a partitioned edge store serves well, while suggestions are multi-hop but can be hours stale. Graph databases make traversals easy but cross many partitions at 100 billion edges, so they need proof at real scale. The common pattern serves from the edge store, computes in offline graph jobs and writes back precomputed results. Mutual counts use sorted-list intersection or sketches, and a stable serving API keeps the choice reversible.
Open with
I would start by separating the online and offline needs. The follow check and lists are one-hop lookups at hundreds of thousands per second, which our partitioned edge store already does well.
Then, if they want more
Friend suggestions need two or three hops, but they can be hours old. Mutual counts can be approximate, and people you follow who follow a page is really 200 point lookups from my following list, which the edge store handles in milliseconds.
A graph database makes traversals easy to write, but at 100 billion edges spread over many machines, each hop crosses many partitions, and a social graph cannot be partitioned to stay local, so a demo on a small dataset tells us little.
I would ask for a prototype at realistic scale and compare it with the hybrid pattern most large products use: the edge store for serving, an offline graph job such as Spark computing suggestions, and precomputed top suggestions written back to a key-value store.
Mutual counts are an intersection of two sorted lists for normal accounts and a sketch estimate for huge ones. I would decide on agreed criteria, latency percentiles, cost, operational maturity, and keep a stable graph service API so we can change storage later.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "As the senior technical leader, how do you decide which graph storage strategy to adopt...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/a1bbe60a08/