Interview Prep GuidePublic

Meta Software Engineer Interview Prep Guide

Everything Meta actually asks Software Engineer candidates — concept walkthroughs, worked examples, and the real interview questions, drawn from candidate reports. Free to read.

Last updated

Meta Software Engineer Interview Cheatsheet cover

Focus most on distributed-systems-heavy onsite prep: real-time messaging/feed systems, concurrency control, TTL/holds, replication, caching, rate limiting, observability, and job scheduling. There are no 4–5 self-rated categories or solved-history signals to downgrade aggressively; coding has the strongest engagement signal with 48 views, so it stays at normal timed-review depth. The Meta-specific emphasis is on Messenger/news-feed style delivery, fanout, ranking-adjacent API choices, mobile offline behavior, cache invalidation, and operating services under high scale. With only 1–2 weeks, bias the budget toward onsite system design while keeping daily coding refreshers and a concise behavioral story set.

Technical Screen — 27 min

Coding & Algorithms

  • In-Memory Key-Value Stores With TTL (Focus) — covered in depth under Online Assessment below.

Onsite — 75 min

System Design

Focus area — Distributed-systems-heavy onsite plus selected websockets, pub/sub, caching, search, and offline sync map directly to Meta messaging/feed designs.

Left-to-right architecture for messaging and news feeds, showing idempotent APIs, conversation ordering, durable event streaming, fanout workers, caches, and cursor-based delivery.

What's being tested

These designs test whether you can decompose a high-scale social product into APIs, storage, asynchronous pipelines, caches, and delivery paths while making consistency and failure semantics explicit. The recurring challenge is moving user-generated data quickly and reliably to many readers or recipients without making every request expensive. Meta cares because small mistakes in fanout, ordering, privacy enforcement, or retries become severe at billions of interactions. Interviewers are probing your ability to quantify bottlenecks, choose appropriate tradeoffs, and explain operational behavior under failure.

Core knowledge
  • Requirements clarification should establish traffic, payload sizes, latency targets, durability, retention, read/write ratios, group sizes, privacy rules, and acceptable loss. Separate user-visible guarantees—such as “a sent message is durable”—from implementation choices like Kafka or a particular database.

  • API contracts should use stable identifiers, explicit status codes, pagination cursors, and retry-safe semantics. A send endpoint commonly accepts a client-generated idempotency key; repeating the same key returns the original result rather than creating duplicate messages.

  • Message ordering is usually guaranteed per conversation, not globally. Assign a monotonically increasing conversation sequence from a single logical sequencer or partition owner; clients reconcile gaps using conversation_id plus seq_no, while globally ordered timestamps remain unsuitable as the sole ordering guarantee.

  • Delivery semantics should be stated precisely: at-most-once risks loss, at-least-once requires deduplication, and exactly-once end-to-end is generally an illusion. Durable append followed by asynchronous delivery usually gives at-least-once delivery, with consumer-side message IDs and inbox state making retries harmless.

  • Polling without persistent connections can use short polling, long polling, or push notifications. Long polling reduces empty responses while retaining request/response APIs; return messages after a timeout or immediately when available, then have the client reconnect with a cursor and exponential backoff.

  • Cursor-based synchronization is safer than page numbers under concurrent writes. Return an opaque cursor such as (conversation_seq, message_id) and a has_more indicator; handle expired cursors, deleted records, duplicate pages, and gaps by allowing a full resynchronization.

  • Fanout-on-write copies a post reference into followers’ inboxes, giving cheap reads but expensive writes for celebrity accounts. Fanout-on-read stores the post once and merges followees’ recent posts at read time; hybrid systems commonly fan out ordinary users and merge high-degree accounts dynamically.

  • Feed storage should separate durable canonical posts from materialized feed entries. A feed entry may contain post_id, author, creation sequence, visibility version, and expiration metadata; the reader rechecks deletion, blocking, and privacy so stale materializations cannot leak content.

  • Partitioning and hot keys require choosing a stable access boundary: conversation ID for chat ordering, author or post ID for writes, and user ID for inbox reads. A single celebrity or huge group can overload one shard, so use partition splitting, append-only logs, batching, or special fanout paths.

  • Caching and CDN design should cache immutable media by content hash and serve it through a CDN, while metadata and personalized feeds use shorter-lived caches. Invalidate or version objects rather than relying only on deletion broadcasts; cache authorization-sensitive responses carefully to prevent cross-user leakage.

  • Asynchronous propagation decouples the write path from feed fanout, search indexing, notifications, and media processing. A durable queue such as Kafka supports replay and backpressure, but consumers need idempotent writes, dead-letter handling, lag monitoring, and a clear policy for temporarily stale results.

  • Capacity planning starts with simple estimates: storage per day is approximately writes_per_second × average_bytes × 86,400, and fanout work is approximately posts_per_second × average_follower_count. Track p50, p95, and p99 latency separately for writes, reads, propagation lag, and media delivery.

Worked example

For “Design a real-time messenger”, I would first clarify whether 100M MAU implies a particular concurrent-user level, the expected group-size distribution, message retention, multi-device behavior, and whether the 150 ms target covers server acknowledgment or recipient rendering. I would state assumptions, then organize the answer around API contracts, durable message storage, ordered delivery, and connection/session management. The send path would validate membership, assign a conversation-local sequence, durably append the message, and publish an event for recipient delivery. Recipient devices would maintain per-conversation cursors and deduplicate by message ID, allowing retries without duplicate display. I would distinguish online delivery from offline synchronization, with unread state and missed-message recovery handled by cursor-based reads. A key tradeoff is whether to use a centralized sequencer per conversation for simple ordering or decentralized writes for availability and lower coordination cost. I would explicitly discuss group fanout, hot conversations, backpressure, and observability for send-to-receive p99. If I had more time, I would cover multi-region failover, encryption boundaries, abuse controls, and device receipt semantics.

