← Meta Interview Insights

Meta·Software Engineer·Onsite - System Design / Architecture·Staff

Staff
May 2026

Summary

Meta onsite system design round with two back-to-back problems: a large-scale leaderboard service and a real-time messenger. Each required full end-to-end coverage and the pace was relentless. Not a round where you can afford to ramble.

Questions Asked (9)

Q1

Design a large-scale leaderboard service that supports global rank, friend-circle rank, and paginated top-N queries with high write throughput.

System DesignData ModelingTechnical Trade-offs
Author's notes

The friend-circle rank part is where I got tripped up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying functional and non-functional requirements, including scale, consistency, and latency. Then propose a high-level architecture that separates write and read paths, using a write-optimized store (e.g., Redis Sorted Sets) and a read-optimized store (e.g., a distributed database with precomputed ranks). Finally, dive into data modeling and trade-offs for global rank, friend-circle rank, and paginated top-N queries.

Pro tip: Emphasize the trade-off between consistency and latency: for global rank, eventual consistency with periodic snapshots may be acceptable, but for friend-circle rank, you might need stronger consistency or real-time computation. Also, discuss how to handle hot keys and sharding to maintain high write throughput.

1. Clarify Requirements

Ask about scale (users, writes per second, read patterns), consistency requirements, latency SLAs, and whether ranks need to be exact or approximate. Also clarify the definition of friend-circle (e.g., mutual friends, one-way follows).

2. High-Level Architecture

Propose a layered architecture: ingestion layer for writes, a fast in-memory store (e.g., Redis) for real-time updates, a persistent store (e.g., Cassandra) for durability, and a query service that merges results. Consider using a message queue to decouple writes.

3. Data Modeling and Ranking

For global rank, use a sorted set with scores; for friend-circle rank, either compute on the fly using a graph service or maintain per-user friend leaderboards. For paginated top-N, use sorted sets with range queries or precomputed pages.

4. Scaling and Trade-offs

Discuss sharding strategies (e.g., by user ID or leaderboard ID), replication for read scalability, and caching. Address consistency vs. latency: use eventual consistency for global rank, but consider stronger consistency for friend ranks. Mention handling hot keys and write amplification.

5. Optimizations and Edge Cases

Propose optimizations like approximate ranking using sampling, batch writes, and lazy rank computation. Discuss edge cases: ties, inactive users, and friend list changes.

Key Points to Mention

  • Use of Redis Sorted Sets for efficient rank and range queries
  • Sharding and replication strategies to handle high write throughput
  • Trade-offs between consistency and latency for different rank types
  • Graph data structures for friend-circle rank computation
  • Pagination techniques (e.g., cursor-based) for top-N queries
  • Handling hot keys and write contention with techniques like sharded counters

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

Q2

How would you handle tie-breaking and stable pagination windows in the leaderboard?

System DesignAlgorithms & Data Structures
Author's notes

Blanked for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: leaderboard size, update frequency, and consistency needs. Then propose a composite sort key (score + tie-breaker like user ID or timestamp) and a cursor-based pagination scheme that encodes the last seen key to ensure stable windows. Discuss trade-offs between consistency and performance, and mention how to handle updates during pagination.

Pro tip: Emphasize that tie-breaking must be deterministic and stable across requests; using a unique tie-breaker like user ID prevents duplicates or missing entries. Also, consider using a snapshot or versioned leaderboard for consistent pagination during heavy updates.

1. Clarify requirements and constraints

Ask about leaderboard size, update frequency, consistency requirements, and pagination needs (e.g., infinite scroll, page numbers). This shapes the design.

2. Define a deterministic tie-breaking rule

Choose a secondary sort key (e.g., user ID, timestamp of achieving the score) to ensure a total order. This prevents non-deterministic ordering when scores are equal.

3. Design stable pagination with cursors

Use a cursor that encodes the last seen (score, tie-breaker) pair. The next page query fetches entries after that cursor, ensuring no duplicates or gaps even if scores change.

4. Address consistency and updates

Discuss strategies for handling updates during pagination: e.g., snapshot isolation, versioned leaderboards, or accepting eventual consistency with a note on potential anomalies.

5. Evaluate trade-offs and optimizations

Compare approaches (e.g., offset vs. cursor pagination, in-memory vs. database-backed) and suggest optimizations like caching, sharding, or using a sorted set (Redis ZSET).

Key Points to Mention

  • Composite sort key: (score DESC, tie-breaker ASC) to ensure deterministic ordering.
  • Cursor-based pagination using the last seen key to avoid duplicates/gaps.
  • Handling updates: snapshot, versioning, or eventual consistency with caveats.
  • Data structures: balanced BST, skip list, or Redis sorted sets for efficient range queries.
  • Trade-offs: consistency vs. performance, memory vs. latency, and complexity.
  • Edge cases: ties at page boundaries, new high scores, and deleted users.

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

Q3

How would you handle anti-cheat and score integrity in the leaderboard system?

System DesignTechnical Trade-offs
Author's notes

Server-authoritative scoring was the obvious first answer.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the threat model and scale, then propose a layered defense combining client-side hardening, server-side validation, and anomaly detection. Emphasize trade-offs between security, latency, and user experience, and describe how you would iterate based on data.

Pro tip: Meta values measurable impact, so quantify how your anti-cheat measures reduce cheating rates while keeping false positives low, and mention A/B testing to validate effectiveness.

1. Clarify requirements and threat model

Ask about the game type, scale, and specific cheating concerns (e.g., bots, memory editing, replay attacks). Identify what 'score integrity' means for this leaderboard.

2. Design client-side protections

Propose obfuscation, tamper detection, and secure communication (e.g., TLS, certificate pinning) to raise the bar for attackers. Acknowledge limitations of client-side only.

3. Implement server-side validation and scoring

Ensure all score submissions are validated server-side using authoritative game logic, rate limiting, and cryptographic signatures. Never trust the client.

4. Add anomaly detection and machine learning

Use statistical models and ML to flag suspicious patterns (e.g., impossible scores, rapid progression) and automatically quarantine or review flagged accounts.

5. Iterate with monitoring and feedback loops

Set up dashboards for cheat detection rates and false positives, and continuously refine rules based on new attack vectors and user reports.

Key Points to Mention

  • Defense in depth: combine client hardening, server validation, and anomaly detection
  • Trade-offs between security, latency, and user experience (e.g., added validation may increase response time)
  • Use of cryptographic techniques like HMAC or digital signatures for score submissions
  • Rate limiting and throttling to prevent automated attacks
  • Machine learning for anomaly detection with human review for edge cases
  • Importance of monitoring, logging, and A/B testing to measure effectiveness

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

Q4

Walk through how you'd support seasonal resets and multi-game leaderboards without disrupting the core service.

System DesignData Modeling
Author's notes

Went with namespace partitioning: each leaderboard keyed by game ID and season ID so resets are just a new key space rather than a destructive operation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: scale, read/write patterns, consistency needs, and what 'seasonal reset' means for the business. Then propose a decoupled architecture that isolates leaderboard logic from the core service, using event-driven updates and a storage layer optimized for ranking queries. Finally, discuss trade-offs and how you'd handle resets and multi-game support without impacting core service availability.

Pro tip: Emphasize idempotency and graceful degradation: leaderboards should be eventually consistent and never block core gameplay. Also, mention that you'd version leaderboard configurations to allow safe rollbacks during seasonal transitions.

1. Clarify Requirements and Constraints

Ask about scale (users, games, events per second), read/write ratios, latency requirements, and consistency expectations. Understand what a 'seasonal reset' entails (e.g., archiving, zeroing scores) and how many games need support.

2. Design a Decoupled Architecture

Propose a separate leaderboard service that consumes events from the core service via a message queue (e.g., Kafka). This ensures the core service remains unaffected by leaderboard load or failures.

3. Choose Data Model and Storage

Use a sorted set (e.g., Redis ZSET) for real-time leaderboards, with periodic snapshots to durable storage (e.g., DynamoDB) for persistence. For multi-game support, partition data by game ID and season ID.

4. Handle Seasonal Resets and Multi-Game Support

Implement resets as atomic operations: create a new leaderboard instance for the new season, while keeping the old one read-only for archival. Use configuration-driven game definitions to avoid code changes per game.

5. Address Reliability and Trade-offs

Discuss idempotent event processing, handling duplicate or out-of-order events, and fallback strategies if the leaderboard service is down. Weigh consistency vs. availability and explain your choices.

Key Points to Mention

  • Event-driven architecture with message queue (e.g., Kafka) to decouple core service from leaderboard updates.
  • Use of Redis sorted sets for efficient ranking and range queries.
  • Partitioning by game ID and season ID to support multi-game and seasonal resets.
  • Idempotency and exactly-once processing to handle duplicate events.
  • Graceful degradation: leaderboards can be eventually consistent and should not block core gameplay.
  • Versioned leaderboard configurations for safe rollbacks and A/B testing.

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

Q5

Design a real-time messenger supporting 1:1 and group chat, with correct message ordering and at-least-once delivery guarantees.

System DesignTechnical Trade-offs
Author's notes

This is where the round started feeling rushed because we'd already spent a lot of time on the leaderboard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then design the high-level architecture covering message flow, storage, and delivery. Focus on how to achieve correct ordering and at-least-once delivery using sequence numbers, acknowledgments, and idempotent processing. Discuss trade-offs and potential bottlenecks.

Pro tip: Emphasize that at-least-once delivery requires idempotent consumers to avoid duplicates, and that ordering can be maintained per conversation using a monotonic sequence number. This shows you understand the practical implications beyond just the guarantee.

1. Clarify Requirements and Scale

Ask about expected user count, message volume, latency requirements, and consistency needs. Confirm that at-least-once delivery is acceptable and that ordering is per conversation, not global.

2. High-Level Architecture

Outline components: clients, gateway servers, message service, storage (e.g., Cassandra for messages, Redis for presence), and push notification service. Describe message flow from sender to receiver.

3. Message Ordering

Explain how to assign a monotonically increasing sequence number per conversation (e.g., using a distributed counter or timestamp with tie-breaker). Clients use this to order messages and detect gaps.

4. At-Least-Once Delivery

Describe delivery guarantees: sender persists message, receiver acknowledges receipt, and server retries until ack. Use message IDs and idempotent processing to handle duplicates.

5. Trade-offs and Failure Handling

Discuss trade-offs: at-least-once vs exactly-once, ordering vs availability, and how to handle server failures, network partitions, and message loss. Mention monitoring and metrics.

Key Points to Mention

  • Use of sequence numbers per conversation to ensure correct ordering.
  • Acknowledgments and retries to achieve at-least-once delivery.
  • Idempotent message processing to handle duplicates.
  • Storage choices: Cassandra for durability, Redis for low-latency presence.
  • Handling offline users via push notifications and message queues.
  • Trade-offs between consistency, availability, and latency (CAP theorem).

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

Q6

How would you design presence indicators, typing indicators, and read receipts at scale?

System DesignAPI & Integrations
Author's notes

Presence is the classic heartbeat-to-a-presence-service problem, nothing surprising.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale (e.g., billions of users, millions of concurrent connections), then propose a distributed architecture using WebSockets for real-time updates and a pub/sub system for fan-out. Focus on trade-offs between consistency, latency, and cost, and discuss how to handle edge cases like offline users and mobile battery constraints.

Pro tip: Emphasize that presence and typing indicators are ephemeral and can tolerate eventual consistency, while read receipts require stronger consistency for correctness. Also, mention the importance of client-side optimizations like debouncing and batching to reduce server load.

1. Clarify Requirements and Scale

Ask about the number of users, expected concurrent connections, latency requirements, and consistency needs for each indicator. Understand if the system is for 1:1 chats, group chats, or both.

2. High-Level Architecture

Propose a layered architecture: clients connect via WebSockets to edge servers, which publish events to a pub/sub system (e.g., Kafka, Redis Pub/Sub). A presence service maintains user status in a distributed cache (e.g., Redis) with TTLs, while a separate service handles read receipts with a durable store (e.g., Cassandra).

3. Data Flow and Consistency

Describe how events propagate: typing indicators are sent directly to recipients via pub/sub; presence updates are broadcast to interested parties (e.g., friends) with throttling; read receipts are written to a database and then pushed to the sender. Discuss consistency models: eventual for presence/typing, strong for read receipts.

4. Scalability and Reliability

Explain how to scale horizontally: sharding by user ID, using a distributed cache with replication, and handling failures with retries and idempotency. Mention techniques like long polling fallback, heartbeats for presence, and rate limiting to prevent abuse.

5. Trade-offs and Optimizations

Discuss trade-offs: using TTLs for presence reduces storage but may cause false offline; batching updates reduces load but increases latency. Suggest optimizations like client-side debouncing, delta updates, and using a separate low-latency channel for typing indicators.

Key Points to Mention

  • WebSockets for real-time bidirectional communication, with fallback to long polling.
  • Pub/sub system (e.g., Kafka, Redis Pub/Sub) for fan-out to multiple subscribers.
  • Distributed cache (e.g., Redis) with TTL for presence status to handle ephemeral data.
  • Eventual consistency for presence and typing indicators, strong consistency for read receipts.
  • Sharding and partitioning strategies to scale horizontally (e.g., by user ID or chat ID).
  • Client-side optimizations: debouncing typing events, batching presence updates, and using heartbeats.

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

Q7

How do you handle fanout for very large group chats?

System DesignTechnical Trade-offs
Author's notes

This one actually interested me more than the others.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the scale and requirements (e.g., group size, message frequency, latency, consistency). Then discuss the trade-offs between fanout-on-write and fanout-on-read, and propose a hybrid approach that leverages a pub/sub system with sharded queues and efficient message delivery.

Pro tip: Mention that Meta uses a hybrid approach with a dedicated delivery service that handles fanout asynchronously, and that you would consider using a push-based model with long polling or WebSockets for active users, while falling back to pull for inactive ones.

1. Clarify Requirements

Ask about group size, message volume, latency requirements, and consistency needs to scope the problem.

2. Compare Fanout Strategies

Discuss fanout-on-write (push) vs. fanout-on-read (pull), highlighting pros and cons for large groups.

3. Design a Hybrid Approach

Propose a hybrid model that uses push for active users and pull for inactive, with a pub/sub backbone.

4. Address Scalability and Reliability

Explain how to shard, replicate, and monitor the system to handle failures and scale horizontally.

5. Optimize for Efficiency

Suggest techniques like batching, compression, and deduplication to reduce bandwidth and storage costs.

Key Points to Mention

  • Fanout-on-write vs. fanout-on-read trade-offs
  • Use of pub/sub systems like Kafka or Meta's own infrastructure
  • Sharding and partitioning strategies for scalability
  • Handling inactive users with pull-based delivery
  • Batching and compression to reduce network overhead
  • Monitoring and failure recovery mechanisms

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

Q8

How would you approach end-to-end encryption in the messenger without the server being able to read message content?

System DesignTechnical Trade-offs
Author's notes

Went with a standard double-ratchet style approach: key exchange happens client-side, server only stores ciphertext.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then walk through the E2EE design using a double ratchet protocol for key management, explaining how the server remains blind to message content. Discuss trade-offs around metadata, multi-device support, and features like backups and search, and how to mitigate them.

