← 返回 snapchat 的题目列表Snap Story or Spotlight Feed Backend
类型:qbank
Design the backend for Snapchat Stories or Spotlight video feed vending, including upload, privacy, offline support, feed pagination, freshness, storage, and serving trade-offs.
Requirements
Design a backend for Stories or Spotlight-style feed consumption.
Functional requirements:
Users can upload stories or short videos with metadata, media, author, visibility, and expiration policy.
Viewers can fetch a feed, page up / down, and resume from a cursor.
Stories support saving, favorites, and offline behavior where applicable.
Visibility rules must respect friends, public content, blocks, age / region limits, and content safety decisions.
The system logs views, skips, hides, favorites, and completion events for ranking and analytics.
Scale / constraints:
Media files are large; metadata and feed records are small but very hot.
Feed serving needs low latency and high availability.
Freshness and personalization matter, but a fully recomputed feed per request may be too expensive.
Design decisions:
Push fanout vs pull fanout for friend stories; hybrid for celebrities / high-fanout creators.
Object storage plus CDN for media; separate metadata store for story records.
Cursor semantics for feed pagination and resume.
Precomputed feed cache vs on-request candidate generation.
Offline cache invalidation and expiration behavior.
Notes
Separate media ingestion from feed serving. Upload should store media in object storage, transcode variants asynchronously, write metadata, and publish an event for ranking / distribution. Feed reads should return metadata and signed / CDN media URLs, not stream the original media through the application server.
For Stories, privacy and expiration are core. For Spotlight, candidate generation, ranking, and diversity are core. Both designs need logging that can tolerate duplicate client events and late delivery.
Preparation
Practice a diagram with: upload service, media processing, object storage, metadata DB, feed generation, cache, ranking, and event log.
Prepare the fanout trade-off: push is fast for reads but expensive for large audiences; pull is flexible but heavier at read time.
Be ready to discuss offline support: local cache, expiry timestamps, conflict behavior, and what cannot be viewed after permissions change.