Requirements
Every variant has the same two functional requirements:
- Given a long URL, the system must create a short URL for it.
- When a browser requests a short URL, the system must redirect it to the long URL.
Each variant adds requirements beyond these two. Most of them are about what happens after a link exists, such as who can block a link or turn it off, change its target, or list it.
Functional requirements
t.co. X screens links for spam and malicious sites. When X finds a harmful site, it must be able to block every link to that site. This includes links in posts that are already published.
Drive. The owner of a document can turn its short link off, and turn it back on later. The code stays the same when the link is turned back on. So a link the owner already sent in an email works again.
O’Reilly. Staff can change where a link points. A printed book cannot change, so when a resource moves to a new URL, staff change the link’s target instead. Staff can also list a book’s links. They use the list to check the links before a new printing.
Quality attributes
t.co. Every short link in every variant goes through our server before the browser reaches the site. What is different for t.co is that X wraps every link on the platform, and users cannot opt out. So every link click on X goes through our server. That is why two quality attributes matter most for t.co:
- Availability: if
t.cois down, no link on X works. - Performance: the time our server takes to send the redirect is added to every link click on X. We set a target of 50 milliseconds.
There is also a requirement on blocking: a blocked link must stop redirecting within minutes during normal operation. During a network partition, we prioritize keeping links available, so a block may take longer to reach every replica.
Drive. Two quality attributes matter most:
- A link that is turned off must stop working within seconds.
- Codes must not be guessable. Many documents are shared with “anyone with the link”. If someone guesses a code, they can open that document.
O’Reilly. A book can stay in print for years. Every link must keep working for that long. A code is never reused for a different URL.
Constraints
t.co and Drive run on their company’s existing infrastructure. O’Reilly’s shortener is run by a small team on a small budget.
Requirements for short codes
Every code must be unique, and it maps to one long URL. Beyond that, each variant has its own requirement:
t.co: short, and generated at a high rate.- Drive: hard to guess.
- O’Reilly: easy to type from paper, with no characters that look alike, such as
0andO, or1andl.