← Meta Interview Insights

Meta·Backend Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

Meta backend system design round, one big question that sprawled into like six different sub-topics. Felt like I was being tested on how far I could go before I started hand-waving, which honestly was not that far.

Questions Asked (1)

Q1

Design a system that returns the top-K items by some metric in real time, such as most-clicked products or trending tags. Walk through the full pipeline: how data gets ingested, how you store and rank items, how queries work, how updates propagate, and how you handle scale.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

This question ate the whole session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (scale, latency, accuracy, update frequency) and then design a pipeline that ingests events, maintains approximate top-K using a distributed streaming approach, and serves queries with low latency. Emphasize trade-offs between exactness and scalability, and how you'd handle updates and failures.

Pro tip: Meta values practical scalability and real-time systems; mention using a combination of Kafka for ingestion, Flink for stream processing, and a sharded in-memory store like Redis with a custom top-K algorithm (e.g., count-min sketch + heap) to handle high throughput and low latency.

1. Clarify Requirements and Constraints

Ask about scale (QPS, data volume), latency requirements, accuracy (exact vs approximate), update frequency, and query patterns (e.g., top-K per category, global).

2. Design Ingestion Pipeline

Use a distributed message queue (e.g., Kafka) to collect events from producers; ensure partitioning by item ID for ordered processing and scalability.

3. Stream Processing and Ranking

Process events in real-time using a stream processor (e.g., Flink) to update counts; use approximate algorithms (e.g., count-min sketch, space-saving) to maintain top-K per shard, then merge.

4. Storage and Query Serving

Store top-K results in a low-latency store (e.g., Redis) with periodic updates; serve queries via an API that fetches from the store, possibly with caching.

5. Handle Scale, Updates, and Failures

Shard the processing and storage, use replication for fault tolerance, and design for eventual consistency; discuss trade-offs between update frequency and accuracy.

Key Points to Mention

  • Use of approximate algorithms (count-min sketch, space-saving) to handle high cardinality and memory constraints.
  • Partitioning and sharding strategies to distribute load and enable horizontal scaling.
  • Trade-offs between exact and approximate top-K, and between latency and accuracy.
  • Fault tolerance and exactly-once processing semantics in stream processing.
  • Caching and precomputation for low-latency queries.
  • Handling of time windows (e.g., trending in last hour vs all-time) and decay functions.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.