7 Layers of Networking
- Overview

Load Balancing
- Load Balancers are of two types
- Layer 4 load balancer
- Layer 7 load balancer
- Refer Here for differences
- Load Balancer is used to forward the traffic to one of servers hosting the applciation
- Generally our applications are web hosted which use http(s) protocol
- HTTP Protocol works on top on TCP on ports 80/443 by default
- HTTP Protocol components
- source (port and ip)
- destination (port and ip)
- url
- headers
- body
- Layer 7 loadbalancer can make load balancing decision based on
- ip
- port
- url (route/path)
- header
- Layer 4 load balancer can make load balancing decisisons based on
- ip
- port
- Use case 1: I have a ecommerce website which has lots of load, so i scaled my application, My ecommerce applications runs on one server (monolith) In this case layer 4 is a better choice as the decision is straight forward
- Use case 2: I have a modern ecomerce application which is run as different services on different vms, I need a LB to make decisions based on paths in url (myecommerce.com/login should go to login server & myecommerce.com/orders should go to order servers or based on headers), IN these cases Layer 7 Loadbalancers are used.
- Load Balancers should forward requests to the servers where application is working, Generally all load Balancers perform health checks or probes.
- In some classic applications we need sticky sessions i.e. if the request comes from a processed client, next request from same client should reach same server.
- Load Balancing Algorithms (Refer ByteByteGo)

- To configure load Balancers we need three areas
- incoming connections
- rules
- outgoing connections (backends)
- To secure the communications, we need to deal with tls/ssl certifactes.
- SSL Termination/offloading
- Complete SSL (certificates on servers)
