Please enable JavaScript.
Coggle requires JavaScript to display documents.
System Design - Coggle Diagram
System Design
(HIGH LEVEL DESIGN)HLD
-
-
-
-
-
DISTRIBUTED SYSTEMS
Partitioning of the system to avoid fault tolerance and increase the response time by installing local servers in the places where you get most business from
LOAD BALANCING
Transfers load to all the distributed system such that it minimizes response time for the user and also making the system fault tolerant
-
-
-
HLD vs LLD
High Level Design includes deploying of servers, vertical horizontal scaling of servers, load balancing, microservices etc.
Low Level Design includes more code part breaking the code into classes designing the class and object architecture for an application etc.
LOAD BALANCING
Load Balancing is the process of managing and dividing the requests generated by multiple users to different servers so as to divide the load of the requests equally to all the available servers
-
In consistent hashing, we hash every request id and accordingly sends to the particular server
MESSAGE/TASK QUEUE
Message or Task Queue acts as a notifier which checks the condition of servers every 5 to secs by sending some request and getting the acknowledgement from the servers. It uses some kind of Heart Beat Mechanism to do this.
If any of the server does not send back any acknowledgement to the queue then the server might be crashed so it transfers all its load to other servers from the database
-
DATABASE SHARDING
-
-
HORIZONTAL PARTITIONING -> It uses a key to break data into pieces & allocate it to different servers. It depends on one key which is an attribute of the data which you are storing
Servers here are DB servers so Consistency & Availability are the most imp things here. However, Consistency is preferred over Availability
PROBLEMS IN DB SHARDING
Joins across shards (Query goes to 2 diff shards, pulls out data from each shard & join the data over the network). This whole process is very expensive and time consuming
Fixed no of shards are there, can't have dynamic number of shards. However, this problem can be solved by using consistent hashing algo which is used by MEMCACHED
BEST PRACTISES
-
INDEXING within a shard, it can be done on a complete diff attribute to which sharding is done
-
Tough to implement sharding for new and smaller DBs as consistency is very imp here. Should go for options like INDEXING and NOSQL