should handle lots of data
List non-functional requirements for the system...
1 trillion shortened urls
create alias
look up alias
Add a tablel
short_to_full
shortended url -> full length url
full_to_short
full url-> short url
create requests will flow into and be written to the casanada db. We'll use Casandra's db trasnaction feature to write to both the full to short table and the inverse. If a tiny url alreayd exists for the url in question, we'll jus treturn that to avoid duplicates
On read requests, we'll look up the short url in the short url to full table and then issue a redirect to the full url.
The Casandara trasaction will ensure that teh 2 tables are eventualy consistent. Using casandra will allow the system to scale horizonally.
A no sql db is harder to work with than using a relational db, but it will scale much better.
The casandra transaction is evetnualy consistent, so it's pposible the tables wont' be in sync for a a berife periold of time. We could create duplcate mappings for a given url if that happens.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?