← stubhub Interview Insights

stubhub·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

StubHub system design round focused entirely on building a real-time internal chat platform, plus a bonus workflow question about re-engaging inactive users via email. Pretty dense for a single session but the scope made sense given the role.

Questions Asked (4)

Q1

Design an internal chat system for an event marketplace company that supports real-time one-to-one messaging, persistent WebSocket connections, presence tracking, and conversation history.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

I started with the WebSocket layer and worked outward, which felt right but I spent too long on connection management before touching storage.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale (e.g., number of concurrent users, message volume, latency needs), then sketch a high-level architecture covering WebSocket management, message flow, presence, and storage. Dive into key components like connection servers, message queues, and databases, discussing trade-offs and failure handling.

Pro tip: Emphasize idempotency and message ordering—use client-generated message IDs and server-side sequencing to handle retries and ensure consistency. Also, discuss how to scale WebSocket connections horizontally with a pub/sub layer like Redis or Kafka.

1. Clarify Requirements and Scale

Ask about expected user count, concurrent connections, message throughput, latency requirements, and whether messages need to be persisted indefinitely. This shapes your design choices.

2. High-Level Architecture

Outline the main components: WebSocket servers for real-time communication, a message queue for decoupling, a database for conversation history, and a presence service. Explain how they interact.

3. Deep Dive into Key Components

Detail WebSocket connection management (load balancing, heartbeats), message delivery guarantees (at-least-once, ordering), presence tracking (using Redis with TTL), and storage schema (e.g., Cassandra for messages).

4. Address Trade-offs and Scalability

Discuss trade-offs like consistency vs. availability, push vs. pull for presence, and scaling WebSocket servers horizontally with a pub/sub system. Mention how to handle reconnections and missed messages.

5. Summarize and Wrap Up

Recap the design, highlighting how it meets requirements and handles failures. Be open to feedback and suggest potential improvements or next steps.

Key Points to Mention

  • WebSocket connection management: load balancing, sticky sessions, heartbeats, and reconnection strategies.
  • Message delivery: idempotency, ordering, at-least-once delivery, and offline message storage.
  • Presence tracking: using Redis with TTL, pub/sub for status updates, and handling flapping connections.
  • Storage: choosing a database for conversation history (e.g., Cassandra for write-heavy workloads), indexing for efficient retrieval.
  • Scalability: horizontal scaling of WebSocket servers, using a message broker (e.g., Kafka) for inter-server communication.
  • Security: authentication, authorization, and encryption for WebSocket connections and message storage.

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

Q2

How would you handle message delivery for offline users, and what storage approach would you use for chat history?

System DesignData ModelingTechnical Trade-offs
Author's notes

Talked about a message queue with a delivery status flag and falling back to push notification or inbox retrieval on reconnect.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: scale, latency, consistency, and offline duration. Then propose a hybrid approach: use a message queue for reliable delivery and a combination of caching and persistent storage for chat history, with a focus on trade-offs between consistency and availability.

Pro tip: Mention that offline delivery is not just about storing messages but also about syncing state when the user reconnects, and that you'd use a push notification service to alert the user of new messages.

1. Clarify Requirements

Ask about expected scale (users, messages per second), offline duration, and consistency requirements (e.g., read receipts, ordering).

2. Design Delivery Mechanism

Propose a message queue (e.g., Kafka, RabbitMQ) to handle asynchronous delivery, with per-user queues and retry logic. Use push notifications for offline users.

3. Choose Storage for Chat History

Suggest a combination of a fast cache (Redis) for recent messages and a durable database (Cassandra, DynamoDB) for long-term storage, considering write-heavy workload.

4. Handle Synchronization

Design a sync protocol: when user comes online, fetch missed messages using a timestamp or sequence number, and update read status.

5. Discuss Trade-offs

Compare consistency vs. availability (CAP theorem), cost, and complexity. Justify choices based on requirements.

Key Points to Mention

  • Message queues for reliable asynchronous delivery
  • Push notifications (APNS, FCM) to alert offline users
  • Hybrid storage: Redis for recent messages, Cassandra for history
  • Data modeling: partition by user or conversation, use time-series or wide-column store
  • Sync mechanism: sequence numbers or timestamps to fetch missed messages
  • Trade-offs: consistency vs. availability, latency vs. durability, cost

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

