RPC and the famous MQ in the end what's the difference and contact

RPC (Remote Procedure Call) Remote Procedure Call, mainly to solve the communication problems between the remote does not need to understand the underlying mechanisms of communication networks.

RPC framework

High visibility have Thrift (FB's), dubbo (Ali).

RPC and the famous MQ in the end what's the difference and contact

 

RPC generally go through four steps:

1, establish communication

We must first solve the problem of communication: A machine that is the machine you want to call B, must first establish a communication connection, primarily by establishing a TCP connection between the client and the server.

2. Services Addressing

To solve the problem addressed, how to connect the server A to the server B (e.g., host or IP address) and the name of any particular port, the method Yes.

RPC and the famous MQ in the end what's the difference and contact

 

3, network transmission

1) sequence of

When an application on the server A initiates a RPC call, data call methods and parameters need to be serialized.

2) deserialization

When the server receives a request B A server, information and parameters needed docking deserialize the received operation.

4, service call

After a local call to the server B (via proxy Proxy) to obtain a return value and then returns the value required at this time is sent back to the server A, also need to go through a sequence of operations, then the binary data transmission through the network is sent back to the server A.

Typically, a full PRC calls to go through the above four steps.

The MQ (Message Queue)

Message Queue (MQ) is a communication model enables the producer to the consumer one-way communication, generally refers to this model to achieve the middleware.

Typical MQ middleware:

RabbitMQ、ActiveMQ、Kafka等

Typical features:

1, decoupling

2, reliable delivery

3, broadcast

4, eventual consistency

5, flow clipping

6, message delivery guarantee

7, asynchronous communication (support synchronous)

8, improve system throughput, robustness

Typical usage scenarios: to achieve traffic clipping, and the application of decoupling use in business spike use MQ.

And the difference between RPC and the associated MQ

1. In architecture, RPC and points of difference are MQ, Message intermediate node has a Message Queue, the message can be stored.

RPC and the famous MQ in the end what's the difference and contact

 

2. synchronous call: immediately return to the scene to wait for the processing result, RPC is preferred.

3.MQ use, one is based on performance considerations, such as the server can not respond fast client (or the client does not require real-time response), need to cache in the queue.

On the other hand, it is more focused on transmission of data, and therefore way more diverse, in addition to the point, there are subscriptions to the publication and other functions.

4. And with business growth, and some processing terminal handling capacity will become a bottleneck, will be transformed into a synchronous call an asynchronous call, this time to consider using MQ.

Guess you like

Origin www.cnblogs.com/cangqinglang/p/11683247.html