Google Cloud Load Balancer

The Google Cloud Load Balancer (GCLB) is a software defined globally distributed load balancing service. It enables GCP users to distribute applications across the world and scale compute up and down with very little configuration and cost. It allows for 0 to 1 million requests per second (rps) with no pre-warming.

Benefits :-
Scale your application
Support heavy traffic
Detect and automatically remove unhealthy virtual machine instance
Route traffic to the closest virtual machine

Click > home > Network service >Load Balancing >create> HTTP(s) Load Balancer(choice any one )

Session Affinity :-
Session affinity sends all request from the same client to the same
Virtual machine instance as long as the instance stays healthy and has capacity.

GCP HTTP(s) LOad Balancing offers two types of session affinity
Client IP affinity
Generated cookie affinity

Load Balancer types : —

Global external load balancing

  • HTTP(s) load balancing
  • SSL Proxy Load balancing
  • TCP Proxy load balancing

Regional external load balancing

  • Network load balancing
  • Regional internal load balancing
  • Internal load balancing

HTTP Load Balancer :– GLOBAl

  • Load Distribution Algorithm
  • Session Affinity
  • Consideration :-

  • If your load balanced are running a public operating system image supplied by compute Engine ,then firewall rules in the operating system will be configured automatically to allow load balanced traffic.
  • If you are using a custom image ,you have to config the operating system firewall manually. This is separate from the GCP firewall rule that must be created as part of configuring an HTTP(s) load balancer.
  • Load balancing does not keep instance in sync.
  • The HTTP(s) load balancer does not support sending an HTTP DELETE with a body to the load balancer.
  • WEB Socket :-

  • The HTTP(s) load balancer has native support for the WebSocket Protocol
  • Backend that use WebSocket to communication with client cen use the HTTP(s) load balancer as s front end , for scale availability.
  • If your service requires longer-lived connection, increase the timeout value (timeout sec in API) for the backend service.
  • Logging :
    You can use stackdriver logging for logging
    Timeout’s and Retries
    HTTP(s) load balancing has a default response timeout of 30 seconds
    HTTP(s) load balancing has a TCP session timeout of 10 minutes (600 seconds by default
    HTTP(s) load balancing retries failed GET request , but does not retry failed POST request

    SSL & TCP LOAD Balancer:-

    TCP Proxy Load Balancing Concepts:-

    Google Cloud Platform (GCP) TCP Proxy Load Balancing allows you to use a single IP address for all users around the world. GCP TCP proxy load balancing automatically routes traffic to the instances that are closest to the user.

    Cloud TCP Proxy Load Balancing is intended for non-HTTP traffic. For HTTP traffic, use HTTP Load Balancing instead. For proxied SSL traffic, use SSL Proxy Load Balancing.

    TCP Proxy Load Balancing supports both IPv4 and IPv6 addresses for client traffic. Client IPv6 requests are terminated at the load balancing layer, then proxied over IPv4 to your backends.
    TCP Proxy Load Balancing support the following ports:-
    25,43,110,143,195,443,465,587,700,993,995,1883,5222

    SSL Proxy Load Balancing Concepts:-

    Google Cloud SSL Proxy Load Balancing terminates user SSL (TLS) connections at the load balancing layer, then balances the connections across your instances using the SSL or TCP protocols. Cloud SSL proxy is intended for non-HTTP(S) traffic. For HTTP(S) traffic, HTTP(S) load balancing is recommended instead.
    SSL Proxy Load Balancing supports both IPv4 and IPv6 addresses for client traffic. Client IPv6 requests are terminated at the load balancing layer, then proxied over IPv4 to your backends

    Benefits:
    Intelligent routing
    Better utilization of the virtual machine instances
    Certificate management
    Security patching
    SSL proxy supports the following ports : 25,43,110,143,195,443,465,587,700,993,995,1883,5222

    Network services > Load Balancing > create >TCP Load balancing (start config)

    GCE: Auto Scaling :–

    Concepts

  • Compute Engine offers autoscaling to automatically add or remove virtual machines from an instance group based on increases or decreases in load.
  • This allows your applications to gracefully handle increases in traffic and reduce cost when the need for resources is lower.
  • You just define the autoscaling policy and the autoscaler performs automatic scaling based on the measured load.
  • Notes :-

  • Autoscaling only works with managed instance groups, Unmanaged instance group are not supported.
  • Do not use Compute Engine autoscaling with managed instance groups that are owned by google container Engine for google container group ,use Cluster AutoScaling instead.
  • Look for the gke perfix in the managed instance group name.
  • Terminology:-

  • Instance templates
  • Instance Group
  • Auto Scaling Policies
  • Compute engine > instance group

    Open chat