网络和HTTP(s)负载平衡器在GCP中有什么区别 [英] What are the differences between Network and HTTP(s) load balancer in GCP

查看:448
本文介绍了网络和HTTP(s)负载平衡器在GCP中有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GCP提供两个负载平衡器,即网络 HTTP(s),前者在第4层上工作,后者在第7层



还有一个文档说明即使HTTP流量可以通过网络负载平衡器进行负载平衡。这略微混淆了为GCP中的Web应用程序选择哪个负载平衡器。在为项目选择一个项目之前,理解差异会更好。

设置区域/区域为基础,会话亲和力选项以及其他许多功能。

解决方案

网络负载均衡器与HTTP负载均衡器

  + --------------------- + ------------------------- ----------------- + -------------------------------- ---------------------- + 
|类别|网络负载平衡(NLB)| HTTP(S)负载平衡(HLB)|
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 1.地区/ | NLB仅支持在一个地区内。 | HLB支持跨区域|
|跨区域|不支持跨区域|负载均衡。 |
| |负载平衡| |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 2.负载均衡| NLB基于IP地址,端口| HLB仅基于HTTP和HTTPS |
|基于|和协议类型。任何TCP / UDP |协议。 |
| |流量,甚至SMTP都可以| |
| |负载均衡。 | |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 3.数据包|数据包检查是可能的并且| HLB不能检查数据包。 |
|检查|基于数据包的负载均衡| |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 4.实例|无需创建实例组。 | Managed / UnManaged Instance组| |
| Group |目标池需要被创建。 |是创建HTTP / HTTPS |所必需的
| |实例可以被标记为池。 |负载均衡器。 |
| |非托管实例组的理想选择|
| |实例不一致。 | |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 5.工作流程|转发规则是起点。 |这在HTTP(s)负载平衡器中非常复杂。 |
| |它将请求指向|全局转发规则用于指示请求|
| |从中计算|的目标池目标HTTP代理,然后依次检查|
| |引擎将选择请求。 | URL地图来确定适当的后端|
| | |服务。这些服务又将直接请求|
| |转发规则 - >目标池|到实例组。 |
| | - >实例| |
| | | |
| | |全局转发规则 - >目标HTTP代理 - > |
| | |网址地图 - >后端服务 - >实例组| |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 6.类型的|基本的网络负载均衡器哪个| 1.跨区域负载均衡器仅使用一个|
|负载平衡器|引导基于IP地址的请求,|全局IP地址并路由请求|
| |端口和该地区内的协议。 |到最近的地区。 |
| | | |
| | | 2.基于内容的负载均衡器基于|
| | |在URL路径上。不同的路径规则需要|
| | |不同的后端服务。例如:/ video |
| | |和/静态需要两个单独的后端服务。 |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 7.会话亲和力|会话亲和力可以设置,但仅限于| 1.客户端IP亲和性:指示相同的|
| |在创建目标池期间。 |客户端ip通过|连接到相同的后端实例
| |一旦设置,值|计算IP的散列。 |
| |不能改变。 | 2.生成的Cookie亲和性:负载均衡器存储|
| | |客户端中的cookie并将同一客户端指向|
| | |在检索到的cookie的帮助下实现相同的实例。 |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +
| 8.健康检查|健康检查是可选的,但是网络|健康可以通过使用HTTP |来验证
| |负载均衡依赖于HTTP Health |健康检查或HTTPS健康检查。 |
| |检查确定实例健康状况。 | |
+ --------------------- + ----------------------- ------------------- + ------------------------------ ------------------------ +

以上表格基于我的观点。如果有任何不正确的或如果我错过了某些东西,请随时发表评论,我会将它添加到表格中。



以下是链接了解有关设置 HTTP负载平衡器的说明。在 GCP中。

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 an documentation which states that even HTTP traffic can be load balanced by an 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.

I would like to know the differences between them based on the workflow, setup, region/zone based, options for session affinity and many other.

解决方案

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.

这篇关于网络和HTTP(s)负载平衡器在GCP中有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