On the RPC

RPC(Remote Procedure Call)

Remote procedure call protocol, which is a request for service from a remote computer through a network, without the need to understand the underlying network protocol technology.
Personally I feel that simply makes no sense to talk about RPC. RPC RPC should be divided, the frame RPC, the RPC generalized protocol (let's call after two narrow RPC)

RPC in a broad sense

The so-called broadly-defined RPC call service on a remote computer over a network can be called according to RPC. So the explanation of any accord should belong to the RPC. Including common web services personally feel that in fact can be understood as RPC.

RPC (architecture) framework

RPC framework principles

PRC architectural components

A complete RPC architecture which includes four core components, namely, Client, Client Stub, Server and Server Stub, this can be understood as Stub stub.

1. The client (Client), caller services.
2. The client stub (Client Stub), storing the address of the message server, the client request parameters and then packaged into a network message, and then sent to the serving network via the remote.
3. server (Server), a true service provider.
4. The server stub (Server Stub), the client receives the message sent by the message unpacked and a local method call.

PRC architecture procedure call

(Image Source:
(1) The client (client) in a local calling mode (i.e. mode interface) call services;
(2) the client stub (client stub) receiving the call, the charge of the methods, parameters and the like is assembled to be able to perform network transmission message body (the target sequence into a binary message body);
(3) the client sends a message to the server via Sockets;
(. 4) the server stub (server stub) to decode after receiving the message (the message object to deserialize );
(5) the server stub (server stub) call the local service based on the decoding result;
(6) local service execution and returns the result to the server stub (server stub);
(. 7) the server stub (server stub) the return result packed into a message (the result message object serialization);
(8) the server (server) sends a message to the client via Sockets;
(. 9) client stub (client stub) receiving the result message, and decodes ( the result message is sent serialization);
(10) the client (client) to give the final result.

RPC goal is to make these steps are encapsulated 2,3,4,7,8,9

Common RPC framework and classification

1. From the communication protocol level, can be divided into:
HTTP-based protocol (e.g., text-based SOAP (XML), Rest (JSON ), based on the binary Hessian (Binary))
based on TCP protocol (usually by means of Mina, Netty and other high-performance network frame)

2. From the different levels of development languages and platforms, divided into:
single language or platform-specific support communications technology (such as RMI Java platform, .NET platform Remoting)
supports cross-platform communication technology (such as HTTP Rest, Thrift, etc.)
3. from the calling process point of view, is divided into:
synchronous communication call (synchronous RPC)
asynchronous communication calls (the MQ, asynchronous RPC)

RPC common frame (Technical) (in no particular order)
1.Netty
Netty frame RPC is not limited to, more network protocol is implemented as a framework, such as HTTP, an RPC requires an efficient communications network, it is possible Netty selected as the base.
2.brpc
BRPC is based protobuf RPC interface framework, within the Baidu is called "baidu-rpc", which encompasses all internal Baidu RPC protocol, and supports a variety of third-party agreements.
3.Dubbo
Dubbo is a RPC framework developed by Alibaba, remote interface is based on Java Interface, relying on the Spring Framework
4.gRPC
Google developed high-performance, general-purpose open-source RPC framework, mainly for mobile application development and standards-based protocol designed HTTP2, based protoBuf (protocol Buffers) serialization protocol development, and support many development languages.
5.Thrift
Thrift is a project of the Apache (http://thrift.apache.org), formerly known as RPC is a framework developed by Facebook, using thrift as IDL (Interface description language).
6.jsonrpc
JSON-RPC is a stateless and lightweight remote procedure call (RPC) protocol.
7.RMI
talking about here is in Java RMI, rather than on the common sense RMI
RMI using JRMP (Java Remote Messageing Protocol), JRMP is designed for java custom communication protocols, so at ease pure java distributed solution Program
8.Hessian
the Hessian is a lightweight remoting onhttp tool, simple to use RMI provides the functionality. Compared WebService, Hessian more simple and fast. It is in binary RPC protocol, because the use of binary protocol, so it is well suited for the transmission of binary data.
9.motan
Weibo a Java open source framework. It was born relatively late, starting in 2013, in May 2016 revenue. Motan has been widely used in micro-blog platform, nearly 100 billion a day to complete the call for hundreds of service
10.SpringCloud

RPC relatively common framework

(Personal use much less experienced, only used one or two, please self Baidu, please leave a message if a good article also inform subsequent supplement)

RPC protocol

(Baidu Encyclopedia)
RPC protocol
English original meaning: Remote Procedure Call Protocol
Chinese Interpretation: (RFC-1831) remoting protocol, originally defined by RFC-1050.
Note: one kind of service requests from a remote computer through a network, without having to understand the underlying network protocol technology.
RPC protocol is assumed that there is some transmission protocols, such as TCP or UDP, this is the communication between information carrying program data. In the OSI model, network communications, RPC across the transport layer and application layer. RPC allows the development of applications, including network distributed multi-program, including easier.

Remote Procedure Call (RPC) protocol information from two different structures: the call information and reply information.

RPC call information form the body following:
struct call_body {
unsigned int rpcvers;
unsigned int PROG;
unsigned int Vers;
unsigned int proc;
the opaque_auth the cred;
the opaque_auth Verf;
. 1 Parameter
2 Parameter...
};

RPC reply messages in the form of the following: 
enum {STAT reply_stat
MSG_ACCEPTED = 0, 
MSG_DENIED =. 1 
};

MVC architecture, RPC architecture, SOA architecture, micro-architecture distinguished service

(Transfer from
https://blog.csdn.net/lmaosheng/article/details/88337678
http://www.pianshen.com/article/8405242110/)
Here Insert Picture Description

Monomers architecture

MVC(Model View Controller)

M is a business model, the user interface means V, C is the controller, the purpose is to use the MVC M and V implementation code separation, so that the same program can use different forms. The purpose is to ensure the presence of C M and V sync, once changed M, V should be synchronized.
When the traffic gradually increased, a single application to bring the machine to increase acceleration getting smaller and smaller, the application is split into several disparate applications to improve efficiency.
When the business scale is very small, all features are deployed in the same process, load or diversion by dual front load balancer.
At this time, to accelerate the front page Development, mvc separate front and back frame logic is the key.
On behalf of technology: Struts2, springMVC, Spring, Mybatis etc.

Multi-service architecture

RPC (Remote Procedure Call) Remote Procedure Call

RPC (Remote Procedure Call) Remote Procedure Call, he is a request for service from a remote computer through a network, without the need to understand the underlying network protocol technology.

As more and more vertical applications, the inevitable interaction between applications, will be drawn out of the core business, as an independent service, and gradually form a stable service center, the front-end applications to more quickly respond to changing market demands.

At this time, for increasing the frame RPC service multiplexing and splitting is critical.

SOA (Service Oriented Architecture) Service-Oriented Architecture

ESB (Enterparise Service Bus) enterprise service bus, service agency. Mainly to provide a service to the interaction between services. ESB is simply a conduit for connecting the respective serving node. In order to integrate different systems, different service agreement, ESB done transformation and routing work to explain the message, so that different services interoperability.

ESB includes features such as: load balancing, flow control, encryption, monitoring services, exception handling, monitoring emergency.

As more and more services, capacity assessment, waste of resources and other small service issues is gradually emerging, this time a dispatch center based on the need to increase access to real-time pressure management cluster capacity, improve cluster utilization.

Governance and service lifecycle management and control running state becomes the bottleneck.

In this case, for improving machine utilization, improve quality of service (resource scheduling and control center) SOA service governance is the key.

SOA architecture features:

1. System Integration: standing system point of view, to solve communication problems between enterprise systems, the original scattered, unplanned network structure between systems, carded regular inter-system governance star structure, this step is often needed introduce some products, such as ESB, as well as technical standards, service management practices; to address the core issue of this step is [ordered]

2. The system of services: a functional point of standing, the abstract service logic into a reusable, assemblable service, fast reproduction service through the service orchestration, objects: the inherent original business functions into common service service, rapid re-use of business logic; this step to solve the core problem is the [reuse]

3. Services of business: standing business point of view, the corporate functions abstracted into reusable, composable services; the original functions of the enterprise architecture into a service-oriented enterprise architecture, to further enhance the ability of external services; "from a technical perspective are the first two steps to solve the system call, the system function reuse problem." A third step, the package is based on a service drive unit into a service business. This step is to solve the core problem is [efficient]

Micro Services Architecture (lightweight service management program)

Micro service is on SOA to do sublimation, a focus on micro-services architecture is emphasized that "business needs to complete assembly and service" of the original single business system can be split into multiple independent development, design, operation small application. These small applications through service between the completion of interaction and integration.

Micro service is actually a lightweight service management solutions.

Micro Services Architecture is an architectural pattern, he advocated a single application into a set of smaller services, co-ordination between services, complement each other, providing the ultimate value for the user. Each service runs in its separate process, the inter-service and service uses lightweight communication mechanism to communicate with each other (usually Restful API based on HTTP protocol). Each service around the specific business to build, and can be independently deployed to the production environment. In addition, we should try to avoid a unified, centralized service management mechanism, for a specific service should be based on the business context, select the appropriate language tools for their building.

With agile development, continuous delivery, the development of the theory and practice of DevOps, and mature Docker and other lightweight container based on the deployment of applications and services, micro-service architecture became popular, becoming the future direction of evolution application architecture. By splitting atoms of services, as well as independent micro-packaged services, deployment and upgrade, a small team to deliver agile, application delivery cycle will be shortened, operating costs will be substantially reduced.

Micro Services Architecture Features:
1. Implementation of Component Services
need to coordinate the deployment of other services impact on the services developers no longer.
2. The ability to divide by business services and development teams
developers are free to choose the development of technology to provide services API
3. to the center of
each micro service has its own proprietary database persistence service data
each micro-services can only access their own databases , but can not access other services database
under certain business scenarios, we need to update multiple databases in a single transaction. This situation can not directly access the databases of other micro-services, but is operated by for micro services.
Decentralized data, further reducing the coupling between the micro-services, different services may employ different techniques database (SQL, NoSQL, etc.). In the complex business scenario, if the service includes a plurality of micro, usually a client or intermediate layer (gateway) processing.
4. Infrastructure automation (devops, automated deployment)
to apply to become a split of a single service, application Docker technology does not rely on any server and data model, is a full-stack application can be deployed independently by an automated fashion, each service runs in its own process, by contact lightweight communication mechanism, resources are often based on the HTTP API, these services are based on operational capacity building, to achieve centralized management.

Compared to SOA, more lightweight micro-services, on behalf of technology: dubbo SpringCloud
registry is a lightweight alternative to enterprise service bus registry representatives have zookeeper, eureka

Published 21 original articles · won praise 6 · views 30000 +

Guess you like

Origin blog.csdn.net/soulonlyhlh/article/details/104129508
RPC
RPC