A second angle

For “Design an Instagram-style news feed”, the central problem shifts from strict per-conversation ordering and low-latency delivery to scalable materialization and freshness. I would compare fanout-on-write, fanout-on-read, and a hybrid strategy based on follower degree and read/write amplification. Feed reads need opaque cursors, stable pagination, privacy rechecks, and behavior when posts are deleted after materialization. The important latency tradeoff is often precomputing more work at publish time versus doing more merging and filtering at read time. I would also isolate media delivery through object storage and a CDN so large photos do not consume feed-service capacity.

Common pitfalls

Pitfall: A common analytical mistake is promising “exactly-once delivery” as if it were a simple database setting. End-to-end retries, crashes between persistence and acknowledgment, and device reconnects make that guarantee unrealistic; say at-least-once transport plus idempotent deduplication instead.

Pitfall: A communication mistake is jumping directly into Kafka, Redis, and database schemas without stating traffic, latency, or consistency assumptions. The interviewer needs a requirements-to-design chain, so announce the workload first and explain why each component follows from it.

A depth mistake is describing fanout but ignoring privacy, deletion, ordering gaps, or retries. “Write the post to every follower’s feed” is incomplete; explain stale-entry handling, celebrity hot spots, asynchronous lag, and how readers recover when a materialized entry is missing or invalid.

Connections

The interviewer may pivot to consistent hashing, leader election, replication and multi-region consistency, or backpressure and queue semantics. They may also ask about API pagination, cache invalidation, observability, or designing a notification service that shares the same event stream.

Further reading

Practice questions

Focus area — Replication, quorum reads/writes, Raft, fencing, and stale reads are marked new; this is core distributed-systems onsite material.

Architecture diagram showing replicated storage across regions, Raft quorum commitment, leader failover, and fencing tokens that prevent stale writes.

What's being tested

This topic tests whether you can reason about distributed state when machines fail, messages are delayed, and network partitions make healthy nodes appear dead. You should distinguish replication from consensus: copying data improves availability and durability, while consensus coordinates multiple nodes on one safe ordering of decisions. Meta cares because production services must preserve correctness under regional failures without turning every failover into data loss, split-brain writes, or a prolonged outage.

Core knowledge
  • Synchronous versus asynchronous replication defines the durability boundary. Synchronous followers acknowledge before a write completes, reducing potential loss but increasing p99 latency and reducing availability; asynchronous followers improve throughput but permit an acknowledged write to disappear during failover.

  • Replication factor NN is the number of copies; quorum protocols commonly require write quorum WW and read quorum RR, with W+R>NW + R > N and often W>N/2W > N/2. This overlap helps reads observe writes, but quorum arithmetic alone does not guarantee linearizability.

  • Linearizability makes each operation appear to take effect atomically between invocation and response. Sequential consistency preserves a single global order but may violate real-time ordering; eventual consistency permits temporary divergence and requires application-level conflict resolution.

  • Consensus algorithms such as Raft and Paxos choose one ordered log despite failures. Raft separates leader election, log replication, and commitment; a command is committed only after replication to a majority, preventing a minority partition from safely advancing state.

  • Terms, epochs, and fencing tokens prevent stale leaders from writing after a delayed network path recovers. Every request should carry the current generation or lease token, and storage must reject operations from an older token rather than trusting the client’s view.

  • Leader election requires a failure detector, usually timeouts and randomized backoff. A timeout is only suspicion, not proof: GC pauses, overload, or packet loss can create false failovers, so systems need quorum checks and term validation to avoid split brain.

  • Failover correctness has three separate goals: availability, bounded data loss, and bounded recovery time. State them as RTO (how quickly service returns), RPO (how much acknowledged or recent data may be lost), and the consistency guarantee users receive during recovery.

  • Write-ahead logs and state-machine replication make recovery deterministic. Nodes persist log entries before applying them, replay committed entries after restart, and use snapshots or checkpoints to avoid replaying an unbounded history; truncation must preserve entries needed by lagging replicas.

  • Read behavior during failover must be explicit. A stale replica may serve availability-oriented reads, while a linearizable read must contact the current leader or establish a quorum; session guarantees such as read-your-writes may require session metadata or routing affinity.

  • Network partitions expose the CAP tradeoff: when communication is interrupted, a system cannot simultaneously guarantee availability for every partition and linearizable consistency. A well-designed answer identifies which operations reject, which may proceed, and how reconciliation works afterward.

Worked example

Representative question: “Design a replicated key-value store with automatic failover.”
In the first 30 seconds, clarify the consistency target, write/read workload, replication factor, regional topology, acceptable RPO/RTO, and whether overwrites or transactions are required. I would organize the answer around four pillars: the replicated log and storage format, leader election and consensus, client routing and failover, and monitoring plus recovery. I would choose a Raft-like leader for a shard, persist commands in a WAL, replicate them to a majority, and apply only committed entries to the state machine. Reads would either go through the leader for linearizability or use followers only when bounded staleness is acceptable. The key tradeoff is whether to acknowledge after one durable replica or after a majority: the former lowers latency but increases failover data loss, while the latter sacrifices availability when a quorum is unavailable. I would explicitly address stale leaders using terms and fencing tokens, rather than assuming a timeout proves failure. I would close by saying that, with more time, I would detail shard rebalancing, snapshot installation, rolling upgrades, and fault-injection tests for partitions and delayed messages.

A second angle

A different framing is cross-region database failover, where latency and correlated regional failures dominate the design. Instead of assuming a majority is nearby, compare single-region consensus with synchronously replicated regions and asynchronous disaster-recovery replicas. The central question becomes whether the business prefers a higher RPO with fast regional writes or a lower RPO with cross-region commit latency and reduced availability during a partition. You should also explain DNS or service-discovery convergence, promotion safety, and how the old region is fenced before the new region accepts writes. This demonstrates that failover is both a protocol problem and an operational sequencing problem.

Common pitfalls

Pitfall: Treating replication as consensus. Saying “three replicas means the data is safe” is incomplete; without an agreed leader, commit rule, and stale-writer fencing, replicas can diverge or accept conflicting writes.

A common analytical mistake is claiming that W + R > N automatically provides strong consistency. That condition creates quorum overlap under a specific protocol, but linearizability also requires correct leader behavior, version ordering, durable commit rules, and protection against concurrent writes.

A communication mistake is jumping directly to Raft without stating requirements. Start with consistency, availability, RPO, RTO, and failure assumptions; then justify the protocol and acknowledge what the design deliberately gives up.

A depth mistake is describing election but not recovery. Strong answers explain how a new leader identifies committed versus uncommitted entries, catches up lagging replicas, handles snapshots, fences the old leader, and avoids serving acknowledged-but-lost data.

Connections

The interviewer may pivot to CAP, linearizability, idempotency, exactly-once effects, distributed transactions, or shard rebalancing. Be ready to connect failover with observability: leader changes, replication lag, quorum health, rejected stale-epoch requests, and recovery duration are essential correctness signals.

Further reading

Practice questions

Focus area — Structured logs, RED metrics, histograms, token/sliding-window limiters, and distributed quotas are new and explicitly selected.

Architecture showing clients flowing through a distributed rate limiter and bounded queue to workers, with overload shedding and metrics, logs, and traces feeding observability.

What's being tested

This topic tests whether you can design a production service that remains observable, fair, and stable when demand exceeds capacity. The interviewer is probing your ability to connect rate limiting, backpressure, and observability rather than treating them as isolated middleware features. At Meta’s scale, a strong answer must address distributed coordination, failure modes, overload behavior, cardinality, and user-visible impact—not merely name a token bucket.

Core knowledge
  • Rate limiting bounds work accepted over time or concurrently. Distinguish requests per second, concurrency, bandwidth, and cost-based limits; a service may need separate limits for each resource.
  • The token bucket algorithm accumulates tokens at rate rr up to capacity BB; a request of cost cc succeeds when available tokens satisfy T≥cT \ge c. It permits bursts up to BB while enforcing long-term average rate rr.
  • A leaky bucket drains at a fixed rate, smoothing output more strictly than token bucket. Use it when downstream traffic must be shaped; use token bucket when controlled bursts improve latency and utilization.
  • Fixed windows are simple but allow a boundary burst of nearly 2L2L for limit LL. Sliding windows reduce boundary artifacts but cost more state; a rolling counter or sorted timestamps often provides a practical compromise.
  • Distributed limiters need a consistent decision point. An atomic Lua script in Redis, a strongly consistent service, or sharded local counters can work; local-only limits are cheaper but permit aggregate overshoot proportional to replica count.
  • Choose the limiting key deliberately: user, access token, IP, tenant, endpoint, or resource owner. Hierarchical limits can enforce both per-user and global quotas; avoid trusting spoofable headers such as X-Forwarded-For without a trusted proxy boundary.
  • Backpressure prevents producers from overwhelming consumers. Bounded queues, semaphore-based concurrency limits, admission control, and TCP flow control are mechanisms; an unbounded queue is not backpressure because it converts overload into memory exhaustion and latency collapse.
  • Queue behavior follows Little’s Law, L=λWL=\lambda W: average in-flight work equals arrival rate times average time in system. If arrival rate persistently exceeds service rate, queue depth and latency grow without bound; shedding work is eventually necessary.
  • Load shedding should be intentional: reject low-priority work first, return 429 for caller-controlled excess, return 503 when the service is temporarily unavailable, and include Retry-After when retry timing is meaningful.
  • Observability combines metrics, logs, and traces. Track accepted/rejected requests, limiter decisions, queue depth, oldest queued age, saturation, downstream errors, and p50/p95/p99 latency, segmented by endpoint, tenant, region, and priority.
  • High-cardinality metrics can overload the monitoring system. Keep stable dimensions in metric labels, sample or aggregate per-user detail, and put request or trace identifiers in structured logs and traces rather than metric names.
  • Alerts should detect symptoms and causes: tail latency, error rate, rejection rate, queue age, CPU, memory, and downstream saturation. A dashboard showing only average latency can hide a severe p99 regression affecting a small but important cohort.
  • Retry behavior interacts dangerously with overload. Exponential backoff with jitter, bounded attempts, deadlines, and idempotency reduce retry storms; never blindly retry 429, 503, or timed-out writes without understanding operation safety.
  • A limiter’s failure mode is a product and availability decision. Fail-open preserves traffic when the limiter is unavailable but risks overload; fail-closed protects dependencies but can cause a broad outage. Prefer local fallback budgets, conservative defaults, and explicit degradation paths.
  • Capacity planning should account for burst size, synchronization traffic, and hot keys. A single popular tenant can overload one shard even when cluster-wide utilization looks healthy; consistent hashing, key salting, or hierarchical aggregation may be required.
Worked example: Design a Rate Limiter for a Multi-Tenant API

I would first clarify the protected resource, tenant fairness requirement, acceptable burst size, regional topology, and whether limits are hard quotas or overload protection. I would state assumptions such as per-tenant requests per second, a bounded burst, multiple stateless API replicas, and a dependency that cannot safely absorb unlimited concurrency. I would organize the answer around policy and key selection, the limiter algorithm and distributed state, admission/backpressure behavior, and observability plus failure recovery. I would choose a token bucket with an atomic operation in Redis or a colocated limiter service, returning 429 and Retry-After when a tenant exceeds its budget. I would add a bounded per-replica work queue and a concurrency semaphore so requests admitted by the rate limiter cannot still exhaust downstream connections. The explicit tradeoff is centralized accuracy versus availability and latency: a global counter is fairer, while local buckets reduce dependency traffic but allow bounded overshoot. I would instrument allow/deny decisions, queue age, downstream saturation, and tail latency with tenant tiers rather than unbounded tenant labels. If I had more time, I would test clock skew, regional partitions, hot tenants, limiter outages, retry storms, and configuration rollout safety.

A second angle

For an asynchronous media-processing pipeline, the primary concern shifts from request rejection to controlling queue growth and protecting workers. I would use bounded queues, per-tenant concurrency quotas, priority-aware admission, and durable job state so accepted work is not silently lost. Metrics should emphasize queue age, throughput, retry counts, dead-letter volume, and time-to-completion rather than only HTTP latency. The key tradeoff is whether to delay low-priority jobs or reject them immediately when backlog threatens the completion-time objective.

Common pitfalls

Pitfall: Treating a rate limit as sufficient overload protection. A request-rate budget does not bound expensive work, concurrent database queries, response bytes, or queue memory; connect admission control to actual bottlenecks and cost.

Pitfall: Saying “use Redis” without explaining atomicity, consistency, expiration, sharding, or failure behavior. A stronger answer specifies the token update operation, what happens during partitions, and how much temporary overshoot is acceptable.

Pitfall: Listing dashboards without an operational response. Name the alert, likely diagnosis, and mitigation—for example, rising queue age plus stable ingress suggests worker or dependency saturation, so shed low-priority work and investigate downstream latency.

Connections

An interviewer may pivot to circuit breakers, bulkheads, and adaptive concurrency limits, which complement rather than replace quotas. They may also explore distributed consistency, retry and idempotency semantics, queue durability, capacity planning, or an SLO/error-budget policy.

Further reading
  • Site Reliability Engineering — Chapters on overload, cascading failures, monitoring, and handling large traffic spikes.
  • The Tail at Scale — Why tail latency and fan-out make overload controls essential in distributed services.
  • Release It! — Practical treatment of bulkheads, circuit breakers, timeouts, and stability patterns.

Practice questions

Focus area — You selected offline sync/conflict resolution; Meta mobile products often test delivery semantics, retries, and reconciliation under partitions.

What's being tested

This topic tests whether you can design a client-server system that remains correct across disconnected clients, retries, concurrent writes, and partial failures. The interviewer is probing your understanding of causal ordering, idempotency, conflict semantics, durable local state, and synchronization protocols—not merely whether you can say “use last write wins.” Meta cares because products operate across unreliable mobile networks and globally distributed services, where correctness, latency, and graceful offline behavior directly affect billions of user interactions.

Core knowledge
  • Offline-first architecture treats the client as a durable replica: reads come from a local database, writes enter an outbox, and synchronization runs asynchronously. > Tip: Never rely on an in-memory queue; process crashes must not lose accepted local mutations.

  • A mutation should carry a globally unique operation ID, entity ID, author/device ID, payload, and causal metadata. The server deduplicates operation IDs, making retries safe under timeouts and at-least-once delivery.

  • State-based synchronization exchanges full or summarized state and computes a merge; it is simple but bandwidth-heavy. Operation-based synchronization exchanges mutations, reducing payload size but requiring reliable delivery, deduplication, and deterministic application.

  • Last-write-wins (LWW) is easy to implement but dangerous: wall clocks skew, simultaneous edits can silently erase data, and timestamps alone do not express causality. If used, define a deterministic tie-breaker such as (logical_time, device_id, operation_id).

  • Lamport clocks provide a scalar ordering: on local or received event, set L←max⁡(L,Lreceived)+1L \leftarrow \max(L, L_{\text{received}}) + 1. They order events consistently but cannot distinguish causally unrelated concurrent operations.

  • Vector clocks represent causality per replica. For vectors VaV_a and VbV_b, Va≤VbV_a \le V_b iff every component is no greater; if neither dominates, the versions are concurrent and require a merge policy. They become expensive as device or replica count grows.

  • CRDTs provide deterministic convergence when operations or states satisfy properties such as commutativity, associativity, and idempotence. Use an observed-remove set for membership semantics, a grow-only counter where appropriate, or sequence CRDTs such as RGA/LSEQ for collaborative text.

  • Deletions require tombstones or deletion versions. Physically removing a record can let an old offline replica resurrect it. Tombstones need garbage collection only after the system knows all relevant replicas have advanced beyond the deletion.

  • A sync endpoint should support a cursor or checkpoint, such as sync_token, and return changes after that point. Make tokens opaque, durable, and invalidatable; clients must perform a full resync when retention expires or history is compacted.

  • Conflict semantics must match the domain. A notes title may use deterministic LWW, while a set of shared members should merge additions and removals explicitly. For financial or inventory data, reject or serialize conflicting writes rather than silently merging.

  • Separate transport reliability from application correctness. HTTPS, retries, and queues do not prevent duplicate operations or stale writes. The application still needs authentication, authorization at mutation time, deduplication, validation, and version checks.

  • Local optimistic updates need a reconciliation model: retain the original operation, apply it locally, incorporate remote changes, and replay pending operations. Clearly define whether a rejected operation is rolled back, transformed, or surfaced to the user.

Worked example

Consider the representative prompt: “Design offline sync and conflict resolution for a mobile notes app.” In the first 30 seconds, clarify whether notes are single-user or shared, whether concurrent character-level editing is required, expected offline duration, acceptable data loss, and whether the server is authoritative for permissions. I would organize the answer around local durable storage and an outbox, a sync protocol with cursors and idempotency, a versioning/conflict model, and observability plus recovery. Each local edit receives an operation ID and causal version, is committed transactionally with the local note, and is uploaded repeatedly until acknowledged. The server authenticates the device, deduplicates the operation, stores an ordered change log, and returns remote changes after the client’s checkpoint. For simple note metadata, I might choose deterministic LWW with a server-assigned logical timestamp; for shared rich text, I would use a sequence CRDT or operation transformation rather than overwrite the whole document. The explicit tradeoff is implementation complexity and metadata growth versus avoiding silent data loss during concurrent edits. I would close by noting that I would add property-based convergence tests, crash/retry tests, tombstone compaction, conflict metrics, and a user-visible recovery path if time allowed.

A second angle

For an offline shared checklist, the core problem is not character ordering but membership operations such as “add item,” “check item,” and “remove item.” A remove operation must identify the version or add operation it removes; otherwise an old offline add can resurrect the item. An observed-remove set or per-item versioned state may be more appropriate than a text CRDT. The framing shifts from mergeable text sequences to explicit business invariants, such as “an item cannot be checked after permanent deletion.” This illustrates why selecting a conflict algorithm before defining domain semantics is backwards.

Common pitfalls

Pitfall: Saying “use timestamps and take the latest” without addressing clock skew, equal timestamps, causality, or silent data loss is an analytical mistake. State the exact ordering source and explain which concurrent updates may be discarded.

A common communication mistake is jumping directly into CRDT names before clarifying the product semantics. Ask whether edits are field-level, list-level, or character-level, and distinguish offline single-device edits from concurrent edits by multiple users.

Pitfall: Treating retries, authentication, and a message queue as a complete sync design misses duplicate delivery, stale authorization, tombstone retention, checkpoint invalidation, and client crash recovery. Explain the end-to-end state transitions and failure behavior.

Connections

The interviewer may pivot to replication models, event sourcing, idempotent APIs, exactly-once illusions, or distributed garbage collection. They may also ask how to test convergence, enforce authorization on replayed operations, or migrate the local schema while clients remain offline.

Further reading

Practice questions

Focus area — You marked resource APIs, idempotency keys, cursor pagination, versioning, and quotas as new; learn definitions and Meta-scale API trade-offs.

What's being tested

This topic tests whether you can design APIs that remain correct under retries, concurrency, partial failures, and changing datasets. You should be able to distinguish idempotency from merely “retrying safely,” and explain how an idempotency key is persisted, validated, expired, and associated with the original response. For pagination, the interviewer is probing whether you understand keyset pagination, stable ordering, opaque cursors, and consistency guarantees rather than defaulting to inefficient offsets. Meta cares because high-volume APIs experience duplicate requests, timeouts, concurrent mutations, and clients that evolve independently of servers.

Core knowledge
  • Idempotency means repeating the same logical request has the same externally visible effect as executing it once. GET, PUT, and DELETE are conventionally idempotent; POST is not inherently idempotent, so payment, creation, and mutation APIs commonly accept an Idempotency-Key.

  • An idempotency record should contain the key, authenticated principal, request fingerprint, status (in_progress, succeeded, or failed), response status, response body, and expiration time. Scope keys by tenant or user so one client cannot collide with another.

  • Make creation of the idempotency record atomic with a uniqueness constraint, such as (user_id, idempotency_key). In Postgres, INSERT ... ON CONFLICT or a transactional conditional write prevents two workers from executing the same operation concurrently.

  • A retry with the same key and identical parameters should return the stored result; the same key with different parameters should produce a client error such as 409 Conflict or 400 Bad Request. Never silently reinterpret one key as multiple operations.

  • in_progress handling requires an explicit policy: wait briefly, return 409 or 202, or safely take over after a lease expires. A process crash after committing the business mutation but before recording completion is the difficult case; use a transaction, an outbox, or a durable operation record.

  • Idempotency does not guarantee exactly-once execution across every external system. If the API writes to a database and calls an external service, use an outbox pattern, downstream idempotency key, reconciliation job, or compensating action rather than relying on an in-memory flag.

  • Offset pagination (LIMIT 50 OFFSET 100000) is simple but becomes slower as the offset grows and can duplicate or skip rows when inserts or deletes occur. Keyset pagination seeks from the last sort key and remains efficient with an index.

  • A cursor requires a total ordering. If sorting by created_at, use a unique tie-breaker such as id: ORDER BY created_at DESC, id DESC. The next-page predicate is lexicographic, for example (created_at, id) < (:last_time, :last_id).

  • Cursors should be opaque to clients, commonly a base64url-encoded serialized payload containing the sort values, direction, filters, and schema version. Sign or authenticate the cursor to prevent tampering; encrypt it if sort values reveal sensitive information.

  • Cursor validity depends on consistency requirements. A live keyset query tolerates ordinary changes but may omit newly inserted records or show boundary effects; a snapshot token, stable read timestamp, or materialized result gives stronger consistency at additional storage and retention cost.

  • Fetch limit + 1 rows to determine has_more without an expensive count query. Enforce server-side bounds such as 1 <= limit <= 100; reject invalid, expired, filter-mismatched, or direction-mismatched cursors clearly.

  • Index for the access pattern, not merely the filter: a feed ordered by (created_at DESC, id DESC) needs a compatible composite index. For very large datasets, avoid counting all matching rows, and use bounded reads with predictable p95 and p99 latency.

