Thursday, October 11, 2018

System design - educative 笔记

Tiny URL

key实现的方法
  1. encoding
  2. 提前把key都生成

Data partition:
  1. Range based
  2. Hash based
Caching, and pruning

------------------

Designing Pastebin, 非常类似tinyUrl

-------------------------
Designing Instagram

Photo storage, object storage

News feed, pulling / pushing model


--------------------
Designing Dropbox

Divide file into chunks, transmit less data during synchronization 

local client: long polling to the server to check changes

Updates are frequent, use queue between server and client

only transmitting the diff between files

先传data,再更新metadata

2种dedup的方法

metadata partition的方法

--------------
Designing Facebook Messenger

request/response workflow要看看

每个client都long pulling的话,一共得开多少个socket

保证message的顺序:server端的timestamp + client本地加sequence

用wild column data, hbase。 为什么要用这个?

用户的online/offline status的处理,client pull partial users

Push notification when a user is off

------------------
Designing Twitter

Data sharding - 用timestamp和tweetid的组合, 如何解决?

Cache last 3 days of tweets for one user

---------------
Designing Youtube or Netflix

thumbnail 的读写

processing queue for uploading and encoding videos