Tree-based RPC message transmission method, apparatus and device, and medium
By building a k-item tree in a distributed storage system and transmitting data based on the k-item tree, the problems of low data transmission efficiency and high latency in traditional systems under high concurrent access are solved, and more efficient data transmission and lower latency are achieved.
Patent Information
- Application Number
- CN202510158820.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-04-08
AI Technical Summary
When traditional distributed storage systems face high concurrent access, there are problems such as low data transmission efficiency and high latency.
By building a k-item tree and transmitting data based on the k-item tree, the data transmission efficiency in the distributed system is improved and the data transmission delay is reduced. The specific plan includes obtaining RPC requests from the target service interface, analyzing the request information, calculating the tree structure of the k-item tree, controlling the root node to send a request to the child node, and returning the processing results from the child node to the root node, and finally sending it to the target service interface.
By building a k-item tree, multiple nodes can simultaneously transmit data, avoiding the low efficiency and high latency problems caused by excessive load of a single node, reducing the number of hops of message delivery, improving the broadcast and aggregation efficiency of messages in the k-item tree, thereby reducing the overall delay of the system.
Smart Images

Figure CN119788738A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a tree-based RPC message transmission method, device, equipment and medium. Background Art
[0002] Remote Procedure Call (RPC) is a technology that allows a program to call a subroutine or function in another address space (usually on another machine). It is widely used in distributed systems to achieve communication and data exchange between services. The key challenges of RPC technology include network latency, data consistency, and communication efficiency. In modern distributed storage systems, data storage, access, and management are core tasks. In order to achieve efficient data transmission and access, the system requires a reliable communication mechanism.
[0003] Traditional distributed storage systems usually use a centralized or P2P (Peer-to-peer) model to achieve data synchronization and consistency. However, when faced with high concurrent access, this approach will have problems with low data transmission efficiency and high latency. Therefore, how to improve data transmission efficiency and reduce data latency in distributed storage systems has become a technical problem that needs to be solved. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a tree-based RPC message transmission method, device, equipment and medium, which can construct a k-item tree and perform data transmission according to the k-item tree, thereby improving the data transmission efficiency in the distributed system and reducing the data transmission delay. The specific scheme is as follows:
[0005] In a first aspect, the present application provides a tree-based RPC message transmission method, which is applied to an RPC message call model, including:
[0006] Obtaining an RPC request sent by a target client in a target distributed system from a target service interface, and parsing the RPC request to obtain target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to a target message calling service;
[0007] Calculating a tree structure of a target k-item tree corresponding to the RPC request according to the target request information, and controlling a root node of the target k-item tree to send the RPC request to a child node corresponding to the RPC request via a target path according to the tree structure, so that each child node generates a corresponding processing result according to the RPC request;
[0008] Each of the processing results is sent to the root node using the target path by using each of the child nodes, and each of the processing results is sent to the target service interface by using the root node, so that the target service end obtains each of the processing results from the target service interface.
[0009] Optionally, before obtaining the RPC request sent by the target client in the target distributed system from the target service interface, the method further includes:
[0010] Performing identity authentication on the target client to determine whether the target client is an authorized device;
[0011] If the target client is an authorized device, the target client is added to the target distributed system.
[0012] Optionally, calculating the tree structure of the target k-item tree corresponding to the RPC request according to the target request information includes:
[0013] A preset tree structure calculation function is called, and the preset tree structure calculation function and the target request information are used to dynamically calculate the tree structure of the target k-item tree corresponding to the RPC request.
[0014] Optionally, the tree-based RPC message transmission method further includes:
[0015] A data encryption function is integrated in the target k-item tree so as to perform data encryption operation on the RPC request and each of the processing results corresponding to the RPC request during data transmission.
[0016] Optionally, the tree-based RPC message transmission method further includes: determining whether a node in the target k-item tree fails; if a node in the target k-item tree fails, selecting a target replacement node corresponding to the failed node from the target k-item tree, and replacing the failed node with the target replacement node.
[0017] In a second aspect, the present application provides a tree-based RPC message transmission method, which is applied to a client in a target distributed system, including:
[0018] Determine a target message invocation service, and generate a corresponding RPC request according to the target message invocation service;
[0019] Calling a target service interface corresponding to the RPC request, and sending the RPC request to the target service interface, so that the RPC message calling model in the target distributed system obtains the RPC request from the target service interface, parses the RPC request, calculates the tree structure of the target k-item tree corresponding to the RPC request according to the target request information obtained by the parsing, controls the root node of the target k-item tree to send the RPC request to the child node corresponding to the RPC request with the target path according to the tree structure, uses each of the child nodes to send the processing results generated by each of the child nodes to the root node, and uses the root node to send each of the processing results to the target service interface;
[0020] The processing results corresponding to the RPC request are obtained from the target service interface.
[0021] Optionally, determining the target message invoking service includes:
[0022] A local preset service registry is queried, and the target message invocation service is determined according to registry information in the preset service registry.
[0023] In a third aspect, the present application provides a tree-based RPC message transmission device, which is applied to an RPC message call model, including:
[0024] A request acquisition module, used to acquire an RPC request sent by a target client in a target distributed system from a target service interface, and parse the RPC request to acquire target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to a target message calling service;
[0025] a tree structure calculation module, configured to calculate a tree structure of a target k-item tree corresponding to the RPC request according to the target request information, and control a root node of the target k-item tree to send the RPC request to a child node corresponding to the RPC request via a target path according to the tree structure, so that each child node generates a corresponding processing result according to the RPC request;
[0026] The processing result sending module is used to use each of the child nodes to send each of the processing results to the root node via the target path, and use the root node to send each of the processing results to the target service interface, so that the target service end obtains each of the processing results from the target service interface.
[0027] In a fourth aspect, the present application provides an electronic device, including:
[0028] Memory, used to store computer programs;
[0029] A processor is used to execute the computer program to implement the aforementioned tree-based RPC message transmission method.
[0030] In a fifth aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the aforementioned tree-based RPC message transmission method when executed by a processor.
[0031] In the present application, the RPC message call model first obtains the RPC request sent by the target client in the target distributed system from the target service interface, and parses the RPC request to obtain the target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to the target message call service, and then calculates the tree structure of the target k-item tree corresponding to the RPC request according to the target request information, and controls the root node of the target k-item tree according to the tree structure to send the RPC request to the child node corresponding to the RPC request with the target path, so that each of the child nodes generates a corresponding processing result according to the RPC request, and finally uses each of the child nodes to send each of the processing results to the root node with the target path, and uses the root node to send each of the processing results to the target service interface, so that the target server obtains each of the processing results from the target service interface. It can be seen that the present application constructs a k-item tree and transmits data using the target path in the k-item tree, so that data can be transmitted simultaneously using different nodes, thereby avoiding the problem of low data transmission efficiency and high latency caused by excessive load on a single node; by constructing a k-item tree and using the k-item tree for message transmission, the number of message transmission hops is reduced, and the efficiency of message broadcasting and aggregation in the k-item tree is improved, thereby reducing the overall latency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0033] Figure 1 A flowchart of a tree-based RPC message transmission method provided by this application;
[0034] Figure 2 A schematic diagram of a k-item tree structure provided for this application;
[0035] Figure 3 A schematic diagram of the comparison results of latency and bandwidth consumption provided for this application;
[0036] Figure 4 A flowchart of a tree-based RPC message transmission method provided by this application;
[0037] Figure 5 A schematic diagram of the structure of a tree-based RPC message transmission device provided in this application;
[0038] Figure 6 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] At present, the message passing method in the distributed system is usually implemented by a centralized or peer-to-peer network model. However, when faced with high concurrent access, both methods have the problems of low data transmission efficiency and high latency. To this end, the present application provides a tree-based RPC message transmission method, which improves the data transmission efficiency in the distributed system and reduces the latency of data transmission by constructing a k-item tree and transmitting data according to the k-item tree.
[0041] See also Figure 1 As shown, the embodiment of the present invention discloses a tree-based RPC message transmission method, which is applied to the RPC message call model, including:
[0042] Step S11, obtaining an RPC request sent by a target client in a target distributed system from a target service interface, and parsing the RPC request to obtain target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to a target message calling service.
[0043] In this embodiment, before obtaining the RPC request sent by the target client in the target distributed system from the service interface, it also includes: authenticating the target client to determine whether the target client is an authorized device; if the target client is an authorized device, the target client is added to the target distributed system; correspondingly, if the target client is not an authorized device, the client is refused to be added to the above-mentioned target distributed system. It can be understood that after the target client determined to be an authorized device is added to the above-mentioned target distributed system, the target client can make message calls in the distributed system, while the client that is not included in the distributed system does not have the corresponding message call authority. The above-mentioned identity authentication mechanism can adopt an identity authentication mechanism based on certificates or keys, which is not specifically limited here.
[0044] In this embodiment, after obtaining the RPC request from the target service interface, the RPC request needs to be parsed to obtain the target request information contained in the RPC request, wherein the above RPC request is a request generated by the target client according to the message call service, so the target request information contains the device information corresponding to the device that needs to communicate with the target client, and the target k-item tree corresponding to the RPC request can be constructed according to the above target request information. By authenticating the target client, the situation where unauthorized devices enter the distributed system to make message calls is avoided, and the reliability of the message transmission process is improved. By using the target request information to construct the k-item tree, the pertinence of the generated k-item tree is guaranteed, and the problem of the generated k-item tree not matching the RPC message request is avoided.
[0045] Step S12: calculate the tree structure of the target k-item tree corresponding to the RPC request according to the target request information, and control the root node of the target k-item tree to send the RPC request to the child node corresponding to the RPC request along the target path according to the tree structure, so that each child node generates a corresponding processing result according to the RPC request.
[0046] In this embodiment, after obtaining the RPC request, the RPC message call model needs to dynamically calculate the k-nomial tree, that is, the structure of the k-term tree mentioned above. Each node of the k-nomial tree has at most k child nodes, and the depth of the tree is determined by the number of nodes in the group and the bifurcation coefficient k. By determining the structure of the tree in the request sending stage, the target distributed system can cope with the dynamic changes and failures of the nodes; the number of each node in the k-term tree is as follows Figure 2 As shown, Figure 2It is constructed in a time-flowing downward manner, that is, for a multicast operation represented by a 2-nomial tree (a binomial tree with k equal to 2), task 0 sends a message to task 1 in the first time step. Then, task 0 sends to task 2, and task 1 sends to task 3. In the last step, task 0 sends to task 4, task 1 sends to task 5, task 2 sends to task 6, and task 3 sends to task 7. It should be noted that the task distribution process in each step is carried out simultaneously, that is, the request starts from the root node and is broadcast to the child nodes of the lower layer. Each intermediate node recursively sends messages to its child nodes through the rpc_send function until all relevant nodes receive the request. The key code of the k-term tree is as follows:
[0047] struct knomial_number {
[0048] uint32_tdigits[TREE_MAX_RATIO];
[0049] uint32_tndigits;
[0050] uint32_tratio;
[0051] };
[0052] In this embodiment, the process of calculating the tree structure of the target k-item tree corresponding to the RPC request according to the target request information may specifically include: calling a preset tree structure calculation function, using the preset tree structure calculation function and the target request information to dynamically calculate the tree structure of the target k-item tree corresponding to the RPC request; specifically, in the rpc_send phase, i.e., the request initiation phase, the system calls the tree_get_children function, i.e., the preset tree structure calculation function, to calculate the tree structure corresponding to the current RPC request. This function dynamically calculates the child node list based on the current root node, request node, group size, tree ratio and other parameters, that is, the system calls tree_get_children in the rpc_send interface, i.e., the target service interface, and calculates the requested tree structure according to the current state and configuration of the group. It should be noted that the tree_get_children function uses the member information within the group, i.e., the node information contained in the tree structure and the pre-configured tree topology parameters, to instantly calculate the tree structure when sending the request. It can be understood that the components in this system include a request processor, which is used to receive and parse RPC requests and call the corresponding service interface; a response processor, which is used to receive the results returned by the service interface, process and return them to the client; a message sequence generator, which is used to encode and decode messages using an efficient serialization protocol (gRPC); a dynamic tree builder, which is used to call tree_get_children and tree_get_parent functions to dynamically build a k-item tree; the key code for building a k-item tree is as follows:
[0053] int
[0054] knomial_get_children(uint32_t grp_size, uint32_t tree_ratio,
[0055] uint32_t grp_root, uint32_t grp_self,
[0056] uint32_t *children)
[0057] {
[0058] uint32_tnchildren;
[0059] uint32_ttree_self;
[0060] uint32_ti;
[0061] tree_self = crt_grprank_2_treerank(grp_size, grp_root, grp_self);
[0062] nchildren = knomial_get_children(children, tree_self, grp_size,tree_ratio);
[0063] for (i = 0; i < nchildren; i++)
[0064] children[i] = crt_treerank_2_grprank(grp_size, grp_root,children[i]);
[0065] return 0;
[0066] }
[0067] int
[0068] crt_knomial_get_parent(uint32_t grp_size, uint32_t tree_ratio,
[0069] uint32_t grp_root, uint32_t grp_self, uint32_t *parent)
[0070] {
[0071] uint32_ttree_self, tree_parent;
[0072] if (grp_self == grp_root)
[0073] return -DER_INVAL;
[0074] tree_self = grprank_2_treerank(grp_size, grp_root, grp_self);
[0075] D_ASSERT(tree_self != 0);
[0076] tree_parent = knomial_get_parent(tree_self, tree_ratio);
[0077] *parent = treerank_2_grprank(grp_size, grp_root, tree_parent);
[0078] return 0;
[0079] }
[0080] It should be noted that the k-term tree in this embodiment can also integrate data encryption functions so as to perform data encryption operations on RPC requests and the processing results corresponding to the RPC requests during data transmission, that is, to integrate encryption and authentication mechanisms in the tree structure to ensure the security of data during transmission and prevent data leakage or tampering; the data encryption method in this embodiment can adopt algorithms such as symmetric encryption and asymmetric encryption, which are not specifically limited here. By constructing a tree structure and optimizing the data transmission path with the tree structure, the delay and redundancy in the message transmission process are reduced, thereby improving the overall communication efficiency; by utilizing the natural scalability of the tree structure, the distributed storage system can be more easily expanded to more nodes and larger-scale data storage needs; through the hierarchical management of the tree structure, the consistency and accuracy of data in the distributed storage system are ensured, and errors and conflicts in the data synchronization process are reduced.
[0081] Step S13: using each of the child nodes to send each of the processing results to the root node via the target path, and using the root node to send each of the processing results to the target service interface, so that the target server obtains each of the processing results from the target service interface.
[0082] In this embodiment, the root node sends an RPC request to the child node corresponding to the RPC request with a target path. Each child node generates a corresponding processing result according to the RPC request. Then, each child node sends the corresponding processing result to its own parent node with the above target path, and finally transmits it back to the root node of the k-nomial tree. That is, the transmission path of the RPC message is determined by the k-nomial tree, and the message can be propagated downward from the root node (broadcast) or collected upward from the leaf nodes, that is, each child node (aggregation).
[0083] In this embodiment, when using the nodes of the k-item tree for data transmission, it can also include: determining whether a node in the target k-item tree fails. If a node in the target k-item tree fails, selecting a target replacement node corresponding to the failed node from the target k-item tree, and replacing the failed node with the target replacement node. That is, during the message transmission process, if a node is found to be faulty, the system can select a replacement node or a retry strategy to ensure the reliability of the RPC call; accordingly, in the RPC request sending phase, the tree structure can be adjusted according to the latest status of each node in the distributed system to avoid faulty nodes. For example, when the RPC message call model receives an RPC request, if the A node corresponding to the RPC request fails, the B node that can replace the A node is selected, and the B node is used to replace the A node to build a k-item tree; and due to the intuitiveness of the tree structure, the system administrator only needs to monitor the node status in the system according to the tree structure.
[0084] In this embodiment, by comparing the RPC message transmission method based on the k-term tree with the traditional RPC message transmission method, the following can be obtained: Figure 3 Results shown: In terms of latency, the latency of the k-nomial tree increases slowly, usually at a logarithmic level, while the latency of traditional RPC grows faster; in terms of bandwidth consumption, the bandwidth consumption of the k-nomial tree grows slowly because each node only needs to pass messages to a few k child nodes. In contrast, the bandwidth consumption of traditional RPC grows linearly or superlinearly with the number of nodes. By utilizing the redundant characteristics of the tree structure, when some nodes fail, the system can automatically reroute messages to ensure the continuity of data transmission and the stability of the system; through the intuitiveness and hierarchy of the tree structure, it simplifies the monitoring and management of the distributed storage system by the system administrator, improving maintenance efficiency and system operability.
[0085] It can be seen that this application avoids the situation where unauthorized devices enter the distributed system to make message calls by authenticating the target client, thereby improving the reliability of the message transmission process; by constructing a tree structure and optimizing the data transmission path with the tree structure, it reduces the delay and redundancy in the message transmission process, thereby improving the overall communication efficiency; by utilizing the natural scalability of the tree structure, the distributed storage system can be more easily expanded to more nodes and larger-scale data storage needs; through the hierarchical management of the tree structure, the consistency and accuracy of data in the distributed storage system is ensured, and errors and conflicts in the data synchronization process are reduced.
[0086] Based on the above embodiments, this application describes the overall process of the RPC message call model during RPC message transmission in a distributed system. In order to make the technical solution provided by this application more complete, this application will describe the steps that the client in the target distributed system is responsible for during the message transmission process. Figure 4 As shown, the embodiment of the present application discloses a tree-based RPC message transmission method, which is applied to a client in a target distributed system, including:
[0087] Step S21: determine the target message invocation service, and generate a corresponding RPC request according to the target message invocation service.
[0088] In this embodiment, each node in the target distributed system needs to register its own service in the global view when it is started. The service description corresponding to the node service includes information such as the service name, interface description, and network address. Correspondingly, the above process of determining the target message call service can specifically include: querying the local preset service registry, and determining the target message call service based on the registry information in the preset service registry. Specifically, the client can query the local service registry or send a query request to a specific node to discover the target service. It should be noted that when registering and calling the service, it is necessary to implement a role-based or permission-based access control strategy to prevent unauthorized access. By performing access control, unauthorized access can be prevented, and the security of message transmission is improved.
[0089] Step S22, calling the target service interface corresponding to the RPC request, and sending the RPC request to the target service interface, so that the RPC message calling model in the target distributed system obtains the RPC request from the target service interface, parses the RPC request, calculates the tree structure of the target k-item tree corresponding to the RPC request according to the target request information obtained by the analysis, controls the root node of the target k-item tree according to the tree structure to send the RPC request to the child node corresponding to the RPC request with the target path, uses each of the child nodes to send the processing results generated by each of the child nodes to the root node, and uses the root node to send each of the processing results to the target service interface.
[0090] In this embodiment, when the client initiates an RPC request, the request will enter the target distributed system through the rpc_send interface, that is, the target service interface. That is, the target service interface is a message passing window between the client and the target distributed system. Through the target service interface, the client can send the RPC request to the target distributed system and accept the processing results generated by each node in the target distributed system according to the RPC request.
[0091] Step S23: Obtain each processing result corresponding to the RPC request from the target service interface.
[0092] It can be seen that the present application constructs a k-item tree and transmits data using the target path in the k-item tree, so that data can be transmitted simultaneously using different nodes, thereby avoiding the problem of low data transmission efficiency and high latency caused by excessive load on a single node; by constructing a k-item tree and using the k-item tree for message transmission, the number of message transmission hops is reduced, and the efficiency of message broadcasting and aggregation in the k-item tree is improved, thereby reducing the overall latency of the system.
[0093] See also Figure 5 As shown, the embodiment of the present invention discloses a tree-based RPC message transmission device, which is applied to the RPC message call model, including:
[0094] The request acquisition module 11 is used to acquire the RPC request sent by the target client in the target distributed system from the target service interface, and parse the RPC request to obtain the target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to the target message calling service;
[0095] A tree structure calculation module 12 is used to calculate the tree structure of the target k-item tree corresponding to the RPC request according to the target request information, and control the root node of the target k-item tree to send the RPC request to the child node corresponding to the RPC request with the target path according to the tree structure, so that each of the child nodes generates a corresponding processing result according to the RPC request;
[0096] The processing result sending module 13 is used to use each of the child nodes to send each of the processing results to the root node via the target path, and use the root node to send each of the processing results to the target service interface, so that the target service end obtains each of the processing results from the target service interface.
[0097] It can be seen that the present application constructs a k-item tree and transmits data using the target path in the k-item tree, so that data can be transmitted simultaneously using different nodes, thereby avoiding the problem of low data transmission efficiency and high latency caused by excessive load on a single node; by constructing a k-item tree and using the k-item tree for message transmission, the number of message transmission hops is reduced, and the efficiency of message broadcasting and aggregation in the k-item tree is improved, thereby reducing the overall latency of the system.
[0098] In some specific embodiments, the request acquisition module 11 further includes:
[0099] An identity verification unit, used to verify the identity of the target client to determine whether the target client is an authorized device;
[0100] The client adding unit is used to add the target client to the target distributed system if the target client is an authorized device.
[0101] In some specific embodiments, the tree structure calculation module 12 may specifically include:
[0102] The tree structure calculation unit is used to call a preset tree structure calculation function, and use the preset tree structure calculation function and the target request information to dynamically calculate the tree structure of the target k-item tree corresponding to the RPC request.
[0103] In some specific embodiments, the tree-based RPC message transmission device further includes:
[0104] A function integration module is used to integrate a data encryption function in the target k-item tree so as to perform data encryption operations on the RPC request and each processing result corresponding to the RPC request during data transmission.
[0105] In some specific embodiments, the tree-based RPC message transmission device further includes:
[0106] A fault judgment module is used to judge whether a node in the target k-item tree fails. If a node in the target k-item tree fails, a target replacement node corresponding to the failed node is selected from the target k-item tree, and the failed node is replaced by the target replacement node.
[0107] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0108] Figure 6 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the tree-based RPC message transmission method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0109] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0110] In addition, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0111] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the tree-based RPC message transmission method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0112] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the tree-based RPC message transmission method disclosed above is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0113] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0114] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0115] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0116] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0117] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A tree-based RPC message transmission method, characterized in that: Applied to the RPC message call model, including: Obtaining an RPC request sent by a target client in a target distributed system from a target service interface, and parsing the RPC request to obtain target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to a target message calling service; Calculating a tree structure of a target k-item tree corresponding to the RPC request according to the target request information, and controlling a root node of the target k-item tree to send the RPC request to a child node corresponding to the RPC request via a target path according to the tree structure, so that each child node generates a corresponding processing result according to the RPC request; Each of the processing results is sent to the root node using the target path by using each of the child nodes, and each of the processing results is sent to the target service interface by using the root node, so that the target service end obtains each of the processing results from the target service interface.
2. The tree-based RPC message transmission method according to claim 1, characterized in that: Before obtaining the RPC request sent by the target client in the target distributed system from the target service interface, the method further includes: Performing identity authentication on the target client to determine whether the target client is an authorized device; If the target client is an authorized device, the target client is added to the target distributed system.
3. The tree-based RPC message transmission method according to claim 1, characterized in that: The step of calculating the tree structure of the target k-item tree corresponding to the RPC request according to the target request information includes: A preset tree structure calculation function is called, and the preset tree structure calculation function and the target request information are used to dynamically calculate the tree structure of the target k-item tree corresponding to the RPC request.
4. The tree-based RPC message transmission method according to claim 1, characterized in that: Also includes: A data encryption function is integrated in the target k-item tree so as to perform data encryption operation on the RPC request and each of the processing results corresponding to the RPC request during data transmission.
5. The tree-based RPC message transmission method according to any one of claims 1 to 4, characterized in that: Also includes: Determine whether a node in the target k-item tree fails. If a node in the target k-item tree fails, select a target replacement node corresponding to the failed node from the target k-item tree, and use the target replacement node to replace the failed node.
6. A tree-based RPC message transmission method, characterized in that: Applied to the client in the target distributed system, including: Determine a target message invocation service, and generate a corresponding RPC request according to the target message invocation service; Calling a target service interface corresponding to the RPC request, and sending the RPC request to the target service interface, so that the RPC message calling model in the target distributed system obtains the RPC request from the target service interface, parses the RPC request, calculates the tree structure of the target k-item tree corresponding to the RPC request according to the target request information obtained by the parsing, controls the root node of the target k-item tree to send the RPC request to the child node corresponding to the RPC request with the target path according to the tree structure, uses each of the child nodes to send the processing results generated by each of the child nodes to the root node, and uses the root node to send each of the processing results to the target service interface; The processing results corresponding to the RPC request are obtained from the target service interface.
7. The tree-based RPC message transmission method according to claim 6, characterized in that: The determining of the target message invoking service comprises: A local preset service registry is queried, and the target message invocation service is determined according to registry information in the preset service registry.
8. A tree-based RPC message transmission device, characterized in that: Applied to the RPC message call model, including: A request acquisition module, used to acquire an RPC request sent by a target client in a target distributed system from a target service interface, and parse the RPC request to acquire target request information contained in the RPC request; wherein the RPC request is a request generated by the target client according to a target message calling service; a tree structure calculation module, configured to calculate a tree structure of a target k-item tree corresponding to the RPC request according to the target request information, and control a root node of the target k-item tree to send the RPC request to a child node corresponding to the RPC request via a target path according to the tree structure, so that each child node generates a corresponding processing result according to the RPC request; The processing result sending module is used to use each of the child nodes to send each of the processing results to the root node via the target path, and use the root node to send each of the processing results to the target service interface, so that the target service end obtains each of the processing results from the target service interface.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the tree-based RPC message transmission method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the tree-based RPC message transmission method according to any one of claims 1 to 7.