Skip to content

Instantly share code, notes, and snippets.

@jianminchen
Created October 3, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/4f753f2ae88a430118101ef7befde64b to your computer and use it in GitHub Desktop.
Save jianminchen/4f753f2ae88a430118101ef7befde64b to your computer and use it in GitHub Desktop.
System design 8:00 - 8:56 AM - I am the interviewee
This editor is synced in real time with your peer.
Use it to share thoughts and resources, such as:
- Features scope
- API design
- Pseudo code for specific components
- Data model/schema
- Back-of-the-envelope calculations
- Reference links
- Link to whiteboard or diagram such as https://sketchboard.me/new
Good luck!
8:07 am - 8:37 am
website
store and share text online for a set period of time
store - text online - storage - maximize size - 10,000 charactor - 8 bytes
- 8K estimate -
shorturl -> find their pastebin-
- share URL - 8K maximum
host URL - do you maximum - 1 URL share
enter webiste - edit content -> save / edit/ save
share -> generate URL -> share
be able to save text information - database -> relation - ID
2 - 3 maximum -> new session ID - anonymous -> store use name -> new document -> URL -> content find -> LOok up and read from database-> Cache -> URL -> ID -> Text info -> Create Datetime -> IP address - Expiration for a set period of time -> Expiration time -> total time in house
check expiration - query - current / date time -> local server -> PST
- expired
- expired - storage -afford them ->
- expiration -> hour/ a day/ week/ month/ 3months - checkbox - default
USE cases - pastebin
http://pastbin/binID
client - web server -> cache -> database -> data store
scable - billions - store billions of content - quantity
8 bit - 256 choice
char - two bytes
special -> up to 8 bytes
maximumize size - 10,000 char/ each 8 bytes - each storage 10K * 8 = 80 K
- large file - allowable -> reponse time - a few minutes
time period/ 1000/ second -> 1000 relate to twitter/ instagram -
80 K * 1000/ second = 80MB/ second
1 minutes -> 60
1 hour -> 60
1 day -> 24
1 month -> 30
--------------------------
storage : 80MB * 60 * 60 * 24 * 30 -> estimation: 4800* 1200 * 30 = 4800 * 3600 = 20,000,000 MB -> 20 Terabtye
experid time -> month
20 Terabyes -> Large distributed system -> binary -> data compression - binary format -> save 20% to 30% size
Data model/ schema
High level
focus - 1 write -> 10 shares, 100 shares -> highly reable - availble - CAP - consist availble - Partion failure
write/ second
read/ second
maintain - cache
client -> Load balancer -> multiple webserver -> API server, Read API, Write API -> Cache server -> data storage -> data store, relational data, KV store
http ->protocol
Read - available -
Write - change - > get old version -> one time -
-> Read, write
-> Message queue -> two queues -> read, write -> balance 100 time read/ Queue - Kafka, AMAZON -
more ideas... read/ write - send email -> link -> set timeout 10 minutes/
API - estimation -> complete
-> Read servers -
-> write servers ->
data center/ same copy of data store -> CDC -> coordation -> database replication - sharding ->simple table -> too many rows ->
handle -> shard ->less used, more used -> share -> bottle neck -> expiration Time, location, size -> cache -> 20% -> more cache
cache hit rate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment