How to choose Load Balancer ( AWS and GCP )

Stolen from Google Image

Introduction ( TL;DR )

If you are familiar with Google Cloud Platform or AWS, you must be aware of famous software-based load balancers, all they do is, efficient distribution of network or application traffic across multiple servers. They usually sit in between client devices and backend servers.

Layer 4 Load Balancer

Layer 4 is nothing but the Transport Layer of the OSI Model. This is Network Load Balancer in AWS and TCP/UDP Load Balancer in GCP.

  1. A simple approach for Packet-Level load balancing
  2. Messages are neither inspected nor decrypted, allows them to deliver messages quickly, efficiently, and securely.
  3. Preservers client source IP
  1. It is fast but can’t perform any action on the protocol above layer 4.
  2. Cannot access features of Application Layer, eg. routing based on the path

Layer 7 Load Balancer

These load balancers work on top of the application layer of the OSI model. AWS calls them Application Load Balancer and in GCP, these are HTTP(s) load balancer.

  1. It is capable of performing optimizations and changes to the content (such as compression and encryption)
  2. Session Affinity or Sticky Sessions for identifying servers
  3. SSL/TLS offloading
  1. Little slower than Layer 4 LB because of the complex underlying algorithm.

Decision Tree ( GCP )



Full Stack Software Developer