Pro tip: Acknowledge that E2EE is not just about encryption but also about key management and metadata protection; mention that Meta's messenger already uses E2EE in secret conversations and is moving towards default E2EE, showing awareness of real-world constraints.

1. Clarify Requirements and Constraints

Ask about scale (billions of users), latency, multi-device support, and feature requirements like group messaging, backups, and search. Confirm that the server should not access plaintext or keys.

2. Design Key Management and Encryption Protocol

Propose using a double ratchet algorithm (Signal protocol) for forward secrecy and future secrecy. Explain how identity keys, prekeys, and session keys are generated and exchanged via the server without revealing them.

3. Describe Message Flow and Server Role

Outline how the server acts as a blind relay: stores encrypted messages, facilitates key exchange, and delivers ciphertext. Emphasize that the server never sees plaintext or private keys.

4. Address Trade-offs and Edge Cases

Discuss challenges: multi-device sync (use device-specific keys and encrypted sync), backups (encrypted backups with user-held keys), search (client-side indexing), and metadata protection (sealed sender, minimal logging).

5. Summarize and Evaluate

Recap the design, highlight how it meets requirements, and mention potential improvements like post-quantum cryptography or trusted execution environments for specific features.

Key Points to Mention

  • Double Ratchet algorithm for forward secrecy and future secrecy
  • Public key infrastructure: identity keys, signed prekeys, one-time prekeys
  • Server as blind relay: no access to plaintext or private keys
  • Multi-device support: device-specific keys and encrypted synchronization
  • Metadata protection: sealed sender, minimal server-side logging
  • Trade-offs: impact on features like search, backups, and message recall

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

Q9

How would you handle offline sync and multi-device consistency for the messenger?

System DesignData Modeling
Author's notes

Short answer: message log with monotonic sequence numbers per conversation, clients sync from their last-seen offset on reconnect.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: what types of data (messages, read receipts, etc.), consistency expectations, and offline duration. Then propose a client-server architecture with local storage, a sync protocol (e.g., delta sync with vector clocks or CRDTs), and conflict resolution strategies. Finally, discuss trade-offs between consistency, latency, and complexity, and how to handle multi-device scenarios.

Pro tip: Emphasize idempotency and monotonicity in sync operations to avoid duplicates and ensure progress, and mention how you'd leverage existing Meta infrastructure like TAO or Memcache for scalability.

1. Clarify Requirements and Constraints

Ask about data types, consistency needs (strong vs eventual), offline duration, and device count. This scopes the problem and shows you avoid over-engineering.

2. Design Local Storage and Sync Protocol

Propose a local database (e.g., SQLite) on each device and a sync protocol using versioning (e.g., vector clocks, Lamport timestamps) or CRDTs for conflict-free merging. Consider delta sync to minimize data transfer.

3. Handle Multi-Device Consistency

Use a central server as the source of truth with per-device cursors. Implement push notifications for real-time updates and pull-based sync for offline reconciliation. Discuss conflict resolution (e.g., last-write-wins, CRDTs) and how to handle message ordering.

4. Address Edge Cases and Failures

Cover scenarios like concurrent edits, duplicate messages, network partitions, and device reconnection. Explain how idempotent operations and retry mechanisms ensure reliability.

5. Evaluate Trade-offs and Scalability

Discuss trade-offs between consistency models (e.g., strong vs eventual), latency, and complexity. Mention how the design scales with Meta's infrastructure (e.g., TAO, Memcache) and handles millions of users.

Key Points to Mention

  • Conflict-free replicated data types (CRDTs) for automatic conflict resolution
  • Vector clocks or Lamport timestamps for causality tracking
  • Delta sync and compression to reduce bandwidth
  • Idempotent operations and deduplication to handle retries
  • Push notifications (e.g., via WebSocket or MQTT) for real-time updates
  • Server as source of truth with per-device sync cursors

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