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 )

Resources

  1. https://en.wikipedia.org/wiki/OSI_model
  2. https://cloud.google.com/load-balancing/docs/network
  3. https://cloud.google.com/load-balancing/docs/https
  4. https://aws.amazon.com/elasticloadbalancing/application-load-balancer/
  5. https://aws.amazon.com/elasticloadbalancing/network-load-balancer/
  6. https://aboutssl.org/what-is-ssl-offloading/
  7. https://www.nginx.com/resources/glossary/reverse-proxy-server/

Full Stack Software Developer