Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Steps:
- 1.
- Requirements clarifications
- 1.
- URL is too long to remember, tiny URL will have ability to redirect to long URL from short URL
- 2.
- Give a long URL, encode to a shorted URL and return
- 3.
- Give a short URL, return the original long URL
- 4.
- User should be able to pick a custom short URL
- 5.
- Should have a expiration time.
- 2.
- API Design
- 1.
- String encode(String longUrl, timestamp)
- 2.
- String decode(String shortUrl)
- 3.
- String encode(String longUrl, String shortUrl)
- 4.
- String renew(shortUrl, timestamp)
- 3.
- Volum scale Estimation
- 1.
- The avalibilty should be 100%, once service is down, user will not able to access the link.
- 2.
- Read heavy, read vs write 100 : 1
- 3.
- Assume 10M per day, 10B per day read, 100 URL /s, 10K / s read
- 4.
- Assume we keep data for 5 years, 10M * 365 * 5 = 20B
- 5.
- Assume 1 data is 1 kb, 20 TB store
- 6.
- Bandwidth: 100 M
- 4.
- Defining Data model
- 1.
- URL
- 1.
- shortUrl
- 2.
- longUrl
- 3.
- createTime
- 4.
- expTime
- 5.
- userId
- 2.
- User
- 1.
- userId
- 2.
- userName
- 3.
- lastLogin
- 5.
- High-level (Draw component)
- 1.
- Encode- decode- storing
- 6.
- Core component detail (load balancing, data set replica).
- 1.
- Base64Hash + sequence number
- 2.
- Generate random UUID
- 7.
- Bottlenecks,transparence, alert.
- 1.
- DB clean up, Cache, Load Balancer,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement