Review getEvents endpoint for performance, scalability, security
Company: StubHub
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
You are given a code snippet that implements an HTTP GET /events handler (getEvents). Perform a thorough code review and identify issues across three areas:
(
1) Performance: look for N+1 queries, missing pagination/limits, inefficient sorting/filtering, lack of proper indexes, excessive serialization, uncompressed/unpaginated payloads, and missing caching or ETags.
(
2) Scalability: evaluate statelessness, concurrency handling, connection pooling, batching, backpressure, timeouts/retries with jitter, circuit breakers, rate limiting, and dependency fan-out (e.g., multiple downstream calls per request).
(
3) Security: verify authentication and fine-grained authorization, input validation and SQL/NoSQL injection prevention, output encoding, sensitive data exposure (PII), TLS requirements, CSRF/IDOR risks, logging redaction, and resource quotas to prevent abuse. Propose concrete fixes, monitoring/alerting metrics and SLOs, and targeted tests (unit, integration, load, and security) to validate your recommendations. Explain trade-offs for each change.
Quick Answer: This question evaluates backend system-design and API engineering skills, focusing on performance analysis, scalability considerations, and application security through a code-review lens for a REST GET /events endpoint (System Design domain).