Thunder
In-memory in-network post store. Serves recent posts from accounts a user follows in sub-millisecond time via Kafka-fed per-user stores.
What it does
Thunder solves a core latency problem: at X's scale, querying a database for all recent posts from followed accounts on every feed request would be prohibitively expensive. Thunder pre-loads that data into memory.
Architecture
Thunder has two parallel processes:
Write path (continuous)
Kafka stream
│ (post create / delete events)
▼
Realtime ingestion
│ (parse, validate, route by author)
▼
Per-user in-memory stores
├── Original posts
├── Replies & reposts
└── Video posts
│
└── Auto-trim past retention windowRead path (per feed request)
Feed request arrives
│
▼
Following list (from query hydration)
│
▼
Per-author store lookups
│ (one lookup per followed account)
▼
In-network candidate set → Home Mixer pipelineKey properties
| Property | Detail |
|---|---|
| Latency | Sub-millisecond — no external DB hit |
| Storage | In-memory only |
| Ingestion | Kafka post create/delete events |
| Retention | Auto-trimmed past retention window |
| Store types | Original posts, replies/reposts, video posts |
| Language | Rust |
Trade-off
Memory for latency. Thunder keeps the relevant slice of the post graph warm and pre-indexed at all times. The cost is memory; the benefit is that in-network retrieval is essentially free compared to the Phoenix ML search.
Why separate store types?
Splitting per-user stores into original posts, replies/reposts, and video posts lets the read path fetch specific content types efficiently without scanning everything.
- - X Algorithm — For You Feed — pipeline overview
- - Phoenix — out-of-network retrieval counterpart
- - X Algorithm — Key Concepts — query hydration (supplies the following list)