System Design

Load balancer

  • Does only routing and no computing. Hence, it can handle higher traffic. 
  • To avoid single point of failure, have a standby routing server. Standby comes into picture only when main server goes down.
  • Assign the same static IP to passive Standby server.
  • Modern systems can route 1M requests per sec

Managing large datasets

  1. Vertical scaling - Increasing capacity of server
  2. Functional Scaling - 
    1. Split data logically like users, purchasing.. 
    2. Microservices share data to other apis
    3. Implemented at Application layer
  3. Horizontal scaling
    1. Also called as Sharding
    2. Split and store single logical database over multiple servers called data nodes
    3. Can be implemented at Application layer or DB layer
Consistent Hashing

  • Distribution scheme that doesn’t directly depend on number of servers, so that, the number of keys to be redistributed is minimised.
  • Consistent Hashing ring
  • Say 2 hash functions Hs & Hc
    • Hs - Marks servers on consistent hashing ring
    • Hc is used to mark partition key or client id on the same consistent hashing ring

Partitioning

  1. Functional split

Sharding

  • Removing storage bottleneck
  • Data loss prevention
  • To address through put issues for hot reads
Replication

  • Data loss prevention
  • Replication Factor - #servers that hold data
  • R- #servers that read data
    • Read from all servers, compare and take the latest data
    • For read heavy systems R is 1 so that the read happens on one server only
  • W
    • Write to all #servers synchronously 
    • For write heavy systems W is 1 so that the data replication doesn’t take time
  • for high consistency R+W> RF(Replication factor/Quorum)

Comments

Popular posts from this blog

Low Level Designs

CS Fundamentals