当前位置: 代码迷 >> 综合 >> System Design 之 Tiny Uri
  详细解决方案

System Design 之 Tiny Uri

热度:53   发布时间:2024-01-04 07:35:59.0

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



  相关解决方案