Northwind’s catalogue activity feed
Outcome. After this optional chapter, you can compare fan-out work with read-time merging while preserving withdrawal.
Hypothetical scenario. Priya needs an activity feed of catalogue changes, while one busy supplier produces far more updates than the rest.
In short. Keep item authority separate from reader projections. Isolate high-fan-out publishers and bound the serving merge.
A feed is a view with a freshness policy
Hypothetical scenario. A professional community shows posts from followed authors. Most authors have modest audiences, but a few have many followers. Readers expect stable pagination, and a deleted post must stop appearing through new requests under a declared withdrawal policy. A reverse-chronological list is the first release; personalized ranking is a later change.
The core state is posts, follow relationships and visibility decisions. A reader's assembled feed is derived state. Its freshness and completeness can differ from the authoritative post record, but those differences must be intentional. A cache hit cannot establish that the reader is still permitted to see an item.
Scope includes posting, following, pagination, visibility and derived-view recovery. Advertising auctions, video transcoding and recommendation training are excluded. This case studies fan-out and read assembly rather than promising a universal social platform.
Copying every post to every reader has a shape
Fan-out-on-write appends a reference into recipient inboxes when a post is created. It makes some reads inexpensive but multiplies write work by recipients and requires handling follow changes and deletion. Fan-out-on-read stores author histories and assembles a reader's view later, shifting work toward reads.
Neither is always better. A quiet reader may never consume eagerly prepared entries. A highly active reader may repeatedly need expensive merge work. A publisher with a large audience can dominate fan-out while contributing little post volume.
Do not use one average follower count to hide that distribution. Identify hot publishers, active-reader fractions, retention and the freshness expected for new follows. Those inputs determine whether a mixed strategy is useful.
Separate post authority from reader projections
Write a post under a stable identity and author authority. Record publication intent with the authoritative change. Projection workers append deduplicated references to eligible recipient inboxes. They preserve the source post version so retries and older updates do not recreate withdrawn content.
A read merges the selected sources under an explicit ordering rule, removes duplicates and checks visibility. Use a deterministic tie-breaker, such as an agreed creation order plus unique identity. If ordering changes between pages, define whether the cursor pins a snapshot or permits bounded movement.
A hybrid design may retain ordinary author fan-out while reading selected high-fan-out histories directly. That requires one coherent merge contract. Calling a publisher a special case does not eliminate authorization, freshness or pagination obligations.
Work through northwind’s catalogue activity feed
A Northwind activity feed is a derived view, not the authoritative record of an item or its permissions. Postgres can own the item change while asynchronous workers maintain per-reader projections. Redis can serve a selected recent working set. Decide what the reader is promised about publication, withdrawal and ordering before optimizing how quickly an inbox can be assembled.
In a hypothetical workload, ten thousand ordinary publishers each create two posts per day for one hundred recipients. Their projection work is 10,000 × 2 × 100 = 2,000,000 deliveries per day. A single large publisher with one million recipients and five daily posts creates 1,000,000 × 5 = 5,000,000 deliveries. The one large publisher therefore creates more projection work than the ordinary group in this model, despite having far fewer source posts.
A hybrid design can materialize ordinary activity and merge high-fan-out activity during a read. That change moves work between publication and serving; it does not eliminate it. Bound how many sources a read consults, preserve a stable merge order, and make repeated delivery of an event harmless under the chosen version rule. A source transaction that records a post and a projection job also needs a policy for the uncertain handoff to its dispatcher.
Deletion must reach the derived representations and remain effective during replay. A new worker rebuilding an inbox should not resurrect a withdrawn post from an older event. Keep the relevant version or tombstone evidence, apply current eligibility before serving, and define whether a reader can see a stale projection while withdrawal catches up. A fast Redis lookup cannot substitute for those rules.
For pagination, choose the history the cursor represents. A stable ordering key plus a tie-breaker gives the merge a defined position; a ranked feed can additionally need a ranking or snapshot version. Changing an offset into an opaque string does not create those semantics. First establish continuity for the small chronological view, then evaluate whether richer ranking justifies its extra evidence and rebuild requirements.
Derive the fan-out and read cost
Hypothetical scenario. Choose 10,000 ordinary authors producing two posts daily with 100 recipient inboxes each. Logical posts are 10,000 × 2 = 20,000 per day. Projection appends are 20,000 × 100 = 2,000,000 per day, excluding retries and later relationship changes.
Now one publisher creates ten posts for 100,000 followers. Its fan-out alone is 10 × 100,000 = 1,000,000 references daily, half the ordinary group’s append work from only ten posts. That difference is why a single global average hides an important design choice.
Choose 32 bytes per logical reference. Three million daily references use 3,000,000 × 32 = 96,000,000 bytes, or 96 MB. Thirty days retain 2.88 GB of reference payload before indexes, replication and allocation. This is not the size of the original post bodies or a complete storage estimate.
For read assembly, suppose one page examines five author streams and requests 20 candidate references from each. It considers 5 × 20 = 100 candidates before filtering and deduplication, but returns at most 20. A visibility filter that removes many candidates may require another bounded fetch; it cannot promise a full page without more work.
A projection backlog of 120,000 references with 20,000 appends per minute of capacity and 10,000 new references per minute drains at 20,000 −10,000 = 10,000 per minute. Recovery takes 120,000 ÷ 10,000 = 12 minutes under constant successful processing rates. Cold reads during that interval need a declared fallback.
In the wild: Northwind’s catalogue activity feed
Primary evidence for northwind’s catalogue activity feed: HTTP reuse has explicit cache semantics relevant to withdrawal.
Stable pagination needs a history rule
Offset pagination can shift when new posts arrive ahead of the offset. A cursor can encode the last ordering position and required snapshot context, but must be validated and bound to the appropriate reader and query. An opaque token does not automatically make pagination stable or authorized.
Ranking changes make the problem harder. A later personalized score can reorder earlier candidates. Decide whether a browsing session pins a ranking version, tolerates duplicates with client deduplication or deliberately refreshes the feed. Each changes storage and freshness expectations.
Follow and unfollow transitions also need semantics. Should a new follow include earlier posts? Should unfollow remove already projected references? A serving-time eligibility check can protect visibility while background cleanup catches up. Product semantics determine the acceptable lag.
A deleted post remains in the inbox
Hypothetical scenario. A post is withdrawn, but one inbox worker processes an older publication event afterward. A cached feed page still contains the post reference. Deleting the authoritative body alone does not explain what the reader will receive.
Use ordered versions or tombstone state so older events cannot restore a newer withdrawal. Enforce the promised visibility check before rendering, and invalidate affected caches according to the response policy. HTTP caching semantics matter when pages are reused outside the application's own projection store.
Preserve enough state to rebuild projections without republishing removed material. A rebuild that replays only creation events and omits deletion history can resurrect old content. Recovery is an application-semantic operation, not just a bulk copy.
Three feed-design misconceptions
“The inbox is the source of truth.” It may be a useful projection, but the post's identity, current visibility and relationship policy need an authoritative boundary.
“A cursor means no duplicates.” Its ordering, snapshot and merge rules determine that behavior. A token alone establishes nothing.
“A popular publisher requires a separate platform.” It may need a different assembly path or isolated work budget within the same coherent service.
Choose the first version and its evolution
Start with an explicit chronological contract and an indexed author history. Use measured read and write patterns to justify projection. Introduce a mixed path only when the hot-publisher and reader workloads warrant its extra merge and recovery complexity.
Monitor projection age, candidate-to-return ratio, visibility rejections, hot partitions and page continuity. Measure useful page completion rather than only post-write latency. Bound backfills and isolate rebuild traffic from live publication.
Reject immediate personalized ranking if the first requirement is a reliable chronological feed. Reject treating cached feed entries as permanent permission, and reject an eager fan-out policy whose worst publisher cannot be processed within the chosen freshness contract.
Limits of northwind’s catalogue activity feed
The recipient counts and publication rates are hypothetical. Fan-out arithmetic excludes payload sizes, retries and projection storage. A hybrid merge moves work onto serving and needs its own latency and freshness evidence; it is not a universal improvement over a simpler chronological feed.
Check yourself: review the feed trade-offs
A publisher has few posts but dominates projection work. What input explains it?
The recipient count per post. Compare its fan-out with the rest of the workload and consider an isolated or read-assembled path under one merge contract.
An old event reappears after deletion. What must the projection preserve?
Version or tombstone evidence that prevents obsolete publication from overriding withdrawal. Rebuild and serving paths must honor that state too.
New posts arrive during pagination. Does replacing an offset with an opaque string solve continuity?
No. Define the ordering position, snapshot or ranking version, tie-breaker and merge semantics that the cursor actually represents.
The large publisher doubles its recipient count while ordinary activity stays fixed. Which budget changes first?
Its fan-out becomes 2,000,000 × 5 = 10,000,000 projection deliveries daily under the stated assumptions. Ordinary delivery work remains 2,000,000. A serving-time merge can move some work away from publication, but then read frequency, merge fan-out and cache policy determine the new cost. Neither change establishes a universal ranking or freshness policy.
Northwind decision log
Keep item authority separate from reader projections.
Isolate high-fan-out publishers and bound the serving merge.
Preserve withdrawal and version evidence during replay.
Go deeper into derived data and load
- Book chapter: Redis in Action, chapter 6: Application components in Redis — Josiah Carlson. Use Application components in Redis when reviewing northwind’s catalogue activity feed.
- Book chapter: Redis in Action, chapter 8: Building a simple social network — Josiah Carlson. Use Building a simple social network when reviewing northwind’s catalogue activity feed.
- Video lecture: Distributed Systems 5.1: Replication — Martin Kleppmann. Watch for the ordering and concurrent-operation model.
- Primary specification: RFC 9111: HTTP Caching — IETF HTTP Working Group. Relevant to reused pages and withdrawal behavior.
Related blog: Retrying LLM Tool Calls Without Double-Charging: Idempotency Keys and Reconciliation.