Worked example

No interview title was supplied, so use this representative prompt: “Design an idempotent, cursor-paginated API for creating and listing user resources.” In the first 30 seconds, clarify whether creation may be retried, whether list results need snapshot consistency, the maximum page size, authorization scope, and the expected read/write rate. I would organize the answer around the API contract, idempotency state machine, transactional storage, pagination algorithm, and failure/observability behavior. For creation, the client sends an Idempotency-Key; the server atomically inserts a request record, performs the mutation in the same transaction, stores the response, and returns the stored response on retries. For listing, I would define a stable (created_at, id) order, use a composite index and a keyset predicate, and return an opaque cursor plus has_more. The key tradeoff is live pagination versus snapshot pagination: live reads are cheaper and fresher, while snapshots provide more stable traversal but require retaining or encoding additional state. I would explicitly describe concurrent duplicate requests and the crash window between the business write and response persistence. If I had more time, I would add rate limits, cursor versioning, metrics for duplicate-key conflicts, and a reconciliation strategy for external side effects.

A second angle

A different framing is “Design a paginated feed API where new posts arrive continuously while users scroll.” Here, the main concern is not creation retries but whether newly inserted posts should appear during an existing traversal. A descending (timestamp, id) cursor prevents most duplicates and skips, but new records ahead of the cursor will not appear unless the client refreshes from the beginning. If product requirements demand a frozen feed, introduce a snapshot timestamp or feed-generation token; if freshness matters more, document live-feed semantics and provide a refresh mechanism.

Common pitfalls

Pitfall: Saying “POST is safe to retry if the server checks the key” without explaining durable storage, atomic uniqueness, parameter mismatch handling, and concurrent requests. A strong answer describes the state transitions and the crash window explicitly.

Pitfall: Using OFFSET pagination for a high-volume mutable table because it is easier to explain. That answer ignores deep-page cost and duplicate or skipped records; propose keyset pagination with a unique tie-breaker and state the consistency tradeoff.

Pitfall: Promising exactly-once behavior across a database and an external service. Exactly-once is not obtained by a local lock; discuss transactional outbox, downstream idempotency, reconciliation, and what the client sees after an ambiguous timeout.

Connections

The interviewer may pivot to rate limiting, transaction isolation, distributed locks, outbox and saga patterns, or API versioning. Be ready to connect cursor semantics to database indexes and idempotency semantics to retries, leases, and observability.

Further reading

Practice questions

Focus area — Use this to practice contention, shard hot spots, and transactional integrity—explicit focus areas for your distributed-systems onsite.

Editorial architecture diagram showing idempotent bid requests routed by auction ID to a single-writer auction leader, then atomically persisted, materialized, and fanned out to watchers.

What's being tested

These prompts test whether you can design a real-time distributed system whose correctness depends on ordering, concurrency control, and low-latency fanout—not merely draw services and databases. You must translate ambiguous product behavior such as proxy bidding, reserve prices, buy-it-now, and soft close into explicit invariants and APIs. Meta cares because high-scale social and marketplace features require engineers to preserve user-visible correctness under contention, retries, partial failures, and regional traffic while meeting latency and availability goals.

Core knowledge
  • Requirements and scale modeling should establish auction count, bid rate, watcher fanout, regions, item duration, and latency SLOs. For example, 500k active auctions and 5M watchers imply connection management and fanout dominate storage; estimate average and peak bids separately.

  • The central invariant is that each auction has one authoritative ordered history: a bid is accepted only if valid against the latest state, and every observer sees a sequence consistent with that order. Use a per-auction monotonic sequence number, not client timestamps, to define ordering.

  • Proxy bidding stores each bidder’s maximum willingness and computes the displayed price from the highest and second-highest eligible maxima plus the minimum increment. Never expose the maximum bid; recomputation must be deterministic and atomic when two bids arrive concurrently.

  • A practical concurrency model is single-writer ownership per auction: route all commands for an auction to one partition leader or actor. This avoids distributed locks; optimistic compare-and-set can work at lower contention, while a global lock or cross-region transaction usually harms availability and latency.

  • Partition by auction_id using consistent hashing or a durable log partition key. Keep all bid mutations for one auction together, but do not assume one partition can handle every hot auction; isolate celebrity or flash-sale auctions and apply bounded admission control.

  • Use an append-only event log for accepted bids and state transitions, plus a materialized current-state view for reads. Events support replay and auditability; snapshots prevent replaying millions of bids. Persist the winning decision before emitting “you won” notifications.

  • Idempotency is required because clients and gateways retry. Require a client-generated bid_id or idempotency key, deduplicate it per bidder and auction, and return the original result. A timeout must not cause a second accepted bid or a second charge.

  • Separate the command path from the read/fanout path. The command service validates and orders bids; a stream processor updates read models; WebSockets or server-sent events push updates. Pushes may be duplicated or delayed, so clients must reconcile using sequence numbers and fetch current state.

  • Soft close extends an auction when a qualifying bid arrives near expiration. Define whether the extension is based on server receipt time or committed sequence time, make the deadline update part of the same serialized state transition, and use server time to prevent client-clock manipulation.

  • Choose consistency intentionally: bid acceptance and winner selection require linearizable behavior per auction, while watch counts, search indexes, and historical analytics can be eventually consistent. Cross-region active-active writes complicate ordering; prefer a home region or explicitly tolerate failover fencing and brief write unavailability.

  • API design should include CreateAuction, PlaceBid, GetAuction, and a watch subscription. PlaceBid should return accepted/rejected status, authoritative sequence, current displayed price, deadline, and reason; validate auction status, seller ownership, currency, increment, reserve, and buy-it-now rules server-side.

  • Backpressure and failure handling matter more than a nominal throughput number. Bound queues, reject or shed noncritical notifications before bid commands, use timeouts and circuit breakers, and monitor p99 bid-to-ack latency, rejected bids, duplicate rate, lag, connection count, and disagreement between projected state and replayed state.

Worked example

For “Design an online auction platform”, I would first clarify whether proxy bidding, reserve prices, buy-it-now, soft close, payments, and global bidding are required, then declare a target such as 500k active auctions, 5M watchers, and a p99 bid-to-UI latency target. I would organize the answer around four pillars: auction and bid data models, per-auction ordering and concurrency, durable persistence with recovery, and real-time read fanout. Each auction would have a single logical writer selected by auction_id, with an idempotent bid command producing an ordered event and updated materialized state. A partitioned event stream and snapshots would support replay, while WebSockets would distribute updates carrying sequence numbers. I would explicitly choose a home region per auction rather than pretend that multi-region active-active writes can provide simple global ordering. I would explain failover fencing so an old leader cannot continue accepting bids after ownership changes. I would close by saying that, with more time, I would detail payment authorization, fraud controls, load testing for hot auctions, and a rollout plan with shadow event processing.

A second angle

For “Design an online auction system”, the interviewer may emphasize API design, throughput estimation, and partitioning rather than the richer marketplace feature set. The same per-auction serialization principle still applies, but the discussion should begin with traffic math and the boundary between synchronous bid acceptance and asynchronous notification. A useful contrast is that reads can be served from replicated materialized views, while writes must be routed to the auction’s owner. I would also discuss how a hot auction can violate otherwise reasonable partition assumptions and require dedicated capacity or admission control. The answer should preserve correctness even if real-time delivery is delayed, since clients can recover through sequence-aware reads.

Common pitfalls

Pitfall: Treating “latest timestamp wins” as ordering is analytically wrong. Clock skew and simultaneous requests make timestamps unsafe; define order at the serialized server or partition owner and return that authoritative sequence.

Pitfall: Jumping directly to Kafka, Redis, and WebSockets without stating invariants makes the design sound like a technology inventory. Explain what each component guarantees, what can be stale, and which operation is the source of truth.

Pitfall: Saying “use a distributed lock” for every bid avoids the hard concurrency question. A stronger answer compares per-auction single-writer routing, optimistic version checks, and lock-based coordination, then explains contention, failure recovery, and fencing for the selected approach.

Connections

The interviewer may pivot to leader election, exactly-once effects versus at-least-once delivery, event sourcing, or WebSocket connection scaling. Be prepared to discuss payment idempotency, cache invalidation, hot-key mitigation, and disaster recovery without weakening the per-auction ordering invariant.

Further reading

Practice questions

Focus area — Seat holds stress TTLs, idempotency, and double-booking prevention, matching your new transaction/concurrency-control ratings.

Editorial architecture diagram showing an idempotent ticket reservation flow from client through inventory, payment, Postgres, Kafka cleanup, and reconciliation, with seat state transitions.

What's being tested

These designs test distributed-systems correctness under concurrent requests: preventing double-booking while seats transition through available, held, paid, cancelled, and expired states. The interviewer is probing whether you can define clear consistency guarantees, model expiration and retries, and choose a storage strategy that remains correct during failures and high contention. Meta cares because reservation systems concentrate traffic on a small set of hot resources, making race conditions, idempotency, and graceful degradation more important than simply drawing a scalable architecture.

Core knowledge
  • Model booking as an explicit state machine: AVAILABLE → HELD → CONFIRMED, with HELD → AVAILABLE on expiry or cancellation. Reject illegal transitions such as CONFIRMED → AVAILABLE; enforce transitions in one authoritative service.

  • Use optimistic concurrency control with a version or conditional update: UPDATE seats SET status='HELD', version=version+1 WHERE event_id=? AND seat_id=? AND status='AVAILABLE'. Success means one writer won; zero rows means conflict.

  • For a small, fixed seat map, store one row per seat in Postgres or MySQL and update selected rows transactionally. SELECT ... FOR UPDATE is straightforward but can reduce throughput; conditional writes usually hold locks for less time.

  • A hold needs hold_id, user_id, selected inventory, created_at, expires_at, and an idempotency key. Treat expires_at as authoritative rather than trusting a background worker to release inventory exactly on time.

  • Implement expiration with both lazy expiration and asynchronous cleanup. Reads and booking attempts treat expires_at <= now as expired; a Kafka-backed worker or delayed queue later changes rows to AVAILABLE for storage hygiene.

  • Make every mutating API idempotent: persist (user_id, idempotency_key) → response and return the original result on retry. Include hold_id or payment_id in downstream commands so retries cannot create duplicate reservations.

  • Keep payment outside the inventory transaction, because payment providers are slow and can fail independently. The usual flow is AVAILABLE → HELD → payment authorization → CONFIRMED; reconciliation handles payment success arriving after a client timeout.

  • Choose inventory granularity based on contention. Assigned seats require per-seat ownership; general admission can use an atomic counter where available_count >= quantity, but counters must not drift from orders and need reconciliation.

  • A single-writer partition per event or venue can serialize conflicting seat operations and simplify correctness. It improves reasoning but creates hot partitions; shard large events by section or seat range while preserving a clear ownership rule.

  • Define failure semantics explicitly: if the hold response is lost, the client retries with the same key; if the database commits but the event is not published, an outbox pattern publishes the durable state change later.

  • Avoid treating Redis alone as the source of truth unless its durability and failover semantics meet the requirement. Redis locks can reduce duplicate work, but correctness should come from a transactional or conditionally consistent inventory store.

  • Size the system from peak contention, not average traffic. If an event has SS seats and peak arrival rate λ\lambda, the useful booking throughput is bounded by inventory mutations and hot-partition capacity, not merely by stateless API replicas.

