How Celebrity Posts Go Viral Without Breaking Instagram
One post, millions of likes and comments in minutes. How Instagram handles the celebrity problem by keeping unbounded work off the synchronous path.
When a celebrity posts on Instagram, the platform faces one of the harshest real-world load tests there is.
Instagram survives a celebrity post by never reading or writing unbounded data on the synchronous request path. Likes become cached aggregate counters, comments are sharded and served in pages of 20 to 50, writes go through queues, rankings are precomputed, and hot posts are served from CDN, edge and in-memory caches.
Within minutes, a single post can attract:
- millions of likes
- millions of comments
- millions of reads
From a systems perspective, this is a nightmare scenario. One object suddenly becomes the hottest read key and the hottest write target in the entire system.
If this traffic were handled like a normal post, the database would collapse almost instantly.
In system design, this challenge is known as the Celebrity Problem.
Instagram survives virality by architecturally refusing to perform dangerous operations, instead of scaling blindly.
Let’s break down how.

1. What is the celebrity problem in system design?#
The celebrity problem is a single post suddenly becoming the hottest read key and the hottest write target in the system, which breaks backends designed for evenly distributed traffic.
Most backend systems are implicitly designed for evenly distributed traffic. Celebrity posts break that assumption immediately.
A naive implementation would:
- read millions of rows to display likes
- synchronously insert millions of comment records
- sort comments live on every request
This leads to:
- hot partitions
- lock contention
- cascading latency failures
Instagram’s first architectural rule is strict:
No synchronous request may touch unbounded data.
If an operation can grow with popularity, it is pushed out of the critical path.
2. How does Instagram count millions of likes?#
Instagram records each like as an event and displays a cached aggregate counter, so showing a like count never means reading the likes as rows.
When you see “4.2M likes”, Instagram is not querying 4.2 million records.
Instead:
- likes are modeled as events, not query results
- each like action is written to write-optimized storage or logs
- the displayed number comes from cached aggregate counters
Key properties:
- counters are eventually consistent
- reads are constant-time
- writes are append-only and cheap
“4.2M likes” is a materialized view, not a live computation.

3. How does Instagram load millions of comments?#
Instagram loads comments from shards partitioned by post_id, 20 to 50 at a time, already filtered and ranked.
Instagram never loads all comments for a post.
Comments are:
- partitioned by post_id
- distributed across independent shards
- fetched in bounded windows
Scrolling loads:
- 20–50 comments at a time
- already filtered and ranked
There is no API that returns “all comments”.
That endpoint does not exist.
4. Read Path and Write Path Are Fully Decoupled#
Instagram sends likes and comments through queues or append-only logs while reads hit caches and read replicas, so neither path waits on the other.
This is the most critical design decision.
Writes (likes, comments):
- flow through queues or append-only logs
- are processed asynchronously
- never block user-facing reads
Reads:
- hit caches and read replicas
- fetch precomputed views
- never wait on writes
This separation means:
- write spikes do not affect read latency
- virality does not cascade into outages
Reads and writes scale independently.

5. Multi-Layer Caching for Hot Posts#
Hot posts are served from CDN caches, edge caches and in-memory application caches, so most of their requests never reach the database.
Once a post starts going viral, it is quickly marked as HOT.
Hot posts are served from:
- CDN caches
- edge caches
- in-memory application caches
As a result:
- most requests never reach the database
- recomputation is avoided
- traffic is absorbed at the edge
The database stays a system of record, not a traffic handler.
6. Ranking Is Precomputed, Not Sorted Live#
Instagram does not sort comments during user requests.
Instead:
- rankings are computed asynchronously
- “top comments” are maintained with priority queues
- updates are batched in the background
When a user scrolls:
- the backend fetches a prepared slice
- returns it directly
No live sorting. No expensive queries under load.

7. Async Fan-Out With Optimistic UI#
When you like or comment, Instagram updates your UI instantly, writes to the backend asynchronously, and reconciles counters later.
When you like or comment:
- the UI updates instantly
- the backend write happens asynchronously
This is optimistic execution.
The system assumes success and:
- reconciles counters later
- resolves conflicts asynchronously
This avoids:
- global locks
- hot-row contention
- user-visible latency spikes
Correctness is eventual. Responsiveness is immediate.
8. Why Instagram Never “Fully Loads” Anything#
Instagram never fully loads likes, comments or viewers because unbounded operations are forbidden on the synchronous path.
You never load:
- all likes
- all comments
- all viewers
Everything is:
- paginated
- windowed
- eventually consistent
Unbounded operations are explicitly forbidden on the synchronous path.
This is not an optimization. It is a survival strategy.
Final Takeaway#
Instagram scales viral posts by refusing to read or write unbounded data synchronously.
Virality does not break the system because the system was designed on the assumption that virality would happen.
That is real-world system design.
Frequently asked questions#
What is the celebrity problem in system design?
The celebrity problem is what happens when one object, such as a celebrity's post, becomes the hottest read key and the hottest write target in the system within minutes. Handled like a normal post, that traffic causes hot partitions, lock contention and cascading latency failures.
How does Instagram show like counts on viral posts?
Instagram writes each like as an event to write-optimized storage or logs and shows a cached aggregate counter. Reading the count is constant-time, whatever the number of likes.
Are Instagram like counts updated in real time?
No. The counters are eventually consistent. Your own like shows up instantly through optimistic UI, and the backend reconciles the counters later.
Why doesn't Instagram load all comments at once?
Loading every comment would be unbounded work on the synchronous path. Comments are sharded by post_id and served in ranked pages of 20 to 50, and no endpoint returns all comments.
Written by Dhananjay Aggarwal


