Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Network and HTTP(s) load balancer in GCP

Tags:

GCP provides two load balancers namely Network and HTTP(s) where the former works on layer 4 and the later works on layer 7.

There is also a documentation which states that even HTTP traffic can be load balanced by a network load balancer. This slightly confuses which load balancer to choose for a web app in GCP. It is better to understand the differences before selecting one for the project.

What are the differences between them based on the workflow, setup, region/zone based, options for session affinity, and other settings?

like image 982
Lakshman Diwaakar Avatar asked Jan 08 '17 16:01

Lakshman Diwaakar


People also ask

What is the difference between HTTP load balancer and network load balancer?

While the global HTTPS load balancer is for Layer-7 traffic and is built using the Google Front Engines at the edge of Google's network. The regional network load balancer is for Layer-4 traffic and is built using Maglev.

What is network load balancer in GCP?

A network load balancer distributes external traffic among virtual machine (VM) instances in the same region. You can configure a network load balancer for TCP, UDP, ESP, GRE, ICMP, and ICMPv6 traffic. A network load balancer can receive traffic from: Any client on the internet. Google Cloud VMs with external IPs.

What are the different types of Google cloud load balancers choose 2?

Google Cloud load balancers can be divided into external and internal load balancers: External load balancers distribute traffic coming from the internet to your Google Cloud Virtual Private Cloud (VPC) network. Global load balancing requires that you use the Premium Tier of Network Service Tiers.


1 Answers

Network load balancer Vs HTTP(s) Load Balancer

+---------------------+------------------------------------------+------------------------------------------------------+ |       Category      |       Network Load Balancing (NLB)       |             HTTP(S) Load Balancing (HLB)             | +---------------------+------------------------------------------+------------------------------------------------------+ |     1. Region /     | NLB supports only within a region.       | HLB supports both within cross-region                | |     Cross-Region    | Does not support cross-region            | load balancing.                                      | |                     | load balancing                           |                                                      | +---------------------+------------------------------------------+------------------------------------------------------+ |  2. Load balancing  | NLB is based on IP address, port         | HLB is based only on HTTP and HTTPS                  | |       based on      | and protocol type. Any TCP/UDP           | protocols.                                           | |                     | traffic, even SMTP can be                |                                                      | |                     | load balanced.                           |                                                      | +---------------------+------------------------------------------+------------------------------------------------------+ |      3. Packet      | Packet inspection is possible and        | HLB cannot inspect packets.                          | |      inspection     | load balance based on packets            |                                                      | +---------------------+------------------------------------------+------------------------------------------------------+ |     4. Instance     | No need of creating instance group.      | Managed / UnManaged Instance group                   | |         Group       | Target pools need to be created.         | is necessary for creating HTTP / HTTPS               | |                     | Instance can be just tagged to the pool. | load balancer.                                       | |                     | Ideal for unmanaged instance group       |                                                      | |                     | where instances are non homogeneous.     |                                                      | +---------------------+------------------------------------------+------------------------------------------------------+ |     5. Workflow     | Forwarding rules is the starting point.  | This is quite complex in HTTP(s) load balancer.      | |                     | It directs the request to the            | Global forwarding rulesroutes direct the request     | |                     | target pools from which compute          | to target HTTP proxy, which in turn checks the       | |                     | engines will pick the request.           | URL map to determine appropriate backend             | |                     |                                          | services.  These services in turn direct the request | |                     | Forwarding rules -> target pool          | to the instance group.                               | |                     |  -> instances                            |                                                      | |                     |                                          |                                                      | |                     |                                          | Global forwarding rules -> Target HTTP proxy ->      | |                     |                                          | URL map -> Backend Sevices -> instance group         | +---------------------+------------------------------------------+------------------------------------------------------+ |     6. Types of     | Basic network load balancer which        | 1. Cross-region load balancer uses only one          | |    load balancer    | directs the request based on IP address, | global IP address and routes the request             | |                     | port and the protocol within the region. | to the nearest region.                               | |                     |                                          |                                                      | |                     |                                          | 2. Content-based load balancer is based              | |                     |                                          | on the URL path. Different path rules need           | |                     |                                          | different backend services. for eg: /video           | |                     |                                          | and /static require two separate backend services.   | +---------------------+------------------------------------------+------------------------------------------------------+ | 7. Session affinity | Session affinity can be set, but only    | 1. Client IP Affinity: This directs the same         | |                     | during the creation of target pool.      | client ip to same backend instance by                | |                     | Once it is set, the value                | computing hash of the IP.                            | |                     | cannot be changed.                       | 2. Generated Cookie Affinity: Load balancer stores   | |                     |                                          | cookie in clients and directs the same client to     | |                     |                                          | same instance with the help of retrieved cookie.     | +---------------------+------------------------------------------+------------------------------------------------------+ |   8. Health check   | Health check is optional, but network    | Health can be verified by either using HTTP          | |                     | load balancing relies on HTTP Health     | heath check or HTTPS health check.                   | |                     | checks for determining instance health.  |                                                      | +---------------------+------------------------------------------+------------------------------------------------------+ 

The above table is based on my perspective. If anything is incorrect or If I had missed something, please feel free to comment and I will add it to the table.

Here is the link for instructions on setting up an HTTP load balancer in GCP.

like image 148
Lakshman Diwaakar Avatar answered Nov 12 '22 10:11

Lakshman Diwaakar