parent
6957f01d73
commit
fbd9981ab1
6 changed files with 86 additions and 6 deletions
@ -1 +1,15 @@ |
||||
# Horizontal scaling |
||||
# Horizontal Scaling |
||||
|
||||
Load balancers can also help with horizontal scaling, improving performance and availability. Scaling out using commodity machines is more cost efficient and results in higher availability than scaling up a single server on more expensive hardware, called Vertical Scaling. It is also easier to hire for talent working on commodity hardware than it is for specialized enterprise systems. |
||||
|
||||
## Disadvantages of horizontal scaling |
||||
- Scaling horizontally introduces complexity and involves cloning servers |
||||
- Servers should be stateless: they should not contain any user-related data like sessions or profile pictures |
||||
- Sessions can be stored in a centralized data store such as a database (SQL, NoSQL) or a persistent cache (Redis, Memcached) |
||||
- Downstream servers such as caches and databases need to handle more simultaneous connections as upstream servers scale out. |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [Introduction to Horizontal Scaling](https://github.com/donnemartin/system-design-primer#horizontal-scaling) |
||||
- [System Design – Horizontal and Vertical Scaling](https://www.geeksforgeeks.org/system-design-horizontal-and-vertical-scaling/) |
||||
- [Getting started with Horizontal and Vertical Scaling](https://www.codingninjas.com/blog/2021/08/25/system-design-horizontal-and-vertical-scaling/) |
@ -1 +1,8 @@ |
||||
# Layer 4 load balancing |
||||
# Layer 4 Load Balancing |
||||
|
||||
Layer 4 load balancers look at info at the transport layer to decide how to distribute requests. Generally, this involves the source, destination IP addresses, and ports in the header, but not the contents of the packet. Layer 4 load balancers forward network packets to and from the upstream server, performing Network Address Translation (NAT). |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [What is Layer 4 Load Balancing?](https://github.com/donnemartin/system-design-primer#communication) |
||||
- [Getting Started with Layer 4 Load Balancing](https://www.nginx.com/resources/glossary/layer-4-load-balancing/) |
@ -1 +1,10 @@ |
||||
# Layer 7 load balancing |
||||
# Layer 7 Load Balancing |
||||
|
||||
Layer 7 load balancers look at the application layer to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminate network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers. |
||||
|
||||
At the cost of flexibility, layer 4 load balancing requires less time and computing resources than Layer 7, although the performance impact can be minimal on modern commodity hardware. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Introduction to Layer 7 Load Balancing](https://github.com/donnemartin/system-design-primer#layer-7-load-balancing) |
||||
- [A Brief of Layer 7 Balancing](https://github.com/donnemartin/system-design-primer#communication) |
@ -1 +1,8 @@ |
||||
# Load balancing algorithms |
||||
# Load Balancing Algorithms |
||||
|
||||
Load balancing is the process of distributing incoming network traffic across multiple servers in order to optimize resource usage, minimize response time, and avoid overloading any single server. There are several algorithms that can be used to achieve this, each with its own advantages and disadvantages. |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [Concept of load balancing algorithms](https://www.enjoyalgorithms.com/blog/load-balancers-in-system-design) |
||||
- [Types of load balancing algorithms](https://www.cloudflare.com/learning/performance/types-of-load-balancing-algorithms/) |
@ -1 +1,14 @@ |
||||
# Lb vs reverse proxy |
||||
# Load Balancer vs Reverse Proxy |
||||
|
||||
- Deploying a load balancer is useful when you have multiple servers. Often, load balancers route traffic to a set of servers serving the same function. |
||||
- Reverse proxies can be useful even with just one web server or application server, opening up the benefits described in the previous section. |
||||
- Solutions such as NGINX and HAProxy can support both layer 7 reverse proxying and load balancing. |
||||
|
||||
## Disadvantages of reverse proxy: |
||||
|
||||
- Introducing a reverse proxy results in increased complexity. |
||||
- A single reverse proxy is a single point of failure, configuring multiple reverse proxies (ie a failover) further increases complexity |
||||
|
||||
To learn more visit the following links: |
||||
|
||||
- [What is a Reverse Proxy vs. Load Balancer?](https://www.nginx.com/resources/glossary/reverse-proxy-vs-load-balancer/) |
@ -1 +1,31 @@ |
||||
# Load balancers |
||||
# Load Balancers |
||||
|
||||
Load balancers distribute incoming client requests to computing resources such as application servers and databases. In each case, the load balancer returns the response from the computing resource to the appropriate client. Load balancers are effective at: |
||||
|
||||
- Preventing requests from going to unhealthy servers |
||||
- Preventing overloading resources |
||||
- Helping to eliminate a single point of failure |
||||
|
||||
Load balancers can be implemented with hardware (expensive) or with software such as HAProxy. Additional benefits include: |
||||
|
||||
- **SSL termination** - Decrypt incoming requests and encrypt server responses so backend servers do not have to perform these potentially expensive operations |
||||
- Removes the need to install X.509 certificates on each server |
||||
- **Session persistence** - Issue cookies and route a specific client's requests to same instance if the web apps do not keep track of sessions |
||||
|
||||
To protect against failures, it's common to set up multiple load balancers, either in active-passive or active-active mode. Load balancers can route traffic based on various metrics, including: |
||||
|
||||
## Layer 4 load balancing |
||||
Layer 4 load balancers look at info at the transport layer to decide how to distribute requests. Generally, this involves the source, destination IP addresses, and ports in the header, but not the contents of the packet. Layer 4 load balancers forward network packets to and from the upstream server, performing Network Address Translation (NAT). |
||||
|
||||
## Layer 7 load balancing |
||||
Layer 7 load balancers look at the application layer to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminate network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers. |
||||
|
||||
## Disadvantages of load balancer |
||||
The load balancer can become a performance bottleneck if it does not have enough resources or if it is not configured properly. |
||||
Introducing a load balancer to help eliminate a single point of failure results in increased complexity. |
||||
A single load balancer is a single point of failure, configuring multiple load balancers further increases complexity. |
||||
|
||||
To learn more, visit the following links: |
||||
|
||||
- [What is Load balancing (computing)?](https://en.wikipedia.org/wiki/Load_balancing_(computing)) |
||||
- [Introduction to Load Balancing](https://github.com/donnemartin/system-design-primer#layer-7-load-balancing) |
Loading…
Reference in new issue