In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What is the difference between RPC remote invocation and message queuing MQ? to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
1. RPC
RPC (Remote Procedure Call) remote procedure call mainly solves the problem of remote communication and does not need to understand the communication mechanism of the underlying network.
RPC framework
The well-known ones are Thrift (FB) and dubbo (Ali).
RPC generally needs to go through four steps:
1. Establish communication
First of all, to solve the problem of communication: that is, if A machine wants to call B machine, it must first establish a communication connection, mainly by establishing a TCP connection between the client and the server.
2. Service addressing
To solve the addressing problem, how the A server connects to the B server (such as a host or IP address) and a specific port, and what is the name of the method.
3. Network transmission
1) Serialization
When the application on the A server initiates a RPC call, the calling method and parameter data need to be serialized first.
2) deserialization
When the B server receives the request from the A server, it needs to deserialize the received parameters and other information.
4. Service call
Server B gets the return value after making a local call (through the proxy Proxy). At this time, the return value needs to be sent back to server A, which also needs to be serialized, and then the binary data is sent back to server A through network transmission.
Typically, a complete PRC call needs to go through these four steps.
2. MQ (message queue)
Message queuing (MQ) is a communication model that can realize one-way communication between producers and consumers. Generally speaking, it refers to the middleware that implements this model.
Typical MQ middleware
RabbitMQ, ActiveMQ, Kafka, etc.
Typical features:
1. Decoupling
2. Reliable delivery
3. Broadcast
4. Final consistency
5. Peak cutting of flow
6. Guarantee of message delivery
7. Asynchronous communication (synchronous is supported)
8. improve the throughput and robustness of the system
Typical usage scenarios:
In the second kill service, MQ is used to achieve flow peak reduction, and application decoupling is used.
III. The difference and relationship between RPC and MQ
1. Architecturally, the difference between RPC and MQ is that Message has an intermediate node, Message Queue, that stores messages.
two。 Synchronous invocation: RPC is preferred for scenarios where you want to immediately wait for the processing result to be returned.
On the one hand, the use of 3.MQ is based on performance considerations, such as the server can not respond quickly to the client (or the client does not require real-time response) and needs to be cached in the queue. On the other hand, it focuses more on data transmission, so it has more diversified ways, in addition to peer-to-peer, there are subscriptions to publications and other functions.
4. And as the business grows, the processing capacity of some processors will become a bottleneck, and synchronous calls will be transformed into asynchronous calls. At this time, you can consider using MQ.
This is the answer to the question about what is the difference between RPC remote call and message queuing MQ. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.