Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. Steps:
  2.     1.
  3. Requirements clarifications
  4.  
  5.         1.
  6. URL is too long to remember, tiny URL will have ability to redirect to long URL from short URL
  7.         2.
  8. Give a long URL, encode to a shorted URL and return
  9.         3.
  10. Give a short URL, return the original long URL
  11.         4.
  12. User should be able to pick a custom short URL
  13.         5.
  14. Should have a expiration time.
  15.     2.
  16. API Design
  17.  
  18.         1.
  19. String encode(String longUrl, timestamp)
  20.         2.
  21. String decode(String shortUrl)
  22.         3.
  23. String encode(String longUrl, String shortUrl)
  24.         4.
  25. String renew(shortUrl, timestamp)
  26.     3.
  27. Volum scale Estimation
  28.  
  29.         1.
  30. The avalibilty should be 100%, once service is down, user will not able to access the link.
  31.         2.
  32. Read heavy, read vs write 100 : 1
  33.         3.
  34. Assume 10M per day, 10B per day read, 100 URL /s, 10K / s read
  35.         4.
  36. Assume we keep data for 5 years, 10M * 365 * 5 = 20B
  37.         5.
  38. Assume 1 data is 1 kb, 20 TB store
  39.         6.
  40. Bandwidth: 100 M
  41.     4.
  42. Defining Data model
  43.  
  44.         1.
  45. URL
  46.  
  47.             1.
  48. shortUrl
  49.             2.
  50. longUrl
  51.             3.
  52. createTime
  53.             4.
  54. expTime
  55.             5.
  56. userId
  57.         2.
  58. User
  59.  
  60.             1.
  61. userId
  62.             2.
  63. userName
  64.             3.
  65. lastLogin
  66.     5.
  67. High-level (Draw component)
  68.  
  69.         1.
  70. Encode- decode- storing
  71.     6.
  72. Core component detail (load balancing, data set replica).
  73.  
  74.         1.
  75. Base64Hash + sequence number
  76.         2.
  77. Generate random UUID
  78.     7.
  79. Bottlenecks,transparence, alert.
  80.  
  81.         1.
  82. DB clean up, Cache, Load Balancer,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement