Scaling, Caches, LBs Flashcards
(37 cards)
Key characteristics of distributed systems
scalability
reliability
availability
efficiency
manageability
Scalability
the capability of a system, process or network to grow and manage increased demand
Horizontal Scaling
Scale up by adding more servers to your pool of resources
Vertical Scaling
Scale up by adding more power (CPU, RAM, Storage) to an existing server
vertical scaling is usually limited to the capacity of a single server
Reliability
Reliability refers to a system’s ability to perform it’s intend functions correctly and consistently
Reliability can be achieved through redundancy
Redundancy
the intentional duplication of critical components or functions of a system with the goal of increasing reliability and eliminating singles points of failure
Database Replication
Database replication is the process of copying and synchronizing data from one database to one or more additional databases.
This is common in distributed systems
ensures data availability, fault tolerance, and scalability.
Synchronous Replication
with synchronous replication, changes made to the primary database are immediately replicated to the replica databases before the write operation is considered complete
this ensures strong consistency between the database and its replicas
Asynchronous Replication
a type of database replication where changes made to the primary database are not immediately replicated to the replicas
Instead, changes are queued and replicated to the replicas at a later time.
PROS - Faster Performance, and writes won’t fail bc of issues with the replica
CONS - This delay can result in temporary inconsistencies between the primary and replica databases
Availability
A measure of the percentage of the time that a system, service or machine remains operational under normal conditions
Reliability vs. Availability
A system is RELIABLE if it’s able to function correctly
A system is AVAILABLE depending on the % of the time that it is operational under normal conditions
Good reliability translates to good availability
But availability does not indicate reliability
You can have high availability on an unreliable product by minimizing repair times and ensuring that replicas are always ready
Efficiency
Efficiency of a system is measured through latency and throughput
Latency
The time it takes for a certain operation to complete in a system
Throughput
The number of operations that a system can handle properly per time unit. Commonly measured in RPS (requests per second)
Serviceability
AKA manageability
describes how easy it is to maintain and repair a distributed system
key considerations:
- ease of diagnosing and understanding problems
- ease of making updates / modifications
- how simple the system is to operate
Load Balancer
device that sits between the client and the server to accept incoming network traffic / distribute it across multiple backend servers using various algorithms
reduces individual server load
prevents single-point-of-failure
improves availability
HEALTH CHECKS:
important to note that load balancers should keep track of the status of available resources while distributing requests. If a server is not available or has an elevated error rate, LB will not send traffic there
Where can we place load balancers?
Between the user and the web servers
Between web servers and an internal platform layer, like application servers or cache servers
Between internal platform layer and a database
Benefits of Load Balancing
- Users experience uninterrupted service
- less downtime / higher throughput
- smart load balancers can use predictive analytics to predict bottlenecks
- fewer stressed / failing systems component; no one device is shouldering all the work
Least Connection Method
Load Balancing Algorithm
directs traffic to the server with the fewest active connections. useful for evening out distribution between servers
Least Bandwidth Method
Load Balancing Algorithm
directs traffic to the server with the least amount of traffic (Mbps)
Least Response Time Method
Load Balancing Algorithm
directs traffic to the server with the lowest average response time
Round Robin Method
Load Balancing Algorithm
cycles through a list of available servers and sends each new request to the next server. useful when the servers are of equal specification and there are not many persistent connections
Weighted Round Robin Method
Load Balancing Algorithm
Round robin method, but servers are assigned a weight and servers with higher weights get more new connections
IP Hash Method
Load Balancing Algorithm
A hash of the IP address of the client is calculated to redirect the request to a server
Useful for ensuring that requests from the same client go to the same server