What RPC is? (Study notes)

What is RPC?

  • RPC stands for Remote Procedure Call, namely remote procedure call is to function as a local call to the same tune remote function, shielding the complexity of remote calls.

Why RPC?

  • Micro service, the development of distributed applications more and more common, RPC service calls can be resolved between the nodes and communication problems.
  • Management functions, such as connection management, health monitoring, load balancing, elegant Kai shutdown, abnormal retry, business groups and limiting fuse and so on.

A complete RPC to go through those processes?

  • 1. Serialization : RPC is a remote call, it is necessary to transmit data over the network. Requesting access to the caller's arguments are objects requires a sequence of binary objects that can be transmitted.
  • 2. Data transmission : Caller binary data to the service provider, RPC usually default to TCP to transport because of its reliability.
  • 3. deserialization : According to a particular protocol , the service provider can correctly segmented different requests from binary data, while according to the request type and sequence types, the message body to reverse binary reduced to the requested object.
  • 4. Method Invocation : The request object deserialized obtained, find the corresponding class, method call is completed.
  • The return request : after the execution result of the sequence, the TCP channel is written back to the corresponding inside. After the caller to get a response to the packet, and then the anti-serialized response objects, so the caller completed a RPC call.
  • On the basis of these, can be simplified, complicated operations in which not a concern, such as the sequence of the caller, calling network transmission, deserialization. Spring AOP can be like the same, using a dynamic agent technology, a method of enhancing bytecode intercept enhanced, so that additional processing logic required for the operation can be solved by dynamic agent.
  • Service interface declaration given by the service provider, in which the caller program, the RPC frame generating dynamic proxy service interface implementation classes invoked in advance and injected into statements related business logic through the interface which dependency injection techniques. The agency implementation class intercepts all method calls, method of processing logic provides complete inside a set of remote calls, and the remote call returns to the caller, so the caller when you call a remote method invocation like to get a local experience the same interface.

                         

The most commonly used RPC framework:

  1. Dubbo : Dubbo is a distributed service framework and SOA governance program. Its functions include: NIO high-performance multi-protocol communication and integration, service dynamic addressing and routing, load balancing and fault tolerance soft, dependency analysis and demotion. Dubbo is the core framework of the internal Alibaba SOA service governance program, Dubbo open since 2011, has been used by many non-Ali Company.

  2. Cloud the Spring : the Spring Cloud from a number of sub-projects, such as the Spring Cloud Config, Spring Cloud Netflix, Spring Cloud Consul , etc., provides a common tool for building distributed systems and micro-services such as configuration management, service discovery, circuit breakers, intelligent routing , micro broker, a control bus, a one-time token, global lock, the main election, distributed session and cluster status, meets all the solutions needed to build micro-services. Spring Cloud-based Spring Boot, allowing developers to deploy extremely simple.

  3. GRPC : a beginning, developed by google, is a language-neutral, platform-neutral, open-source remote procedure call (RPC) system.

  4. Thrift  : is a lightweight cross-language RPC communications program to support up to 25 programming languages.

Guess you like

Origin www.cnblogs.com/jiezai/p/12355122.html