Load Balancer in Google Cloud Platform

In this guide, we learn Learn how load balancing works in the Google Cloud Platform.

These days, most companies don’t develop and maintain their own global load balancing solutions, instead opting to use load balancing services from a larger public cloud provider.

Image for post
Image for post

Why LoadBalncing?

There is a limitation to the number of requests one computer can handle at a given time. When faced with a sudden surge in requests, your application will load slowly, the network will trip, and your server will creak.

  • When you rescale (vertical scale), you increase the capacity of one machine by adding more storage (Disk) or processing power (RAM, CPU) to an existing single machine as required on demand. But scaling up contains a limit — you’ll get to some extent where you can’t add more RAM or CPUs.
  • A better strategy is to scale out (horizontal scale), which involves the distribution of loads across as many servers as necessary to handle the workload.
  • HTTP, HTTPS, SSL, TCP, UDP, etc.

How to decide which load balancer to use?

There are many Load Balancing options depending on where exactly they need a load balancer within the architecture.

  • Use internal load balancers whenever you want to route and balance load traffic within your GCP network.
  • External load balancers are an ideal choice if you’re distributing traffic from the internet to a Google Cloud network.

What is Google Cloud Load Balancer?

Google Cloud Load Balancer (GCLB) is a software-defined network load balancer available to all projects on Google Cloud Platform (GCP).GCLB is also region aware. Traffic coming from the India will be directed to India based servers, assuming there is capacity.

Types of Load Balancing

HTTP(S) load balancing can balance HTTP and HTTPS traffic across multiple backend instances, across multiple regions.

TCP load balancing can spread TCP traffic over a pool of instances within a Compute Engine region.

Autoscaling helps your applications gracefully handle increases in traffic and reduces cost when the need for resources is lower.

SSL offload enables you to centrally manage SSL certificates and decryption

Maglev

Maglev is the name of Google’s Distributed LB that has been in use since 2008. A typical Maglev instance is designed to processes about 813,000 1.5 kilobyte IP packets per second to over 9,060,000 100 byte IP packets per second, over a 10 Gbps line rate. Maglev unlike some traditional LBs is a software-based LB that runs on Linux commodity servers.

Creating a Load Balancer HTTP(s)

  1. Create a Project in GCP

2.Create an Instance Group

  • Click “Compute Engine” and then “Instances Groups.”
  • Once the Compute Engine is ready, click “Create Instance Group.”

3.Create an HTTP(s) Load Balancer

  • To create the HTTP(s) load balancer, navigate to “Network Services” and click “Load balancing” and then “Create a Load Balancer.”
  • Click the “Start Configuration” button situated under the HTTP(s) Load balancing option.
  • Select the first option and click “Continue.” The HTTP(s) load balancer will manage web application traffic distribution from the internet to your Virtual Machines.
Image for post
Image for post
  • Enter the load balancer name, select the backend configuration, fill in the necessary information.
  • Set up the Backend configuration and Frontend configuration.
  • Click the “Review and finalize” tab to confirm that everything checks out.
Image for post
Image for post
  • You’re now done creating your first load balancer on GCP.

Stay tuned till the next blog

If you Want to Connect with Me:

Linkedin: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Google Developers Google Cloud GoogleCloud Platform

Written by

I am Google Cloud Certified Associate Cloud Engineer and MS Azure Certifed. I have been working on different fields including Data Science, DevOps and Anthos.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store