System Design

Ref

Distributed Computing

Fallacies of Distributed Computing:

  1. The network is reliable
  2. Latency is zero
  3. Bandwidth is infinite
  4. The network is secure
  5. Topology doesn’t change
  6. There is one administrator
  7. Transport cost is zero
  8. The network is homogeneous

CAP theorem: states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:

  • Consistency
  • Availability
  • Partition Tolerance

ACID: set of properties of database transactions intended to guarantee validity even in the event of errors, power failures, etc

  • Atomic
  • Consistency
  • Isolation
  • Durability

BASE: Basically Available, Soft state, Eventually consistency

Availability & Reliability

Availability = system can serve the request

  • load balancing

High availability (HA) mean no downtime always available

Reliability = availability + working properly

  • automated test

Single point of failure = if it fails, will stop the entire system from working

Metrics:

  • Uptime
  • Downtime
  • Failures
    • RPO = Recovery Point Objective = How much data can we loose
    • RTO = Recovery Time Objective = How long it take to Recovery
    • MTBF = Mean-Time-Between-Failures = Time between failures

Durability & Resiliency

Durability refers to the on-going existence of the object or resource. Note that it does not mean you can access it, only that it continues to exist.

  • By taking regular backups
  • Storing resources in different geographical locations to sustain disasters.
  • Performing checksums on data and repairing the corrupted data from backups.

Resiliency = self-heal

  • Desing to identify faulty software or hardware and automate the repair/restart features or in case of beyond repair, just take it out of the working system.
  • Active failover sites for applications and active replication to restore corrupted data.

Redundancy and Replication

Data Deduplication: Technique for eliminating duplicate copies of repeating data

CRDT = Conflit-free replicated data type

Consistent Hashing

Message Queue / Pub-Sub

Ref:

Types of delivery semantics:

  • at-most-once
  • at-least-once
  • exactly-once <!–

    Rate Limiter

On progress

SQL vs. NoSQL

On progress

Long-Polling vs WebSockets vs Server-Sent Events

On progress –>

Partition & Sharding

API Gateway

Clean architecture