← stubhub Interview Insights

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

Senior
May 2026

Summary

StubHub software engineering interview with a deep code review question on an HTTP events endpoint. Single question but it covered a ton of ground, basically a system design and architecture review rolled into one.

Questions Asked (1)

Q1

You're given a GET /events handler that queries a database and lazily loads related data per event in a loop. Do a thorough code review covering readability and architecture, performance, scalability, and security. Propose concrete fixes for each area, define HTTP status code semantics, and outline a monitoring and test plan.

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

This one sprawled in a way I wasn't totally ready for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer around the four review areas—readability/architecture, performance, scalability, and security—then propose concrete fixes for each, define proper HTTP status code semantics, and finish with a monitoring and test plan. Emphasize the N+1 query problem as the central performance issue and show how to fix it with eager loading or batching.

Pro tip: Quantify the impact: explain how the N+1 pattern turns one query into N+1 queries, and estimate the latency and database load reduction from batching. This shows you think in terms of real-world metrics, not just theory.

1. Identify the core issue

Recognize that lazy loading related data per event in a loop causes the N+1 query problem, leading to excessive database round trips and poor performance.

2. Review readability and architecture

Suggest separating concerns: move data access to a repository/service layer, use clear naming, and avoid mixing query logic with HTTP handling.

3. Propose performance and scalability fixes

Recommend eager loading (e.g., JOINs or IN queries), batching, caching, pagination, and possibly async processing to handle high load.

4. Address security concerns

Ensure input validation, parameterized queries to prevent SQL injection, proper authentication/authorization, and rate limiting.

5. Define HTTP semantics and monitoring/testing

Specify correct status codes (200, 400, 401, 403, 404, 500) and outline logging, metrics, tracing, unit/integration/load tests.

Key Points to Mention

  • N+1 query problem and its impact on database load and latency
  • Eager loading vs. lazy loading; using JOINs or IN clauses to batch fetch related data
  • Pagination and caching strategies for scalability
  • Input validation, parameterized queries, and authentication/authorization for security
  • HTTP status code semantics: 200 OK, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error
  • Monitoring with metrics (latency, error rates), logging, tracing, and a test plan including unit, integration, and load tests

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