Saturday 6 July 2024

Google Cloud Load Balancing

 


Virtual machines autoscaling solves the issue of availability during the high load period and also cost optimization during the low load by scaling up and down in respond to changing loads. 

Why do we need Load Balancers?


Cloud Load Balancing allows our customers get to our application when it might be provided by four VMs one moment, and by 40 VMs at another. The job of a load balancer is to distribute user traffic across multiple instances of an application. By spreading the load, load balancing reduces the risk that applications experience performance issues

source: Cloud Load Balancing overview  |  Google Cloud


Cloud Load Balancing 


Cloud Load Balancing:
  • Fully distributed
  • Software-defined
  • Managed service for all our traffic
  • Load balancers don’t run in VMs that we have to manage so we don’t have to worry about scaling or managing them. 
  • Can be put it in front of all of our traffic:
    • HTTP or HTTPS
    • TCP 
    • SSL traffic
    • UDP traffic 
  • Provides cross-region load balancing (remember that Google Cloud VPCs are cross-regional), including automatic multi-region failover, which gently moves traffic in fractions if backends become unhealthy
  • Reacts quickly to changes in users, traffic, network, backend health, and other related conditions
  • Doesn't require so-called “pre-warming”
    • If we anticipate a huge spike in demand, for example our online game is already a hit, we don't need to file a support ticket to warn Google of the incoming load. 

Load Balancing Types


Depending on at which OSI level they operate, Cloud Load Balancers can be divided into two types:
  • Application Load Balancers
    • Layer 7 load balancer for our applications with HTTP(S) traffic
  • Network Load Balancers
    • Layer 4 load balancers that can handle TCP, UDP, or other IP protocol traffic

Depending where the traffic is coming from, Load Balancers can be dived into two types:
  • External Load Balancers
    • For traffic coming into the Google network from the Internet
  • Internal Load Balancers
    • Accepts traffic on a Google Cloud internal IP address and load balances it across Compute Engine VMs
    • If we want to load balance traffic inside our project, say, between the presentation layer and the business layer of our application

Application Load Balancers


Layer 7 load balancer for our applications with HTTP(S) traffic.

Depending on whether our application is internet-facing or internal they can be deployed as:
  • External Application Load Balancers - intended for traffic coming into the Google network from the Internet
    • Global HTTP(S) load balancer - if we need cross-regional load balancing for a web application
    • Regional External Application load balancer
  • Internal Application Load Balancers, which can be deployed as:
    • Cross-region Internal Application Load Balancers - support backends in multiple regions and are always globally accessible. Clients from any Google Cloud region can send traffic to the load balancer. Balance traffic to backend services that are globally distributed, including traffic management that ensures traffic is directed to the closest backend.
    • Regional Internal Application Load Balancers - support backends only in a single region
source: Cloud Load Balancing overview  |  Google Cloud


Network Load Balancers


Layer 4 load balancers that can handle TCP, UDP, or other IP protocol traffic. 
Available as:
  • Proxy Network Load Balancers 
  • Passthrough Network Load Balancers

Proxy Network Load Balancers 

  • Support TLS offloading
  • Depending on whether your application is internet-facing or internal, they can be deployed as:
    • External Proxy Network Load Balancers
      • Global External Proxy Network Load Balancers - support backends in multiple regions
        • Global SSL Proxy load balancer - For Secure Sockets Layer traffic that is not HTTP. This proxy service only works for specific port numbers, and only for TCP
        • Global TCP Proxy load balancer - If it’s other TCP traffic that doesn’t use SSL. This proxy service only works for specific port numbers, and only for TCP
      • Regional External Proxy Network Load Balancers - support backends in a single region
      • Classic Proxy Network Load Balancers - global in Premium Tier but can be configured to be effectively regional in Standard Tier
    • Internal Proxy Network Load Balancers 
      • Regional Internal Proxy Network Load Balancers

source: Cloud Load Balancing overview  |  Google Cloud


Passthrough Network Load Balancers

  • support for IP protocols such as UDP, ESP, and ICMP
  • Can be:
    • External Passthrough Network Load Balancers
      • Regional External Passthrough Network load balancer - If we want to load balance UDP traffic, or traffic on any port number, we can use it to load balance across a Google Cloud region
    • Internal Passthrough Network Load Balancers
      • Regional Internal Passthrough Network Load Balancers

source: Cloud Load Balancing overview  |  Google Cloud


How to choose the right Load Balancer?


source: source: Cloud Load Balancing overview  |  Google Cloud

No comments: