本文介绍了负载平衡器和API网关混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直致力于移动技术,现在我正在涉足后端系统,更具体地说是系统设计.对于API网关和负载平衡器的角色,我一直遇到冲突的声明. Googling仅返回了相同的六个结果,这些结果主要集中在某些著名服务提供的负载平衡器或api网关服务的实现上.我将在此列出我所面临的所有困惑,希望有人能澄清所有这些问题.

I have always worked on mobile technologies and now I am stepping into backend systems, more specifically systems design. I keep coming across conflicting statements for the roles of api gateway and load balancer. Googling has only returned the same half a dozen results that mostly focus on the implementations of load balancer or api gateway service provided by some famous service. I will list here all the confusing I am facing, in hope someone can clarify all of them.

有时候,我碰到API网关是与客户端设备进行通信的单点.另一方面,有些地方提到请求传给负载均衡器,该负载均衡器将请求平均分配给服务器".那么什么是正确的呢? API Gateway接收请求还是负载均衡器?

Sometimes, i come across that API Gateway is the single point of communication with client devices. On the other hand, some places mention that 'request goes to load balancer, which spreads it across servers equally'. So what is correct? API Gateway receives requests or load balancer?

在其他地方,当我用Google搜索该话题时,他们说两者是完全不同的.我知道API网关可以完成很多工作,例如SSL终止,日志记录,限制,验证等,但是它也可以实现负载平衡.那么API Gateway本身就是负载均衡器,还承担其他职责?

Other places, when I googled the topic, say that the two are totally different. I've understood that API Gateway does a lot of stuff, like SSL termination, logging, throttling, validation, etc, but it also does load balancing. So API Gateway is a load balancer itself, equipped with other responsibilities?

在主题上,我想了解负载均衡器是在同一群集的服务器之间还是在不同数据中心或群集之间分配负载?那么API网关又如何呢?

On the topic, I want to understand if load balancer distribute load among servers of the same cluster or across different data centers or clusters? And what about API Gateway?

api网关特有的功能是什么,它是微服务体系结构的默认选择? API网关在哪里托管? DNS将域名解析为负载均衡器或api网关吗?

What is so specific to api gateway that it is a choice by default for micro-service architecture? Where are API gateways hosted? A DNS resolves domain name to a load balancer or api gateway?

很明显,我完全感到困惑.如果问题是正确的,那么在哪些系统中负载均衡器比API Gateway受益更多?

As it might be clear, I am totally confused. In what systems does a load balancer benefit more than API Gateway, if the question is correct.

推荐答案

API网关主要执行API管理,并提供其他各种关键功能,例如IAM(身份和访问管理),速率限制,断路器.因此,它主要消除了为每种功能实现诸如安全性,缓存,限制和监视之类的功能而实现API特定代码的需求.微服务通常在API网关的帮助下公开用于前端,其他微服务和第三方应用程序的REST API.

API gateway predominately does API management and provides various other key features such as IAM (Identity and Access Management), Rate limiting, circuit breakers. Hence, it mainly eliminates the need to implement API-specific code for functionalities such as security, caching, throttling, and monitoring for each of the microservice. Microservices typically expose the REST APIs for use in front ends, other microservices and 3rd party apps with help of API gateway.

但是,通常,API管理不包括负载平衡功能,因此应与负载平衡器结合使用以实现相同的功能.

However, normally, the API Management does not include load balancing function, so it should be used in conjunction with a load balancer to achieve the same.

在基于Azure的系统体系结构中,有一个Azure Application Gateway,它是一个负载平衡器,它在第7层上运行,并提供比传统负载平衡器(第4层)更多的功能,而这些功能使用基于其他属性的路由决策来路由流量HTTP请求或流量内容.这也可以称为应用程序负载平衡器.它应与Azure API管理(API网关)一起使用. Azure具有用于在DNS级别运行的流量管理器,该流量管理器使用DNS根据流量路由方法和端点的运行状况将客户端请求定向到最合适的服务端点.流量管理器还使用在DNS级别配置的规则,并允许在多个区域和数据中心上分配负载.在每个区域或数据中心内,应有与负载平衡器耦合的应用程序网关,这样,应用程序网关将帮助确定要从中获取响应的应用程序服务器,而负载平衡器将有助于负载平衡.

In system architecture based on Azure, there is Azure Application Gateway which is a load balancer that runs on Layer 7 and provides more features than traditional load balancer ( Layer 4 ) in terms of routing traffic using routing decisions based on additional attributes of HTTP request or content of traffic. This can also be termed as an application load balancer. It shall be used in conjunction by Azure API Management (API gateway). Azure has a Traffic Manager for operating at DNS level which uses DNS to direct client requests to the most appropriate service endpoint based on a traffic-routing method and the health of the endpoints. Traffic manager also uses the rules configured at the DNS level and enables dstribution of the the load over multiple regions and data centers. Within every region or data center, there shall be application gateways coupled with load balancers such that, the application gateways shall help in determining the application server to fetch response from and the load balancer shall help in load balancing.

基于Azure的系统概述:

System overview based on Azure :

以下是一些相关参考文献:

Here are few related references:

  1. Azure应用程序网关- https://docs.microsoft.com/zh-CN/azure/application-gateway/application-gateway-introduction

Azure负载平衡器- https://docs.microsoft.com/zh-CN/azure/load-balancer/load-balancer-overview

Azure Load Balancer- https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-overview

Azure Traffic Manager- https://docs.microsoft.com/zh-CN/azure/traffic-manager/traffic-manager-overview

Azure Traffic Manager - https://docs.microsoft.com/en-us/azure/traffic-manager/traffic-manager-overview

场景架构- https://docs.microsoft.com/zh-CN/azure/traffic-manager/traffic-manager-load-balancing-azure

这篇关于负载平衡器和API网关混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 12:49