官术网_书友最值得收藏!

Tools for synchronous communication

The most common form of direct communication between microservices is using the HTTP protocol with Rest and passing JavaScript Object Notation, the famous JSON. Communication works great for APIs, providing endpoints for external consumption. However, communication using HTTP with JSON has a high cost in relation to performance.

First, this is because in the case of communication between microservices, it would be more appropriate to optimize than the HTTP protocol creating some sort of pipeline or keeping the connection alive. The problem is the control of the connection timeout, which shouldn't be very strict, and in addition could start to close doors, threads, or processes with a simple silent error. The second problem with this approach is the serialization time of JSON sent. Normally this is not an inexpensive process. Finally, we have the packet size sent to the HTTP protocol. In addition to JSON, there are a number of HTTP headers that should be interpreted further which may be discarded. Look closer; there's no need to elaborate  on protocols between microservices, the only concern should be to maintain a single layer for  sending and receiving messages. Therefore, the HTTP protocol with JSON to communicate between microservices can be a serious slow point within the project and, despite the practicality of implementation of the protocol, the optimization is complex to understand yet not very significant.

Many would propose the implementation of communication sockets or WebSockets but, in the end, the customization process of these communication layers is very similar to the classic HTTP.

Synchronous communication layers between microservices must complete three basic tasks:

  • Report practice and direct the desired messages
  • Send simple, lightweight packages and fast serialization
  • Be practical to maintain the signature of communication endpoints

A proposal that meets the aforementioned requirements communicates using binary or small-size packages.

Something important to point out when it comes to working with this type of protocol is that, usually, they are incompatible with each other. This means that the option chosen as the tool for serialization and submission of these small-sized packages should be compatible with the stack of all microservices.

Some of the most popular options on the market are:

Let us understand how each of these options works to see what best fits on our news portal.

主站蜘蛛池模板: 双桥区| 桂林市| 察隅县| 仪征市| 南投县| 株洲市| 兴和县| 博野县| 万源市| 安溪县| 淳化县| 鹤壁市| 河北区| 秭归县| 蓬莱市| 临沧市| 濮阳县| 乌什县| 上饶市| 离岛区| 七台河市| 葵青区| 清水县| 湘阴县| 丹凤县| 抚远县| 锡林浩特市| 永兴县| 丹江口市| 禹城市| 莱州市| 依安县| 木里| 岗巴县| 佛山市| 上饶市| 朔州市| 定州市| 高陵县| 琼海市| 夏河县|