In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!
Original link address: how to communicate between docker microservices (6)
From the point of view of communication mode
When it comes to communication, you may think: socket,http,tcp/ip,zookeeper, etc., so many things may feel messy together, provide an idea to consider the issue of micro-services, communication methods and communication protocols to consider.
The communication method is one-to-one (synchronous). It is especially common to request the corresponding mode, the most common one-to-one (asynchronous). When a service sends a notification, it does not need to wait for a response and does not need the other party to respond immediately. but get the other party's response through callback. There is no one-to-many (synchronous) scenario of one-to-many (asynchronous), publish subscribe way, publish asynchronous response. For example, Didi Taxi, when you call a car, the system will tell all the car owners who can accept the news that they will grab the order and send a response back, and they will know that the master has grabbed the order. Communication protocol REST API
Many people equate rest api with the interface design of http. In fact, they cannot directly equate the equal sign. Rest is a concept put forward a long time ago. Rest is the state transfer of the presentation layer, which few people can understand. In fact, rest is a form of interaction between the client and the server in the network. It itself is an abstract concept. It is mainly about how to design a rest api. Take http as an example, it uses the http protocol to implement api in the form of rest.
When processing requests from clients in Web applications, only two HTTP request methods, GET and POST, are usually considered. In fact, HTTP has request methods such as HEAD, PUT, DELETE, and so on. In REST architecture, different HTTP request methods are used to handle CRUD (create, read, update, and delete) operations on resources:
To create resources on the server, you should use the POST method.
To retrieve a resource, you should use the GET method.
To change or update the state of a resource, you should use the PUT method.
To delete a resource, you should use the DELETE method.
RPC
DubbomotandubboxgrpcthriftMQ
Message queuing is not often used in actual scenarios. For example, Didi Taxi mentioned earlier is the mode of message subscription.
How to choose a RPC framework
RPC is a situation with the largest number of micro-services, and there are more choices, and there are also many optional RPC frameworks. Choosing a RPC framework is a problem that needs to be faced.
Ipaw O, thread scheduling model
Performance of long connection, short connection, single thread, multithread, thread scheduling algorithm
The way to serialize
Readable (XML,JSON), binary (FASTJSON), why should we consider serialization, because the efficiency of the sequence directly affects the efficiency of our communication, expanding the serialization and deserialization time, the efficiency of RPC, the same object if serialization is small, then greatly improve the efficiency.
Multilingual support
According to the team language, if it is multilingual, you need to find a RPC framework that supports multiple languages, and if the single language, for example, is all java, the direct dubbo only supports java.
Service governance
For example, there is no service discovery, service monitoring, a RPC framework with service governance, which generally supports cluster deployment and high service availability.
What is the Dubbo/DubboX of the current process RPC framework
In October 2014, dubbo was no longer maintained, and dubbo started maintenance again after 3 years. On the one hand, it does have a large number of users. Second, micro-services are more popular and provide better support for micro-services. DubboX is a set of DubboX developed on the basis of Ali's dubbo. Only java language is supported.
Motan
A set of open source for Sina Weibo, carried out in May 2016, claims to support hundreds of billions of daily calls to Sina Weibo, and has distributed capabilities through spring calls without additional code. Only java language is supported.
Thrift
Developed by facebook in 2007 and entered the apche project in 2008, it is a cross-language. After all, for so many years, it supports everything you think of. There is nothing related to service governance.
GRPC
Google's open source project, similar to Thrift, also supports cross-language.
Contrast
PS: the essence of micro-service communication is RPC communication, which is more efficient and stable than http.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.