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

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.

主站蜘蛛池模板: 崇明县| 固镇县| 巴南区| 修文县| 枝江市| 石屏县| 井研县| 漳平市| 上饶市| 莒南县| 耿马| 榆中县| 北宁市| 芜湖市| 招远市| 吴川市| 丹凤县| 尚志市| 读书| 珲春市| 枞阳县| 安塞县| 信阳市| 安化县| 无棣县| 五河县| 泰顺县| 乌什县| 金乡县| 遂平县| 清水县| 白沙| 麦盖提县| 景德镇市| 荆州市| 衡东县| 桂林市| 夏河县| 红桥区| 娄底市| 绿春县|