http://www.zhihu.com/question/29270034?sort=created
Requirement
1. Generate short url, from long to short url
2. Recover long url, from short to long url.
3. is there lifetime of tiny url?
Could it allow duplicate entry?(Optional), for example, same long url could generate different url at different time period?
4. If as a system, what is the maximum number of request per second it can support to generate short url? (Option)
5. If as a system, what is the maximum number of short url it can store? (Option)
Problem
Solution:
Atomic Counter
Hash function
Resource
1. how to generate roughly sortable increasing id. twitter open source project snowflake.
https://github.com/twitter/snowflake
https://blog.twitter.com/2010/announcing-snowflake