Instagram Stories 00:00:01 A phone publishes a twenty-four-hour story Leena adds a sticker to a short clip. Follow it through one design for an Instagram-style story. The phone, media storage and tray index have different definitions of published. Text, stickers and a poll are added on the phone. instant feedback, no server work. A multipart upload sends video bytes straight to object storage and retries the failed part. The application service keeps ownership and metadata off the expensive media transfer path. 201, processing. The app shows the story to its author at once. The change flows through Kafka into every tray server's index. No follower lists are touched. A local preview can feel instant while the media is still processing. The system should advertise a playable item to followers only when the corresponding rendition and visibility state allow it. 00:00:56 Decide whose ring lights up A viewer opens the story tray. Each ring summarizes several underlying items and the viewer's own progress, while follow and block decisions can change between requests. GET /v1/tray with the last ETag. 500 accounts, minus blocks, from a fresh cache. The last item watched for each author. Newer items make the ring colourful. Circles, tiny previews for the first ten, three authors to prefetch. Return enough metadata to start quickly. Avoid downloading all the media for every person in the tray when the viewer will open only one. 00:01:36 Buy the next second of playback Leena's friend taps her ring. Prefetching a few likely items reduces startup time, but bandwidth spent on the wrong prediction cannot be spent on the clip actually being watched. The app asks for the first items of three authors before any tap. Addresses for ten minutes, or less if the story ends sooner. While item 1 plays, item 2 is requested. This edge does not have it. Item 2 plays at once, item 3 is fetched. Quality rises if the network allows. Use buffer health, network estimates and expiry to decide how far ahead to fetch. A valid media address cannot make an already expired or unauthorized story appropriate to show. 00:02:21 Expiry is a read rule before it is cleanup Record the time the story must disappear. The index, content store, CDN and viewer's device each have independent housekeeping schedules. Which clock enforces the product promise? The story is posted at three thirty in the afternoon UTC. Its public eligibility expires twenty-four hours later in this exercise. The entry is ignored by the same check. A sweep removes it within a minute. The record becomes logically unavailable at expiry. Physical reclamation depends on the storage engine's retention and compaction configuration. A cooperative app can remove its local cached copy. It cannot retract an external copy already made by a viewer. Check eligibility on every serving path and bound URL lifetimes. Background removal reclaims storage later. Bytes legitimately seen or copied by a viewer cannot be recalled from every device. 00:03:17 Views and viewers are different counts A viewer watches three clips and then loses signal. Playback should not stall waiting for analytics. A repeated analytics event should not turn one person into two viewers. The app notes three items. Playing never waits. The service checks that the items are visible to this viewer, stores the event in Kafka and answers 202. The viewer's mark moves forward, so the ring turns grey. For a large audience the example switches its aggregate to a HyperLogLog sketch. Its precision and size are configured trade-offs; the sketch does not enumerate individual viewers. Use an exact record where the product needs to show who watched. An approximate distinct counter can answer a separate aggregate question at large scale and has an error distribution.