The load balancer distributes network traffic across the servers to improve concurrency, reliability, and application latency. The load balancer can be physical or virtual. You need to choose a load balancer based on your application's need. Commonly, two types of load balancer can be utilized by the application:
- Layer 4 or network load balancer: Layer 4 load balancing routes packets based on information in the packet header—for example, source/destination IP addresses and ports. Layer 4 load balancing does not inspect the contents of a packet, which makes it less compute intensive and therefore faster. A network load balancer can handle millions of requests per second.
- Layer 7 or application load balancer: Layer 7 load balancing inspects and routes packets based on the full contents of the packet. Layer 7 is used in conjunction with HTTP requests. The materials that inform routing decisions are factors such as HTTP headers, URI path, and content...