A URL Shortener
In this chapter, we design a URL shortener for three different systems, and we apply what the course has covered so far to each design decision.
After reading this chapter, you should be able to:
- Define URL shortener and short code, and name its two operations, shorten and follow
- State each variant’s added functional requirements, quality attributes, and requirements for short codes
- Estimate requests per second, the read-to-write ratio, and storage per year from daily numbers
- Explain why following a link must be a REST endpoint, and choose between
301and302redirects - Compare relational, document, and key-value databases for the links, and justify a choice
- Use the hit ratio to decide which variants need a cache
- Explain how invalidation and expiry stop a blocked link from redirecting
- Decide which variants need replicas, for reads, for failover, or both
- Classify following, creating, and turning off a link as CP or AP during a network partition
- Explain why routing by a hash of the code fits the links better than a directory, and what it gives up
- Compare ways to generate short codes, and choose one for each variant