CN109756461A - A kind of remote procedure calling (PRC) method based on NETTY - Google Patents
A kind of remote procedure calling (PRC) method based on NETTY Download PDFInfo
- Publication number
- CN109756461A CN109756461A CN201711081741.7A CN201711081741A CN109756461A CN 109756461 A CN109756461 A CN 109756461A CN 201711081741 A CN201711081741 A CN 201711081741A CN 109756461 A CN109756461 A CN 109756461A
- Authority
- CN
- China
- Prior art keywords
- rpc
- client
- interface
- response message
- request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Computer And Data Communications (AREA)
Abstract
The present invention relates to a kind of remote procedure calling (PRC) methods based on NETTY, define RPC request message, response message structure first, interface definition module, far call class name, method name, argument structure, parameter value including RPC;The mapping relations for realizing class object with RPC interface are defined when server-side initializes by container load RPC interface, then client are waited to initiate call request;The RPC message that client is initiated gives RPC service end in a manner of byte stream, RPC service termination receives after request, corresponding receptacle is gone to search the specific implementation object of client-side interface mapping, the example for creating the object by reflection mechanism, and calling processing result is returned, it is finally packaged into RPC response message and notifies client;Client receives the RPC response message of byte stream form, after being unpacked, being parsed, shows far call result.
Description
Technical field
The present invention relates to technical field of the computer network, and in particular to a kind of remote procedure calling (PRC) method based on NETTY.
Background technique
RPC (Remote Procedure Call Protocol) --- remote procedure call protocol is that one kind passes through net
Network requests service from remote computer program, the agreement without understanding underlying network technology.RPC agreement assumes certain biographies
The presence of defeated agreement carries information data such as TCP or UDP between signal procedure.In OSI network communication models, RPC across
Transport layer and application layer are got over.RPC is more easier the application programming developed including network distribution type multiprogram.
RPC uses Client/Server pattern.Requestor is a client computer, and service providing program is a clothes
Business device.Then there is the recalls information of process parameter to service processes firstly, client calls process sends one, the letter to be answered such as
Breath.In server end, process keeps sleep state until recalls information reaches.When a recalls information arrival, server
Acquisition process parameter, calculated result send reply message, next recalls information are then waited, finally, client call process
Reply message is received, proceeding results are obtained, then execution is called to continue.
Typical RPC realizes that frame has at present: Thrift (facebook open source), Dubbo (alibaba open source) etc..
RPC frame for the encapsulation of network protocol, network I/O model be it is transparent, the client of calling think oneself call it is local
An object.
Whether measuring the quality of a RPC frame performance, the selection of the network I/O model of RPC is most important.In this base
On plinth, the RPC service device that designs, it may be considered that support the synchronous IO of block type, the synchronous IO of non-block type, multiplexing IO mould
Type, asynchronous I/O model.It supports different network I/O models, very big difference is had in the state of high concurrent, in process performance.
Traditional RPC frame or the remote service (process) based on modes such as RMI are called because using synchronous obstruction
IO, after the concurrent pressure or network delay of client increase, synchronous obstruction IO can lead to IO line due to frequently waiting
The regular obstruction of journey, so as to cause the decline of I O process ability.
Summary of the invention
The invention face above problem proposes a kind of remote procedure calling (PRC) method based on NETTY, using asynchronous non-obstruction
Mode improves communication efficiency to solve the problems, such as that I O process ability declines.
Technical scheme is as follows:
A kind of remote procedure calling (PRC) method based on NETTY, which comprises the following steps:
(1) RPC request message, response message structure are defined, the inside includes the interface definition module including long-range tune of RPC
Class name, method name, argument structure, parameter information;
(2) mapping that class object is realized with RPC interface is defined when server-side initializes by container load RPC interface
Then relationship waits client to initiate call request;
(3) class name, method name, argument structure, parameter value comprising far call inside the RPC message that client is initiated
Information is given RPC service end in a manner of byte stream and is gone after RPC service terminates the request for receiving byte stream by network
Corresponding receptacle searches the specific implementation object of client-side interface mapping;
(4) parameter information for realizing object, the example for creating the object by reflection mechanism are found in RPC service end, and return
Readjustment processing is as a result, finally being packaged into RPC response message notifies client;
(5) client receives the RPC response message of byte stream form by network, after being unpacked, being parsed, display
Far call result.
The present invention has polymerize multiplexer, concurrent processing multiple client can connect simultaneously, all due to read-write operation
It is non-obstruction, can sufficiently promotes the operational efficiency of IO thread, avoids thread suspension caused by blocking due to frequent IO.Separately
Outside, since this agreement uses asynchronous communication model, an IO thread can be connected and be read and write behaviour with concurrent processing multiple client
Make, this fundamentally solves conventional synchronization obstruction one threading model of the connection of IO mono-, the performance of framework, elastic telescopic ability and can
Great promotion has all been obtained by property.
Detailed description of the invention
Fig. 1 is implementation schematic diagram of the invention.
Specific embodiment
This agreement handles IO by the way of asynchronous non-obstruction, when needing while handling multiple client access request,
It can use multithreading or IO multiplexing technique handled.IO multiplexing technique is by being multiplexed the obstruction of multiple IO
Onto the same obstruction, so that system can handle multiple client request simultaneously in the case where single thread.With tradition
Multithreading/multi-process model ratio, I/O multiplexing sharpest edges be that overhead is small, system does not need to create new volume
Outer process or thread do not need the operation for safeguarding these processes and thread yet, reduce the maintenance workload of system, save
System resource.
As shown in Figure 1, client concurrently initiates RPC call request, then RPC service end uses NETTY connector, assigns
Multiple NIO connection threads out, this when, the task of NETTY connector terminated.Then NIO connection thread is uniformly to be put into
NETTY NIO processing thread pool is managed, specific RPC can be requested inside this thread pool connection carry out message coding,
Source codec, Message Processing etc. sequence of operations.When finally carrying out Message Processing (Handler), consider in performance,
The design of this agreement is, directly complicated message processing procedure, to give special RPC business processing thread pool centralized processing,
Then the corresponding NIO thread of Handler just returns immediately, will not block.This when of RPC calling terminates, and client can be asynchronous
The processing result of server-side message is waited, this agreement is realized by message callback mechanism.
The specific embodiment of this agreement is as follows:
(1) define RPC request message, response message structure, the inside will including RPC interface definition module include remotely
The information such as class name, method name, argument structure, the parameter value of calling.
(2) mapping that class object is realized with RPC interface is defined when server-side initializes by container load RPC interface
Then relationship waits client to initiate call request.
It (3) include the class name of far call, method name, argument structure, parameter inside the RPC message that client is initiated
The information such as value give RPC service end by network in a manner of byte stream, RPC service termination receive byte stream request it
Afterwards, corresponding receptacle is gone, the specific implementation object of client-side interface mapping is searched.
(4) parameter information for realizing object, the example for creating the object by reflection mechanism are found in RPC service end, and return
Readjustment processing is as a result, finally being packaged into RPC response message notifies client.
(5) client receives the RPC response message of byte stream form by network, after being unpacked, being parsed, display
Far call result.
Claims (1)
1. a kind of remote procedure calling (PRC) method based on NETTY, which comprises the following steps:
(1) RPC request message, response message structure are defined, the inside includes the interface definition module of RPC, including far call
Class name, method name, argument structure, parameter information;
(2) it is defined when server-side initializes by container load RPC interface and realizes that the mapping of class object is closed with RPC interface
Then system waits client to initiate call request;
(3) class name comprising far call, method name, argument structure, parameter value letter inside the RPC message that client is initiated
Breath gives RPC service end by network in a manner of byte stream, after RPC service terminates the request for receiving byte stream, goes pair
The receptacle answered searches the specific implementation object of client-side interface mapping;
(4) parameter information for realizing object, the example for creating the object by reflection mechanism are found in RPC service end, and return to tune
With processing as a result, finally being packaged into RPC response message notifies client;
(5) client receives the RPC response message of byte stream form by network, and after being unpacked, being parsed, display is long-range
Call result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711081741.7A CN109756461A (en) | 2017-11-06 | 2017-11-06 | A kind of remote procedure calling (PRC) method based on NETTY |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711081741.7A CN109756461A (en) | 2017-11-06 | 2017-11-06 | A kind of remote procedure calling (PRC) method based on NETTY |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109756461A true CN109756461A (en) | 2019-05-14 |
Family
ID=66399594
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711081741.7A Pending CN109756461A (en) | 2017-11-06 | 2017-11-06 | A kind of remote procedure calling (PRC) method based on NETTY |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109756461A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110287040A (en) * | 2019-06-26 | 2019-09-27 | 苏宁消费金融有限公司 | A kind of realization system of remote call service frame |
CN112035276A (en) * | 2020-08-06 | 2020-12-04 | 上海视云网络科技有限公司 | Java-based cross-platform extensible Remote Procedure Call (RPC) framework design method |
CN112148500A (en) * | 2020-05-18 | 2020-12-29 | 南方电网数字电网研究院有限公司 | Netty-based remote data transmission method |
CN112446654A (en) * | 2019-08-29 | 2021-03-05 | 北京京东尚科信息技术有限公司 | Map display method, map display device, map display equipment and storage medium |
CN113391860A (en) * | 2020-03-11 | 2021-09-14 | 北京字节跳动网络技术有限公司 | Service request processing method and device, electronic equipment and computer storage medium |
CN113709085A (en) * | 2020-05-22 | 2021-11-26 | 成都鼎桥通信技术有限公司 | Remote procedure call processing method, device and equipment |
CN114327951A (en) * | 2021-12-30 | 2022-04-12 | 上海众人智能科技有限公司 | Modularized data management system based on multi-semantic expression |
CN114422488A (en) * | 2022-01-24 | 2022-04-29 | 北京理工大学重庆创新中心 | Multi-thread message processing method based on netty framework |
CN115442350A (en) * | 2022-07-29 | 2022-12-06 | 中国人民解放军63892部队 | Remote procedure call implementation method for LVC-DE distributed synthetic environment |
-
2017
- 2017-11-06 CN CN201711081741.7A patent/CN109756461A/en active Pending
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110287040A (en) * | 2019-06-26 | 2019-09-27 | 苏宁消费金融有限公司 | A kind of realization system of remote call service frame |
CN112446654A (en) * | 2019-08-29 | 2021-03-05 | 北京京东尚科信息技术有限公司 | Map display method, map display device, map display equipment and storage medium |
CN113391860A (en) * | 2020-03-11 | 2021-09-14 | 北京字节跳动网络技术有限公司 | Service request processing method and device, electronic equipment and computer storage medium |
CN113391860B (en) * | 2020-03-11 | 2024-01-30 | 抖音视界有限公司 | Service request processing method and device, electronic equipment and computer storage medium |
CN112148500A (en) * | 2020-05-18 | 2020-12-29 | 南方电网数字电网研究院有限公司 | Netty-based remote data transmission method |
CN113709085A (en) * | 2020-05-22 | 2021-11-26 | 成都鼎桥通信技术有限公司 | Remote procedure call processing method, device and equipment |
CN112035276A (en) * | 2020-08-06 | 2020-12-04 | 上海视云网络科技有限公司 | Java-based cross-platform extensible Remote Procedure Call (RPC) framework design method |
CN114327951A (en) * | 2021-12-30 | 2022-04-12 | 上海众人智能科技有限公司 | Modularized data management system based on multi-semantic expression |
CN114422488A (en) * | 2022-01-24 | 2022-04-29 | 北京理工大学重庆创新中心 | Multi-thread message processing method based on netty framework |
CN114422488B (en) * | 2022-01-24 | 2023-09-12 | 北京理工大学重庆创新中心 | Multithreading message processing method based on netty framework |
CN115442350A (en) * | 2022-07-29 | 2022-12-06 | 中国人民解放军63892部队 | Remote procedure call implementation method for LVC-DE distributed synthetic environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109756461A (en) | A kind of remote procedure calling (PRC) method based on NETTY | |
CN106453288B (en) | A kind of distributed micro services frame system that supporting asynchronous mode and its implementation | |
CN108234670B (en) | Zookeeper and netty-based distributed remote calling method | |
CN111542064B (en) | Container arrangement management system and arrangement method for wireless access network | |
CN105721473B (en) | A kind of method and system of WEB terminal far call optimization | |
CN104699541B (en) | Method, apparatus, data transfer components and the system of synchrodata | |
CN104731956B (en) | Method, system and the Relational database of synchrodata | |
CN113596128B (en) | Resource synchronization method and system of multi-cloud platform and electronic equipment | |
CN106815083B (en) | A kind of client asynchronous processing method and client based on Memcache agreement | |
CN108471366A (en) | A kind of stereoscopic monitoring system of facing cloud native applications | |
WO2017143909A1 (en) | Method, device, and system for processing data in webpage | |
JP2012230667A (en) | High-load business process scalability | |
US9674293B2 (en) | Systems and methods for remote access to IMS databases | |
CN105635298B (en) | A kind of data acquisition equipment uniform access system based on business separation principle | |
CN106412009A (en) | Interface calling method and device | |
CN104754052A (en) | Message pushing method based on Websocket | |
US20200012545A1 (en) | Event to serverless function workflow instance mapping mechanism | |
CN104038390A (en) | Linux server cluster unified peripheral event monitoring method based on netlink | |
CN113703997A (en) | Bidirectional asynchronous communication middleware system integrating multiple message agents and implementation method | |
CN109525590A (en) | The transmission method and device of data packet | |
US8924988B2 (en) | Collocation in a Java virtual machine of JSLEE and Java EE | |
CN109189748A (en) | A kind of buffer consistency processing method and nfs server | |
CN111552540A (en) | Resource synchronization method based on VMware cloud platform and super-fusion cloud platform | |
CN109981546B (en) | Method and device for acquiring remote call relation between application modules | |
CN106909368B (en) | Service-side service layer logic architecture for realizing rapid service development |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190514 |
|
WD01 | Invention patent application deemed withdrawn after publication |