What is RPC, RPC benefit, common RPC framework

RPC Introduction

RPC (Remote Procedure Call Protocol) remote procedure call protocol. A popular description is: client without knowing the details of the call, call an object exists on the remote computer, like objects in the local application of the same call. More formal description is: A request for service from a remote computer through a network, without the need to understand the underlying network protocol technology. So at least we dig from that description in a few points:

  • RPC is a protocol : protocol since it is just a set of norms, then we need someone to follow this set of specifications to achieve. Typical current RPC implementation include: Dubbo, Thrift, GRPC, Hetty and so on. Here to explain, current technology trends point of view, to achieve the RPC protocol application tools will often add other important functions.

  • Network protocols and network IO model for its transparent : Since RPC clients think they are calling a local object. Then the transport layer using the TCP / UDP or HTTP protocol, or some other network protocols do not need to care about it. Since its transparent network protocols, the call process, the use of what kind of network IO model the caller does not need to be concerned.

  • Information format for its transparent : we know in the local application, for an object invocation need to pass some parameters and returns a result of the call. As for how the internal called object is to use these parameters and calculate the result of the processing, the caller does not need to be concerned about. So for long-distance calls, these parameters are passed to format certain types of information to another computer on the network, this is what constitutes the message format, the caller does not need to be concerned about.

  • There should be cross-language capabilities : Why do you say? Because the caller is actually also unclear remote server application is running what language to use. So for the caller, no matter what server-side language is used, this call should be successful, and the return value should be described in the form of caller programming language can understand.

Why use RPC

In fact, this is the application development to a certain stage of strong demand driven.

  1. If we develop a simple single application logic is simple, user little, little traffic, then we do not need;

  2. When our system traffic increases, the increase in business, we will find a stand-alone operation of this system has been unable to afford. In this case, we can split the traffic into several unrelated applications, are deployed on each machine, and reducing the pressure to draw logic. At this point, we can also do not need to RPC, because between applications is unrelated.
  3. When our business more and more, more and more applications for a long time, naturally, we will find that some functions simply can not be divided or partitioned off does not come out. In this case, the public business logic can be pulled out, it will form an independent service Service application. And the original, the new application can be independent of those applications interact with the Service, in order to complete a full business functionality. So this time, we urgently need an efficient means of communication between the application to complete this demand, so you see, RPC show their talents here!
    In fact, 3 scenes described is as a service, infrastructure services and micro-scenes distributed systems architecture. That RPC framework is a powerful way to achieve the above structure.

RPC common framework

RPC framework currently used as follows:

  1. Thrift : Thrift is a software framework for scalable, and perform cross-language development services. It combines powerful software stack and code generation engine to build between C ++, Java, Python, PHP , Ruby, Erlang, Perl, Haskell, C #, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml these programming languages seamless integration, and efficient service.

  2. 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.

  3. 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.

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

Guess you like

Origin www.cnblogs.com/xzy-/p/11131678.html
RPC
RPC