Skip to content
SeeItFlow
System Design · Trade-offs & Decisions

Trade-offs & Decisions

The key architectural decisions in a social media platform, and the trade-offs that make each one non-obvious. Understanding these trade-offs — not memorizing the architecture — is what prepares you for a real interview.

Mangesh MandlikLast updated:
Decision 01

Fanout Strategy

The single most important architectural decision in a social feed system: when do you compute the feed — at write time or at read time?

Fanout-on-write

When a post is created, immediately distribute it to every follower's pre-built feed. Feed retrieval becomes a bounded lookup independent of the number of accounts the reader follows. Write cost scales with follower count. A strong default for a read-heavy platform with a normal follower distribution.

Fanout-on-read

When a user requests their feed, fetch recent posts from all followed accounts on the fly. Read cost scales with the number of accounts followed; write cost stays low. A reasonable choice when posts are rare relative to reads, or when an account's follower count makes write-time fanout impractical.

Hybrid fanout

Use fanout-on-write below a configurable follower/activity threshold and fanout-on-read above it. The Feed Service merges both sources. For the workload assumed in this design, this gives good behavior across the full follower distribution, at the cost of more implementation and operational complexity than either pure strategy alone.

Decision 02

Consistency vs. Latency

Social feeds tolerate eventual consistency. This is a design choice, not a compromise.

Strong consistency for feed delivery would require synchronous fan-out on every post creation, blocking the write path until all followers' feeds are updated. At millions of followers, this is impractical.

Eventual consistency means a post may take seconds to minutes to appear in all followers' feeds (illustrative: seconds under normal load, minutes while a fanout backlog drains — the same range the Twitter trade-offs page cites as "seconds to tens of seconds" in the normal case). Depending on product requirements, this limited staleness is generally acceptable for a social feed — it is not automatically invisible to every user in every product, but it is an accepted trade-off for the workload assumed in this design.

Decision 03

Media Storage

Object storage + CDN vs. serving media from application servers.

Object storage + CDN

Cheap per-byte storage with effectively unbounded horizontal scalability. A CDN serves cached bytes for the large majority of requests after the first, reducing — not eliminating — origin load and cost. No application-server capacity is consumed serving binary blobs.

Database or application server

Expensive per-byte. Finite scalability. Every unique request hits your infrastructure. Application servers blocked on file I/O instead of business logic.

Decision 04

Caching Assembled Feeds

Assembled feeds can be cached to avoid recomputing the merge-and-rank step on every request.

A feed assembly cache stores the final ordered post list per user with a short TTL. The tradeoff: shorter TTL means fresher feeds but more computation; longer TTL means less computation but stale feeds.

Cache invalidation is triggered on new post creation for the user's followers. For celebrity accounts with millions of followers, invalidating the assembled cache of every follower on every post would be its own form of the hot-user problem — use TTL expiration instead.

Decision 05

Backend-Proxied vs. Direct Media Upload

Should large media bytes pass through application servers, or go directly to object storage?

Backend-proxied upload

Client → application/upload server → object storage. Simple to reason about and easy to add inline validation, but ties fixed application-server compute and bandwidth directly to raw upload throughput.

Direct-to-object-storage upload

Client → authorized temporary target → object storage, as covered in Media Upload Architecture. Removes the application tier from the bandwidth path entirely, at the cost of additional upload-state coordination — the system must track authorization, completion, and validation as separate steps rather than a single request.

Decision 06

Synchronous vs. Asynchronous Media Processing

Should resizing and transcoding happen before the upload response, or after it?

Synchronous processing

A simpler state model — a post is either fully processed or the upload failed — but upload latency includes the full cost of resizing or transcoding, which can be seconds for images and much longer for video.

Asynchronous processing

Faster acknowledgement to the client and independently scalable processing workers (see Media Processing Pipeline), at the cost of an explicit processing state machine, retry handling, and a window where the post exists but its media is temporarily unavailable.

Decision 07

Full Post Copies vs. References in Feed Store

Should a follower's feed store hold complete copies of each post, or just references to it?

Full post copies

Reduces hydration work at read time since the data is already sitting in the feed store, but creates enormous duplication across millions of followers' feed stores and a hard propagation problem: every edit or deletion now has to be re-applied to every copy.

Post references / IDs

Compact feed-store entries that preserve a single, centralized source of truth for post content (see Data Ownership & Storage Model). Requires a hydration step at read time to turn IDs into displayable posts, but keeps deletion, editing, and visibility changes correct by construction — there is only one place the truth lives.

Decision 08

Fixed vs. Adaptive Fanout Classification

How should the system decide whether an author is 'normal' or 'high-fanout'?

Fixed follower-count threshold

Simple, predictable, and easy to explain: cross a configurable number of followers, become high-fanout. Easy to reason about in an interview or a first implementation, but ignores posting frequency, active-follower ratio, and current system pressure.

Adaptive classification

Incorporates follower count, posting frequency, active followers, queue pressure, and observed fanout cost (see Hybrid Fanout Strategy) to classify authors more precisely, at the cost of a more complex, less predictable classification system to build and operate.

Decision 09

Offset vs. Cursor Feed Pagination

How should a continuously changing, effectively infinite feed be paginated?

Offset/limit pagination

Simple and familiar, but breaks down against a feed that keeps changing underneath the reader: new posts shift what would have been at a given offset, ranking changes move items between pages, and readers can see duplicates or missed posts across page boundaries.

Cursor / continuation-token pagination

Each page carries an opaque cursor describing where the next page should continue from (see Feed Pagination). For a chronological feed the cursor can be as simple as (timestamp, post_id). For a ranked feed, the cursor may instead reference a materialized or snapshotted result rather than only a timestamp, since ranking does not correspond to one fixed sort key.