Design a URL Shortening Service
Last updated: April 15, 2026
Quick Overview
Design a real-time url shortening system that handles millions of requests. Discuss trade-offs in consistency, availability, and performance.
Cruise
April 15, 20262
9
1,169 solved
Design a real-time url shortening system that handles millions of requests. Discuss trade-offs in consistency, availability, and performance.
ML system design at Cruise goes beyond model selection. This Onsite question evaluates your ability to design end-to-end ML pipelines, from data collection to model serving, while considering production constraints like latency and reliability.
What the Interviewer Expects
- Define clear ML objectives with appropriate loss functions and metrics
- Design a comprehensive feature engineering pipeline
- Discuss model selection with trade-offs (complexity vs interpretability vs latency)
- Plan online and offline evaluation strategies including A/B testing
- Address serving infrastructure: batch vs real-time, latency requirements
- Consider data quality, labeling strategy, and feedback loops
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How would you ensure fairness and reduce bias in the model?
- How would you run A/B tests on different model versions?
- How would you handle a 10x increase in prediction requests?
Practice a Similar Problem on Codemia
Solve a related problem with our interactive workspace, get AI feedback, and view detailed solutions.
Solve on CodemiaSample Answer
Requirements
Functional Requirements
- URL Shortening: Users can submit a long URL and receive a unique shortened URL in real time.
- Redirection: When a shortened URL is accessed, it should redirect...
Capacity Estimation
Assuming Cruise expects approximately 10 million users per month, with each user generating an average of 5 URL shortening requests:
- Total Requests: 10 million users * 5 requests = 50 million re...