Please enable JavaScript.
Coggle requires JavaScript to display documents.
SystemDesign (Scale Pizza parlour (Should same manager manage delivery…
SystemDesign
Scale Pizza parlour
-
Chef calls sick one day
Hire backup chef
-
Master-slave
Write into master first.
Read from any slave.
If master goes down, then slaves choose a master among themselves
Avoid single point of failure, and keep backups
-
You have 10 chefs, 3 are expert at making garlic bread, and 7 at pizza
You make 3 chef teams, 2 for pizza and 1 for garlic bread
Route all garlic bread requests to garllic bread team, and distribute pizza requests to pizza team
-
-
-
-
-
-
Single point of failure
-
Add backup for DB, Master Slave
Add another region of entire system, for disaster
Data Model
Storage, Transportation, Encryption, Partitioning
Sql VS NoSql
NoSql Types
HDFS: Good for Big Files, like Youtube videos.
Bigtable: Reading small amount of data, like Youtube thumbnails.
Cassandra: Wide column database, the names and format of the columns can vary from row to row in the same table
Instagram: User & Photos, Users and Followers relationship.
ACID
Atomicity: All or nothing.
Consistency: Only valid data must be saved.
Isolation: Independently processed, without interference, does not ensure the order of transaction.
Durability: Written Data can not be lost.
Message Queues
Many pizza shops accepting orders will need
1.Way to figure if a shop is still active.
- Persist which order is being processed by which shop.
- Reassign in case a pizza shop is down, without duplication
-
Architechure
Monolith
-
-
-
-
- small change needs entire system deployment
-
NoSQL
RDBMS
-
Has no way to de-normalise, what is a column is pointing to entry in another table?
Join is expensive
Adding column is expensive, needs lock on table
NoSQL
-
-
-
- not built for too many updates
Consistency is an issue, ACID is not gauranteed
-
-
- Joins are costly, and there is no inherent relation built
-
Estimation
Scale, Storage, Bandwidth
-
Detailed Design
Trade-offs, Optimizations
-
-
Load balancing
If we can use hashing on userid in such a way,
That same user lands on same server everytime.
-
-
-
-
-
-