Q3

Walk through how bidirectional WebSocket communication gets routed across multiple servers when the sender and recipient are connected to different nodes.

System DesignTechnical Trade-offs
Author's notes

This was the core of the whole question really.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the need for a shared registry that maps user IDs to server nodes, then describe how messages are routed between nodes using a pub/sub or message queue system. Finally, discuss trade-offs like latency, scalability, and failure handling.

Pro tip: Mention that you would use consistent hashing to minimize reconnections when scaling, and highlight the importance of idempotent message delivery to handle duplicate messages.

1. Establish Connection and Registration

When a client connects via WebSocket, the server registers the user's ID and its own node ID in a shared registry (e.g., Redis or a database). This mapping is used to locate the user later.

2. Message Routing via Pub/Sub

When a sender sends a message to a recipient on another node, the sender's node publishes the message to a channel or queue that the recipient's node subscribes to. The recipient's node then delivers the message over the existing WebSocket connection.

3. Handling Node Failures and Reconnections

If a node fails, the registry entries for its users must be updated, and clients should reconnect to other nodes. Use heartbeats and timeouts to detect failures and trigger re-registration.

4. Scaling and Load Balancing

Use consistent hashing to distribute users across nodes and minimize reconnections when adding/removing nodes. Load balancers can route initial WebSocket connections to available nodes.

5. Discuss Trade-offs

Compare approaches: direct node-to-node communication vs. message broker (e.g., Redis Pub/Sub, Kafka). Consider latency, reliability, complexity, and scalability.

Key Points to Mention

  • Shared registry for user-to-node mapping (e.g., Redis, etcd)
  • Pub/Sub or message queue for inter-node communication (e.g., Redis Pub/Sub, RabbitMQ, Kafka)
  • Consistent hashing for scalability and minimal reconnections
  • Heartbeats and failure detection for node health
  • Idempotent message delivery and deduplication
  • Trade-offs: latency vs. reliability, complexity vs. scalability

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

Q4

Within the same platform, design a workflow that automatically sends an email to customers who haven't logged in for 10 days.

System DesignAPI & Integrations
Author's notes

Came at the end and felt like a curveball after all the WebSocket depth.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a decoupled, event-driven architecture using a scheduler, a rules engine, and a notification service. Focus on reliability, idempotency, and scalability while discussing trade-offs and monitoring.

Pro tip: Emphasize idempotency and failure handling—ensure emails aren't sent multiple times if the job retries, and consider using a distributed lock or a deduplication store. Also, mention the importance of tracking email engagement and allowing opt-outs to comply with regulations like CAN-SPAM.

1. Clarify Requirements and Scale

Ask about expected user volume, email frequency, and any existing infrastructure. Confirm that '10 days' is a rolling window and that emails should be sent only once per inactivity period.

2. Design Data Model and Query

Identify how to efficiently find users who haven't logged in for 10 days. Propose an index on last_login_at and a query that runs periodically, or a change-data-capture approach if near-real-time is needed.

3. Architect the Workflow

Outline a scheduled job (e.g., cron or cloud scheduler) that triggers a service to query eligible users, enqueue email tasks, and invoke an email service. Use a message queue to decouple and handle retries.

4. Ensure Reliability and Idempotency

Describe how to prevent duplicate emails: use a unique constraint on (user_id, campaign_id) or a distributed lock. Implement retry logic with exponential backoff and dead-letter queues for failures.

5. Monitor and Iterate

Discuss monitoring metrics (emails sent, failures, latency) and logging. Suggest A/B testing email content and tracking open rates to optimize engagement.

Key Points to Mention

  • Use of a scheduler (e.g., cron, Airflow, Cloud Scheduler) to trigger the workflow periodically.
  • Efficient querying with database indexes on last_login_at to avoid full table scans.
  • Decoupling via message queue (e.g., RabbitMQ, Kafka, SQS) for scalability and fault tolerance.
  • Idempotency mechanisms to prevent duplicate emails, such as unique constraints or deduplication keys.
  • Retry and error handling with exponential backoff and dead-letter queues.
  • Compliance with email regulations (CAN-SPAM, GDPR) including unsubscribe links and user preferences.

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