← Snapchat Interview Insights

Snapchat·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
May 2026Remote

Summary

Snapchat SWE interview that went deep on networking fundamentals across three areas: real-time transport options, the OSI model, and TCP vs QUIC. The whole thing felt like a graduate networking course compressed into one session, and the follow-up questions were genuinely harder than the main ones.

Questions Asked (6)

Q1

Compare WebSocket, Server-Sent Events, and long polling for real-time web features. Cover directionality, how each connection is established, reconnection behavior, proxy and load balancer implications, and when you'd pick each one.

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

I started with directionality which was the right call, but I fumbled the SSE establishment story.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer around the three technologies, comparing them across the requested dimensions (directionality, connection establishment, reconnection, proxy/load balancer implications). Then, tie each to concrete use cases, especially those relevant to Snapchat's real-time features like messaging, presence, and live stories.

Pro tip: Demonstrate maturity by acknowledging that WebSocket is not always the answer—long polling can be simpler and more robust for low-frequency updates, and SSE is ideal for one-way streams like notifications. Also, mention that at scale, you often need a hybrid approach and must consider infrastructure support.

1. Define and contrast directionality

Explain that WebSocket is full-duplex, SSE is server-to-client only, and long polling is client-initiated request-response. This sets the foundation for use cases.

2. Describe connection establishment

Detail how WebSocket uses an HTTP upgrade handshake, SSE uses a standard HTTP request with 'text/event-stream', and long polling holds a request open until data or timeout.

3. Analyze reconnection behavior

Discuss automatic reconnection in SSE (with Last-Event-ID), manual reconnection in WebSocket, and the need to re-initiate long polling requests after each response.

4. Evaluate proxy and load balancer implications

Cover how WebSocket requires upgrade support and sticky sessions, SSE works over HTTP/1.1 but may need buffering disabled, and long polling is generally compatible but can cause overhead.

5. Choose the right tool for the job

Map each technology to scenarios: WebSocket for bidirectional real-time (chat, gaming), SSE for one-way streams (feeds, notifications), long polling for simple, low-frequency updates or legacy environments.

Key Points to Mention

  • WebSocket: full-duplex, low latency, but requires stateful connections and careful scaling.
  • SSE: unidirectional, built-in reconnection, works over HTTP/2, but limited to text and no binary support.
  • Long polling: simple, widely supported, but inefficient for high-frequency updates due to request overhead.
  • Proxy/load balancer: WebSocket needs upgrade headers and sticky sessions; SSE may be buffered by proxies; long polling can cause connection churn.
  • Reconnection: SSE has automatic retry with Last-Event-ID; WebSocket requires manual heartbeat and reconnect logic.
  • Use case fit: Snapchat could use WebSocket for chat, SSE for live story updates, and long polling for fallback or low-priority notifications.

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

Q2

Walk through all seven OSI layers, what each one is responsible for, and give a real protocol or technology example per layer. Then explain how those seven map onto the four-layer TCP/IP model and why engineers use TCP/IP in practice.

System DesignTechnical Trade-offs
Author's notes

Honestly the layers themselves were fine, I've drawn this diagram a hundred times.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by listing the seven OSI layers from top to bottom (Application to Physical), briefly explaining each layer's responsibility and giving a concrete protocol example. Then map them to the four-layer TCP/IP model (Application, Transport, Internet, Network Access) and explain why TCP/IP is preferred in practice due to its simplicity, robustness, and alignment with real-world implementations.

Pro tip: Emphasize that the OSI model is a theoretical reference, while TCP/IP is the practical standard; mention that understanding the mapping helps in debugging and designing systems, especially for a company like Snapchat that deals with real-time communication.

1. List OSI layers top-down

Enumerate the seven layers in order: Application, Presentation, Session, Transport, Network, Data Link, Physical. For each, state its primary responsibility in one sentence.

2. Provide protocol examples

For each layer, give a well-known protocol or technology: e.g., HTTP for Application, TLS for Presentation, RPC for Session, TCP for Transport, IP for Network, Ethernet for Data Link, and fiber optics for Physical.

3. Map OSI to TCP/IP

Explain that TCP/IP combines the top three OSI layers into Application, the bottom two into Network Access, and keeps Transport and Internet (Network) separate. Show the direct correspondence.

4. Explain practical preference

Discuss why engineers use TCP/IP: it's simpler, reflects actual protocol implementations, and is the foundation of the Internet. Mention that OSI remains useful as a teaching and troubleshooting tool.

Key Points to Mention

  • OSI layers: Application, Presentation, Session, Transport, Network, Data Link, Physical
  • TCP/IP layers: Application, Transport, Internet, Network Access
  • Mapping: OSI Application/Presentation/Session → TCP/IP Application; OSI Data Link/Physical → TCP/IP Network Access
  • Protocol examples: HTTP, TLS, RPC, TCP, IP, Ethernet, Fiber
  • Why TCP/IP: simplicity, real-world adoption, robustness, scalability
  • OSI as a conceptual model for troubleshooting and design

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

Q3

Compare TCP and QUIC across handshake latency, TLS integration, multiplexing, head-of-line blocking, and connection migration. Include reasons you might NOT want to use QUIC.

System DesignTechnical Trade-offs
Author's notes

The head-of-line blocking question tripped me up a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer by comparing TCP and QUIC across the five dimensions, highlighting QUIC's advantages in latency, multiplexing, and migration, but also discussing its trade-offs. Emphasize that QUIC is built on UDP and integrates TLS 1.3, which reduces handshake round trips. Conclude with scenarios where QUIC might not be ideal, showing balanced judgment.

Pro tip: Mention that while QUIC reduces latency, it can be CPU-intensive due to encryption in user space, and some networks block UDP, which is a practical deployment hurdle. This shows awareness of real-world constraints beyond theoretical benefits.

1. Handshake Latency

Compare TCP's 3-way handshake plus TLS handshake (1-2 RTTs) with QUIC's integrated handshake (0-1 RTT, with 0-RTT for repeat connections). Highlight that QUIC combines transport and crypto handshakes, reducing latency.

2. TLS Integration

Explain that TCP requires TLS as a separate layer, while QUIC integrates TLS 1.3 by default, encrypting most of the packet header. This improves security and reduces handshake overhead.

3. Multiplexing and Head-of-Line Blocking

Discuss TCP's head-of-line blocking: a lost packet blocks all streams. QUIC supports independent streams, so packet loss only affects the stream with the lost data, improving performance for multiplexed applications.

4. Connection Migration

Contrast TCP's connection tied to IP/port (breaks on network change) with QUIC's connection ID that allows seamless migration across networks (e.g., Wi-Fi to cellular), beneficial for mobile users.

5. Reasons to Avoid QUIC

List drawbacks: higher CPU usage due to user-space encryption, UDP blocking by firewalls, lack of mature tooling, and potential performance issues in high-throughput scenarios. Also, not all servers/clients support it.

Key Points to Mention

  • QUIC reduces handshake latency by combining transport and TLS handshakes, enabling 0-RTT for repeat connections.
  • QUIC integrates TLS 1.3, encrypting more of the packet and simplifying protocol stack.
  • QUIC eliminates head-of-line blocking at the transport level via independent streams.
  • QUIC supports connection migration using connection IDs, unlike TCP which relies on IP/port.
  • QUIC runs over UDP, which can be blocked by firewalls and may require fallback to TCP.
  • QUIC can be more CPU-intensive due to encryption in user space and lack of hardware offload.

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

Q4

If you have a fleet of stateless app servers and a user's WebSocket connection lives on one specific server, how do you push a message to that user from any server in the fleet?

System DesignAPI & Integrations
Author's notes

Classic fan-out problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging the core challenge: stateless servers cannot directly know which server holds a user's WebSocket connection. Then propose a pub/sub or message broker layer that decouples message producers from the specific server holding the connection, and explain how the broker routes messages to the correct server based on a connection registry.

Pro tip: Mention that you'd use a consistent hashing or a connection registry with a fast lookup (like Redis) to map user IDs to server IDs, and highlight that this design also handles server failures gracefully by re-routing or reconnecting.

1. Identify the core problem

Explain that stateless servers lack knowledge of which server holds a user's WebSocket connection, so direct push is impossible without a shared state or routing mechanism.

2. Introduce a connection registry

Propose maintaining a centralized registry (e.g., Redis) that maps user IDs to the server ID or connection ID holding their WebSocket, updated on connect/disconnect.

3. Use a pub/sub or message queue

Describe how any server can publish a message to a channel or queue, and the server holding the connection subscribes to relevant channels to receive and forward messages.

4. Route messages to the correct server

Detail the routing logic: either the publisher looks up the server in the registry and sends directly via an internal RPC, or uses a broker that delivers to the subscribed server.

5. Handle failures and scaling

Discuss how to handle server crashes (e.g., reconnection, registry cleanup) and horizontal scaling (e.g., sharding the registry, using consistent hashing).

Key Points to Mention

  • Stateless servers require external state for connection tracking
  • Connection registry (e.g., Redis) mapping user to server
  • Pub/sub system (e.g., Redis Pub/Sub, Kafka, RabbitMQ) for message distribution
  • Direct server-to-server communication via internal RPC or message broker
  • Handling server failures and reconnection logic
  • Scalability considerations: sharding, consistent hashing, and avoiding single points of failure

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

Q5

QUIC supports 0-RTT connection resumption. What security risk does that introduce and how is it addressed?

Technical Trade-offsSystem Design
Author's notes

Blanked for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that 0-RTT allows data to be sent in the first flight of a resumed connection, which introduces replay attacks. Then describe how QUIC mitigates this by making 0-RTT data idempotent and using anti-replay mechanisms like single-use tickets and client hello recording. Conclude by discussing trade-offs and practical implications for applications.

Pro tip: Emphasize that 0-RTT is only safe for idempotent requests and that servers must enforce this; mention that Snapchat likely uses 0-RTT for non-critical, idempotent operations like fetching stories, not for sending snaps.

1. Define 0-RTT and its benefit

Explain that 0-RTT reduces latency by allowing the client to send application data in the first flight of a resumed connection, eliminating a round trip.

2. Identify the security risk

State that the primary risk is replay attacks: an attacker can capture and retransmit 0-RTT data, causing the server to process the same request multiple times.

3. Explain mitigations

Describe how QUIC addresses this: 0-RTT data must be idempotent, servers use single-use session tickets, and may employ client hello recording or other anti-replay techniques.

4. Discuss trade-offs and application design

Highlight that developers must ensure 0-RTT is only used for safe operations, and that servers may reject 0-RTT data if replay is detected, falling back to 1-RTT.

Key Points to Mention

  • 0-RTT reduces latency by allowing data in the first flight.
  • Replay attacks are possible because early data can be captured and retransmitted.
  • QUIC requires 0-RTT data to be idempotent (safe to replay).
  • Servers use single-use session tickets to prevent replay.
  • Anti-replay mechanisms like client hello recording or bloom filters.
  • Trade-off: performance vs. security; not all requests are suitable for 0-RTT.

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

Q6

A corporate firewall blocks all UDP traffic. Which of WebSocket, SSE, long polling, and QUIC still work, and how does the system degrade gracefully?

Technical Trade-offsSystem Design
Author's notes

Easy one to close on.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify that UDP is blocked, so any protocol relying on UDP (like QUIC) fails immediately, while TCP-based solutions (WebSocket, SSE, long polling) can still work. Then, explain how each TCP-based option works and how a system can gracefully degrade by falling back from more efficient to less efficient transports.

Pro tip: Mention that while QUIC is UDP-based and thus blocked, some implementations can fall back to TCP, but that's not standard. Also, highlight that long polling is the most compatible fallback but has higher overhead, so it should be used only when necessary.

1. Identify UDP-dependent protocols

Determine which protocols rely on UDP. QUIC is built on UDP, so it will not work. WebSocket, SSE, and long polling typically use TCP, so they can work.

2. Explain how each TCP-based protocol works

Briefly describe WebSocket (full-duplex over TCP), SSE (server-sent events over HTTP/TCP), and long polling (repeated HTTP requests with delayed responses).

3. Discuss graceful degradation

Describe a fallback strategy: try WebSocket first, then SSE, then long polling. This ensures connectivity even if some protocols are blocked.

4. Consider performance and trade-offs

Compare latency, overhead, and scalability. WebSocket and SSE are more efficient than long polling, which has higher overhead due to repeated requests.

5. Relate to real-world systems

Mention how systems like Snapchat might implement such fallbacks to maintain real-time communication under restrictive networks.

Key Points to Mention

  • QUIC is UDP-based and thus blocked by the firewall.
  • WebSocket, SSE, and long polling use TCP and can work.
  • WebSocket provides full-duplex communication, ideal for real-time apps.
  • SSE is unidirectional (server to client) and works over HTTP.
  • Long polling is a fallback with higher latency and overhead.
  • Graceful degradation involves trying protocols in order of efficiency: WebSocket -> SSE -> long polling.

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