Worked example: Design a ticket or hotel reservation system

For Design a ticket or hotel reservation system, I would first clarify whether seats are assigned, whether users may hold multiple seats, the hold duration, oversell tolerance, payment timing, and whether correctness or availability dominates during a partition. I would declare an assumption such as assigned seats, a five-minute hold, no overselling, and eventual notifications but strongly consistent inventory. I would organize the answer around the inventory data model, the hold/confirmation state machine, concurrency control, and expiration plus payment failure handling. The core write would conditionally transition each requested seat from AVAILABLE to HELD in a transaction, recording a durable hold_id and expires_at. I would explicitly choose a relational database for the authoritative seat rows because transactional conditional updates are easier to prove correct than a cache-based lock. I would then add stateless APIs, read replicas or cached availability for browsing, and idempotency records for retries. I would call out the tradeoff that locking all requested seats prevents partial holds but increases contention and deadlock risk, so rows should be acquired in deterministic seat order. If I had more time, I would discuss payment reconciliation, multi-region ownership, load testing hot events, and operational metrics such as hold conflicts and expiration lag.

A second angle

For Design Ticket Booking Auto Release, the central challenge shifts from initial allocation to reliable expiration without depending on a perfectly timed scheduler. The design should combine request-time validation of expires_at with an asynchronous release worker, making cleanup delay harmless to correctness. I would discuss duplicate release messages, worker crashes, clock skew, and idempotent state transitions. A useful guarantee is that expired inventory is never sold twice, while temporary database residue is acceptable until cleanup catches up.

Common pitfalls

Pitfall: Treating a Redis lock or a periodic cleanup job as the correctness mechanism is analytically weak. A stronger answer makes the inventory database enforce the invariant and treats locks and cleanup as performance or hygiene tools.

A common communication mistake is jumping directly into Kafka, sharding, and multi-region replication without stating the booking invariant. Say first, “No seat may be confirmed for two customers,” then explain which operation atomically protects that invariant.

Pitfall: Saying “the hold expires after five minutes” without defining who observes expiration misses the hard case. Explain client retries, worker delay, clock differences, payment callbacks, and the exact legal state transitions.

Connections

The interviewer may pivot to idempotency, outbox and saga patterns, leader election, partition tolerance, or multi-region data ownership. They may also ask how to test race conditions with concurrent clients, fault injection, and invariant-based assertions.

Further reading

Practice questions

Online Assessment — 15 min

Coding & Algorithms

Focus area — Your selected in-memory API/database topics and new TTL/cache ratings make this a high-yield OA/screen data-structure design area.

Editorial node diagram showing nested key-field maps, absolute TTL expiry, timestamped version history, lazy reads, and deep-copy snapshot restore.

What's being tested

These problems test designing an in-memory key–field–value store with deterministic TTL expiration, historical reads, ordered/prefix scans, and snapshot/restore semantics. You must choose data structures that separate current state from version history while preserving clear time-complexity guarantees and atomic compare-and-set/delete behavior.

Patterns & templates
  • Nested hash maps — db[key][field] gives expected O(1) current reads and writes; store value, write timestamp, and absolute expiry together.
  • Absolute expiration timestamps — compute expires_at = now + ttl; treat an entry as expired when read_time >= expires_at, including boundary behavior explicitly.
  • Lazy expiration — remove expired records during get, scan, and history; avoid background cleanup unless requirements demand memory reclamation guarantees.
  • Version history — maintain timestamp-ordered records per key-field; binary search the latest version with timestamp <= read_time, typically O(log V).
  • Ordered and prefix scans — sort visible fields lexicographically, filter prefixes, and define whether expired entries are excluded before or after ordering.
  • Snapshot/restore — deep-copy mutable state or serialize immutable records; preserve TTL as remaining duration or recompute from absolute timestamps consistently.
  • Atomic conditional mutation — evaluate existence, value, and expiration in one operation; compare-and-set must not observe stale expired data.
Common pitfalls

Pitfall: Treating TTL as a periodic deletion requirement; unless specified, lazy expiration is simpler, but every read path must enforce it.

Pitfall: Returning the newest version instead of the newest version valid at the requested timestamp, especially when a later delete or expiry exists.

Pitfall: Shallow-copying nested maps during backup, allowing later writes to mutate the snapshot and making restore incorrect.

Practice these

The practice cards below cover the canonical variants — solve all of them and time yourself.

Practice questions

Company-Specific Topics

Frequently asked questions

What does the Meta Software Engineer interview process look like?

Based on candidate reports compiled in this guide, the Meta Software Engineer loop typically includes 3 stages: Technical Screen, Onsite, Online Assessment. Each stage covers a distinct set of topics walked through in detail above.

What topics does Meta focus on in Software Engineer interviews?

Meta Software Engineer interviews cover Coding & Algorithms, System Design. The guide above breaks each topic down into core concepts, worked examples, and the real questions candidates were asked.

Which concepts are most important for the Meta Software Engineer interview?

Focus areas for the Meta Software Engineer interview include In-Memory Key-Value Stores With TTL, Real-Time Messaging And News Feed Systems, Online Auction Systems, Ticketing And Reservation Holds. These are tagged "Focus area" in the guide above based on frequency in candidate reports.

How many real Meta Software Engineer interview questions are in this guide?

This guide is anchored to 24 real Meta Software Engineer interview questions sourced from candidate reports, each linked to a full practice page with starter code, solution discussion, and community comments.

More free, in-depth prep curated from real candidate reports.