首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GCP中的网络负载均衡器和HTTP负载均衡器有什么不同

GCP中的网络负载均衡器和HTTP负载均衡器有什么不同
EN

Stack Overflow用户
提问于 2017-01-09 00:55:43
回答 3查看 7.1K关注 0票数 25

GCP提供了两个负载均衡器,即网络HTTP(s),前者工作在第四层上,后者工作在第七层上。

还有一个文档指出,即使是HTTP流量也可以通过网络负载均衡器进行负载均衡。这稍微混淆了在GCP中为web应用程序选择哪个负载均衡器。在为项目选择一个之前,最好先了解其中的差异。

根据工作流设置、基于区域/区域会话亲和性的选项以及其他设置,它们之间有何区别?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2017-01-09 00:55:43

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

代码语言:javascript
复制
+---------------------+------------------------------------------+------------------------------------------------------+
|       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.  |                                                      |
+---------------------+------------------------------------------+------------------------------------------------------+

上面的表格是基于我的观点。如果有任何不正确的地方,或者如果我遗漏了什么,请随时发表意见,我会将其添加到表格中。

以下是在GCP中设置HTTP负载均衡器的说明的link

票数 34
EN

Stack Overflow用户

发布于 2020-03-01 23:48:38

总的来说,下面是网络负载均衡器和Http负载均衡器之间的区别。

网络负载均衡器(第4层):这是基于网络变量的流量分布,例如IP地址和目标端口。它是第4层(TCP)及更低层,不考虑应用层的任何内容,例如内容类型、cookie数据、自定义标头、用户位置或应用程序行为。它是无上下文的,只关心数据包中包含的网络层信息,它以这样或那样的方式引导。

应用程序负载均衡器(第7层)这是基于多个变量的请求分布,从网络层到应用层。它是上下文感知的,可以根据任何单个变量直接请求,就像它可以轻松地组合变量一样。应用程序根据其特殊的行为进行负载平衡,而不仅仅是服务器(操作系统或虚拟化层) information.Provides能够根据规则、基于主机或基于路径来路由HTTP和HTTPS流量。与NLB类似,每个目标可以位于不同的端口上。

这两者之间的另一个区别很重要,因为网络负载平衡不能保证应用程序的可用性。这是因为它仅根据网络和TCP层变量进行决策,根本不了解应用程序。通常,网络负载均衡器将根据服务器响应ICMP ping或正确完成三次TCP握手的能力来确定“可用性”。应用程序负载均衡器要深入得多,它不仅能够根据特定页面的成功HTTP GET来确定可用性,还能够根据输入参数验证内容是否如预期的那样。

参考:https://medium.com/awesome-cloud/aws-difference-between-application-load-balancer-and-network-load-balancer-cb8b6cd296a4

票数 3
EN

Stack Overflow用户

发布于 2019-01-18 01:48:34

此外,我想提一下在GCP中选择正确的负载均衡器(LB)时需要考虑的3 main aspects

1)全球与区域

2)外部与内部

3)流量类型

请在此chart上找到更多信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41535226

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档