Design: URL Shortener — Concept Check
Questions on Design: URL Shortener. A URL shortener (like bit.ly) maps long URLs to short codes, stores the mapping in a database, and redirects users from the short URL to the original. Key challenges include unique ID generation, high-read throughput, and analytics.
Questions in this quiz
7 questions on Design: URL Shortener — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A URL shortener service is experiencing high latency during redirects. The cache hit rate is 60%. What is a likely cause?
- ACache is not storing popular URLs effectively
- BDatabase is not sharded properly
- CBase62 encoding is inefficient
- DShort code collisions are frequent
2.A developer implements a URL shortener using random 7-character strings for short codes. What must they ensure?
- AShort codes are longer than 10 characters
- BShort codes are unique by checking the database
- CShort codes are stored in a flat file
- DShort codes are generated sequentially
3.Why might a URL shortener prefer Base62 encoding of an auto-increment ID over random generation?
- ABase62 encoding supports more URLs
- BBase62 encoding generates shorter URLs
- CBase62 encoding is faster than random generation
- DBase62 encoding avoids collisions without checks
4.A URL shortener service sees a spike in traffic and the database becomes a bottleneck. What is a potential solution?
- AIncrease cache capacity to handle more reads
- BImplement synchronous analytics processing
- CUse longer short codes to reduce collisions
- DSwitch to a SQL database for better performance
5.A URL shortener stores 100M new URLs monthly. How long can a 7-character Base62 code last?
- AApproximately 10 years
- BApproximately 1 year
- CApproximately 100 years
- DApproximately 3000 years
6.A URL shortener uses Redis for caching. What is the main benefit during high traffic?
- AReduced database read load
- BIncreased write capacity
- CElimination of short code collisions
- DSimplified analytics processing
7.What is the primary role of the redirect service in a URL shortener architecture?
- AGenerate short codes for new URLs
- BHandle HTTP redirects to the original URL
- CStore analytics data for each click
- DManage the database connections