简体   繁体   English

微服务 API 网关与微服务机箱

[英]Microservices API gateway vs. Microservices Chassis

I am new to microservices, I heard about microservices chassis but I cant find enough resources online.我是微服务新手,听说过微服务机箱,但在网上找不到足够的资源。 I would like to know what is the difference between microservices chassis framework and API gateway because as far as I know chassis frmework solves cross-cutting concern problems and some of them are already solved by API gateway .我想知道微服务机箱框架和 API 网关之间有什么区别,因为据我所知,机箱框架解决了横切关注问题,其中一些已经通过 API 网关解决了。

is there any recommendations for a microservices chassis framework for .net ?对.net 的微服务机箱框架有什么建议吗?

Cross cutting concerns : In any enterprise application, there are a number of concerns which need to be taken care of in addition to the main business logic.横切关注点:在任何企业应用程序中,除了主要业务逻辑之外,还有许多需要关注的问题。 ... Such concerns are logging, transaction handling, performance monitoring, security etc. These concerns are known as cross cutting concerns of the application. ... 这些关注点是日志记录、事务处理、性能监控、安全性等。这些关注点被称为应用程序的横切关注点。

To clarify this means that almost all micro-services has some common concerns.澄清这一点意味着几乎所有的微服务都有一些共同的关注点。 These concerns and how to manage them is Chassis.这些问题以及如何管理它们就是机箱。 A microservice chassis is one such way to implement these cross-cutting concerns.微服务机箱就是实现这些横切关注点的一种方式。 Building a reusable chassis can help save time, enforce consistency across teams, and ensure that each service shares the same operational charateristics.构建可重复使用的机箱有助于节省时间、加强团队之间的一致性,并确保每个服务共享相同的操作特性。

API gateway has other role in microservices. API 网关在微服务中还有其他作用。 After each service registers itself in discovery service, API gateway has to use discovery service to make connection between clients and each service.每个服务在发现服务中注册自己后,API网关必须使用发现服务在客户端和每个服务之间建立连接。

See this example:看这个例子:

微服务架构

The above example is from Spring implementation (Java).上面的例子来自 Spring 实现(Java)。

Imagine situation when each service is in different port and address.想象一下当每个服务在不同的端口和地址时的情况。 Then the client must know all the addresses and ports of each service to be able to call them.然后客户端必须知道每个服务的所有地址和端口才能调用它们。 And what happens if any of them change?如果其中任何一个发生变化,会发生什么? Everything is just ruined.一切都只是毁了。

To work around this problem, each service registers itself on a discovery server (in this example Eureka ).为了解决这个问题,每个服务都会在发现服务器上注册自己(在本例中为Eureka )。 API-Gateway then has to use that discovery service and create API addresses for each service. API-Gateway 然后必须使用该发现服务并为每个服务创建 API 地址。 For example, it could forward any request in this pattern: /{micro_service_name}/** , to related registered service.例如,它可以将以下模式中的任何请求转发给相关的注册服务: /{micro_service_name}/** This means if order-service has /orders/get/{order-id} API, then clients must use /order-service/orders/get/{order-id} to access an order.这意味着如果order-service具有/orders/get/{order-id} API,那么客户端必须使用/order-service/orders/get/{order-id}来访问订单。 API-gateway uses discovery server to redirect the request to matching service. API 网关使用发现服务器将请求重定向到匹配的服务。

API Gateway in Microservices Architecture is mostly related to service discovery, that means in order to know which service to be called from which end-point one easy but insufficient way is to use API Gateway, simple a database of all services with their address and ports, compare this with containerization technology such as Docker .微服务架构中的 API 网关主要与服务发现相关,这意味着为了知道从哪个端点调用哪个服务,一种简单但不够的方法是使用 API 网关,简单的所有服务及其地址和端口的数据库,将此与Docker等容器化技术进行比较。 Following are a set of articles that published about microservices in code-project, you can read and comment on your questions if you like.以下是一组关于code-project中微服务的文章,如果你喜欢,可以阅读和评论你的问题。
https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-I https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-II https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-III https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-I https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-II https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-III

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM