Start by clarifying functional and non-functional requirements, then estimate scale (e.g., 2B users, 500M daily status posts). Propose a high-level architecture with separate write and read paths, and dive deep into data modeling, storage choices, and trade-offs for expiration, view tracking, and privacy.
Pro tip: Emphasize how you'd leverage existing Meta infrastructure (e.g., TAO for social graph, Haystack for media storage) to avoid reinventing the wheel and to meet latency SLAs. Also, discuss the trade-off between push and pull models for status updates, considering fan-out on write vs. read.
Clarify functional requirements (post creation, viewing, 24h expiration, view tracking, privacy controls) and non-functional (low latency, high availability, consistency). Estimate scale: daily active users, status posts per day, media size, read/write ratio.
Outline components: client, API gateway, status service, media service, metadata store, view tracking service, privacy service, and notification service. Describe data flow for posting and viewing a status.
Design schemas for status metadata (user ID, timestamp, media URL, privacy settings, expiration time) and view tracking (status ID, viewer ID, timestamp). Choose storage: e.g., Cassandra for metadata (high write throughput, TTL), Redis for view counts, S3 for media.
Explain how to handle 24-hour expiration: use TTL in Cassandra, a background job to delete media, and ensure reads filter expired statuses. For view tracking, design a scalable counter (e.g., Redis INCR) and store individual views for analytics, considering write amplification.
Discuss privacy settings (public, contacts, custom lists) and how to enforce them at read time (e.g., check friendship via TAO). Highlight trade-offs: push vs. pull for status updates, consistency vs. latency for view counts, and storage cost vs. query performance.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
This is where the interview really lived or died.
Start by clarifying requirements and constraints, especially privacy boundaries and ephemerality. Then propose a high-level architecture that separates indexing from serving, and dive into key components like indexing pipeline, query processing, and privacy enforcement. Discuss trade-offs and how to handle ephemeral data.
Pro tip: Emphasize that privacy is not an afterthought but a core design principle: propose privacy-preserving techniques like differential privacy or on-device indexing, and explain how you'd enforce access controls at query time.
Ask questions to understand scale, privacy expectations, and what 'ephemeral' means (e.g., 24-hour expiry). Clarify if search is only for the author or also for viewers, and what privacy boundaries exist.
Propose a system that ingests statuses, extracts searchable metadata (caption, hashtags, author), and builds an index. Separate the indexing pipeline from the query serving layer for scalability.
Design an inverted index for text and hashtags, and a forward index for author-based queries. Discuss how to handle ephemeral data: use TTL-based eviction or time-partitioned indices.
Describe how queries are parsed and executed against the index. Enforce privacy by filtering results based on viewer's relationship to author (e.g., friends only) and applying access control lists at query time.
Discuss trade-offs between latency and freshness, index size vs. query flexibility, and privacy vs. search quality. Mention potential optimizations like caching, sharding, and using approximate algorithms.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.