微服务之间的通信 [英] Communication Between Microservices

查看:120
本文介绍了微服务之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有微服务A,B和C,它们当前都通过HTTP进行通信.说服务A向服务B发送请求,结果是响应.然后,必须将在该响应中返回的数据发送到服务C进行一些处理,然后才最终将其返回到服务A.服务A现在可以在网页上显示结果.

Say you have microservice A,B, and C which all currently communicate through HTTP. Say service A sends a request to service B which results in a response. The data returned in that response must then be sent to service C for some processing before finally being returned to service A. Service A can now display the results on the web page.

我知道延迟是实现微服务体系结构的固有问题,我想知道有什么常见的方法可以减少这种延迟?

I know that latency is an inherent issue with implementing a microservice architecture, and I was wondering what are some common ways of reducing this latency?

此外,我一直在阅读有关Apache Thrift和RPC如何提供帮助的内容.任何人都可以对此进行详细说明吗?

Also, I have been doing some reading on how Apache Thrift and RPC's can help with this. Can anyone elaborate on that as well?

推荐答案

此外,我一直在阅读有关Apache Thrift和RPC如何提供帮助的内容.任何人都可以对此进行详细说明吗?

Also, I have been doing some reading on how Apache Thrift and RPC's can help with this. Can anyone elaborate on that as well?

像Apache Thrift这样的RPC框架的目标是

The goal of an RPC framework like Apache Thrift is

  • 显着减少手动编程开销
  • 提供有效的序列化和传输机制
  • 跨各种编程语言和平台

换句话说,这允许您将数据作为非常紧凑的写入和压缩数据包通过网络发送,而实现此目标所需的大部分工作都由框架提供.

In other words, this allows you to send your data as a very compactly written and compressed packet over the wire, while most of the efforts required to achieve this are provided by the framework.

Apache Thrift为您提供了可插入的传输/协议堆栈,可以通过插入不同的

Apache Thrift provides you with a pluggable transport/protocol stack that can quickly be adapted by plugging in different

  • 传输(套接字,HTTP,管道,流等)
  • 协议(二进制,紧凑,JSON等)
  • 图层(成帧,多路传输,gzip等)

此外,根据目标语言,您会获得服务器端的一些基础结构,例如TNonBlocking或ThreadPool服务器等.

Additionally, depending on the target language, you get some infrastructure for the server-side end, such as TNonBlocking or ThreadPool servers, etc.

因此,回到您的第一个问题,这样的框架可以帮助使沟通更轻松,更高效.但这无法神奇地消除OSI堆栈其他部分的延迟.

So coming back to your initial question, such a framework can help to make communication easier and more efficient. But it cannot magically remove latency from other parts of the OSI stack.

这篇关于微服务之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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