System Design 之 Tiny Uri

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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章