Design Video Metadata Reads Under a Deadline
Choose and enforce consistency for video catalog fields and changing aggregates while returning a truthful result within a tight read deadline.
Problem statement
For this exercise, assume a public video metadata service returns author name and genre from one versioned catalog record, plus independently published rating and view-count aggregates.
Internal authorized services publish catalog revisions and trusted aggregate snapshots; creating videos, playback, media processing, recommendations and rights authorization are outside scope. A metadata read must return a complete, partial or unavailable outcome within a 20-millisecond server-side deadline.
Catalog data must have been confirmed against its authority within one second; each aggregate must declare its source revision and truthful coverage time. The conservative wall-clock age of that coverage time at response dispatch, including the clock-uncertainty margin, must be no greater than 60 seconds.
An unavailable aggregate is explicit and is never substituted with zero. A missing or expired catalog record cannot be returned as successful metadata.
Choose strong or eventual consistency at each ownership boundary and justify how the chosen design meets these guarantees under concurrent updates, lag and dependency failure.
The source reports a 20-millisecond API response requirement and asks which consistency model fits video metadata; the timing boundary, freshness limits, aggregate ownership, workload and failure outcomes here are practice assumptions.
What to build
- Return an eligible catalog revision with independently versioned rating and view-count values and freshness evidence. Use complete when both aggregates are eligible and partial when either aggregate is unavailable.
- Authorized internal publishers can conditionally commit catalog revisions and aggregate snapshots without a delayed older revision replacing newer accepted state.
- Return a typed missing or unavailable outcome by the read deadline when mandatory catalog evidence is absent or expired; never turn a missing aggregate into a zero or claim instant global freshness.
At scale
- Source fact: the original Karat question requires the video-stream metadata API to respond within 20 milliseconds and names author, rating and view count. It asks for strong versus eventual consistency and reasons.
- Practice assumption: measure a 20-millisecond deadline inside one serving region, from service admission to response dispatch; client Internet latency is outside this budget. Work stops or is detached safely when that deadline expires.
- Practice assumption: support one million catalog records, 20,000 peak reads/s, 200 catalog updates/s and 1,000 aggregate snapshot updates/s, with a skewed warmed working set. Cold or expired keys may return unavailable if authority lookup cannot finish in time.
- Practice assumption: catalog confirmation is valid for at most one second at response dispatch. An aggregate is eligible only when the conservative wall-clock age of its truthful coverage time at response dispatch is no greater than 60 seconds. Timestamp comparisons include the known five-millisecond clock-uncertainty margin; uncertain timing invalidates the freshness claim.
- Practice assumption: one region is authoritative for catalog writes. Aggregate publishers provide an ordered source epoch/revision and a truthful coverage time; derived values may decrease after a correction, so value size is not the ordering key.