Data transmission method and device for remote procedure call

By using kernel-bypass network transmission technology and memory layout optimization, the resource utilization and response latency issues of the RPC framework in high-performance scenarios are solved, zero-copy data transmission is achieved, network throughput and transmission efficiency are improved, adaptability to different network environments and application characteristics is enhanced, and service switching is simplified.

CN122027720APending Publication Date: 2026-05-12BEIJING DAJIA INTERNET INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2026-02-12
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing RPC frameworks suffer from low resource utilization and response latency in high-performance scenarios, especially in traditional kernel-mode network transmission protocols where frequent memory copies limit network throughput.

Method used

By employing kernel-bypass network transmission technologies, such as remote direct memory access or user-mode transmission control protocols, combined with memory layout optimization and serialized data generation, the kernel-mode network transmission stack is bypassed to achieve zero-copy data transmission. Furthermore, a negotiation mechanism is used to select the optimal transmission protocol to adapt to different network environments and application characteristics.

Benefits of technology

It significantly improved network throughput, reduced end-to-end latency and resource consumption, enhanced data transmission efficiency and flexibility, ensured high performance and stability in different scenarios, and simplified the service switching process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122027720A_ABST
    Figure CN122027720A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data transmission method and device for remote procedure call. Communication connection is established between a sending end and a receiving end. The method comprises the following steps: optimizing a memory layout of data to be sent to be aligned with a target network transmission format; serialized data is generated based on the aligned memory layout, and the serialized data carries information indicating a data structure of the serialized data; and transmitting the serialized data to a receiving end by using a kernel bypass type network transmission technology, so that the receiving end analyzes the serialized data based on the information indicating the data structure of the serialized data, the kernel bypass type network transmission technology comprises a remote direct memory access technology or a user state transmission control protocol. According to the invention, zero-copy serialization and efficient data transmission can be realized, so that the communication performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of remote procedure calls, and in particular to a data transmission method and apparatus for remote procedure calls. Background Technology

[0002] Remote Procedure Call (RPC) is a primary communication method in distributed systems, allowing the sending end (such as the server) to invoke procedures on the receiving end (such as the client) as if they were local procedures. However, current RPC frameworks exhibit significant bottlenecks in high-performance scenarios, with resource utilization and response latency becoming pressing issues that require resolution. Summary of the Invention

[0003] In view of this, this application provides a data transmission method and apparatus for remote procedure calls to improve resource utilization and reduce response latency.

[0004] This application provides the following solution: Firstly, a data transmission method for remote procedure calls is provided, applied at a sending end, wherein a communication connection is established between the sending end and the receiving end, the method comprising: Optimize the memory layout of the data to be sent to align with the target network transmission format; Based on the aligned memory layout, serialized data is generated, the serialized data carrying information indicating the data structure of the serialized data; The serialized data is transmitted to the receiving end using kernel-bypass network transmission technology, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0005] Optionally, optimizing the memory layout of the data to be sent to align with the target network transmission format includes: Determine the schema definition corresponding to the target network transmission format, wherein the schema definition includes at least the order and type information of the fields; Based on the schema definition, at least one of field rearrangement and hole elimination is performed on the memory layout of the data to be sent, so that the optimized memory layout is aligned with the target network transmission format.

[0006] Optionally, generating serialized data based on the aligned memory layout includes: Based on the aligned memory layout, an address region and a data header are generated. The address region includes offset information for each field corresponding to the aligned memory layout. The data header includes information indicating the data structure of the serialized data, and the data structure of the serialized data is the aligned memory layout. Based on the data header, the address region, and the value region, the serialized data is obtained, where the value region corresponds to the data after the memory layout optimization.

[0007] Optionally, the method further includes at least one of the following: When establishing the communication connection, the sending end and the receiving end negotiate to use remote direct memory access technology or user-mode transmission control protocol as the kernel bypass network transmission technology based on the network environment and / or application characteristics. In response to the detection of a change in the network environment, based on the changed network environment, the remote direct memory access technology or user-space transfer control protocol is renegotiated as the kernel bypass network transmission technology.

[0008] Optionally, the negotiation uses Remote Direct Memory Access (RDA) or User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology, including: If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA), negotiate to use RDA as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UDP) as the kernel-bypass network transmission technology; or... If the network latency requirement of the application feature is higher than the preset latency requirement, negotiate to use Remote Direct Memory Access (RDA) as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology; or... If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA) technology, and the network latency requirement of the application feature is higher than the preset latency requirement, the RDA technology will be negotiated to be used as the kernel bypass network transmission technology; otherwise, the user-mode transmission control protocol will be negotiated to be used as the kernel bypass network transmission technology.

[0009] Optionally, before optimizing the memory layout of the data to be sent to align with the target network transmission format, the method further includes: The sending end and the receiving end negotiate the target network transmission format to be used, and the target network transmission format includes: RAW format or FlatKV format.

[0010] Optionally, the sending end is a server, and the receiving end is a client; the method further includes: When the sending end and the receiving end establish the communication connection, a reverse command channel is established; The reverse command channel is used to send control commands to the client, including service switching commands instructing a switch to a new server.

[0011] Secondly, a data transmission method for remote procedure calls is provided, applied at a receiving end, wherein a communication connection is established between the receiving end and the sending end, and the method includes: The serialized data transmitted by the sending end is received using kernel bypass network transmission technology. The memory layout of the serialized data is aligned with the target network transmission format, and the data is generated based on the aligned memory layout. Based on the information indicating the data structure of the serialized data carried by the serialized data, the serialized data is parsed; wherein, the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0012] Optionally, the information indicating the data structure of the serialized data includes schema version information; The parsing of the serialized data based on the information indicating the data structure carried by the serialized data includes: Obtain the Schema version information from the data header of the serialized data; Based on the Schema version information, the corresponding Schema definition is found, and the Schema definition includes at least the order and type information of the fields; Based on the order of the fields, the offset information of each field in the value region of the serialized data is obtained from the address region of the serialized data; Based on the offset and type information of each field, the field values ​​are read from the value area and written into memory in the order of the fields.

[0013] Optionally, the sending end is a server, and the receiving end is a client; the method further includes: When the receiving end and the sending end establish the communication connection, a reverse command channel is established; The reverse command channel is used to receive control commands sent by the server, including service switching commands indicating a switch to a new server. The communication connection established with the server is switched to the communication connection established with the new server.

[0014] Thirdly, a data transmission device for remote procedure calls is provided, applied at a sending end, wherein a communication connection is established between the sending end and the receiving end, and the device includes: The memory optimization unit is configured to optimize the memory layout of the data to be sent to align with the target network transmission format. A serialization unit is configured to generate serialized data based on an aligned memory layout, the serialized data carrying information indicating the data structure of the serialized data; The network transmission unit is configured to transmit the serialized data to the receiving end using kernel-bypass network transmission technology, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0015] Fourthly, a data transmission device for remote procedure calls is provided, applied at a receiving end, wherein a communication connection is established between the receiving end and the sending end, and the method includes: The network transmission unit is configured to receive serialized data transmitted by the sending end using kernel bypass network transmission technology, wherein the memory layout of the serialized data is aligned with the target network transmission format and generated based on the aligned memory layout. The data parsing unit is configured to parse the serialized data based on information indicating the data structure of the serialized data carried by the serialized data; wherein the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0016] Fifthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects.

[0017] Sixthly, an electronic device is provided, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any one of the first aspects above.

[0018] In a seventh aspect, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method as described in any of the embodiments of this disclosure.

[0019] According to the specific embodiments provided in this application, the following technical effects are disclosed: 1) This application utilizes kernel-bypass network transmission technology to transmit serialized data to the receiving end, bypassing the kernel-mode network transmission stack and avoiding switching between user mode and kernel mode, thus providing a foundation for zero-copy memory. To further avoid memory copying, this application optimizes the memory layout of the data to be sent to align with the target network transmission format. This allows the memory layout of the data to be sent to be directly used as the network transmission format, eliminating the need for format conversion and copying when generating serialized data using the aligned memory layout. In other words, this application proposes a memory-copy-free serialization technique for kernel-bypass network transmission, thereby minimizing end-to-end latency and resource consumption in PRC communication and significantly improving network throughput.

[0020] 2) This application optimizes memory alignment by determining the schema definition corresponding to the target network transmission format and using techniques such as field rearrangement and hole elimination, so that the native memory layout can be directly used as the network transmission format and the memory blocks are more compact. Then, serialized data is generated based on the aligned memory layout, which reduces the overhead of memory copying and network transmission.

[0021] 3) Based on the aligned memory layout, this application only needs to generate address areas and data headers to carry the offset information of each field and the information indicating the data structure, without the need for additional memory copying, and reduces computational overhead.

[0022] 4) This application introduces a negotiation mechanism based on network environment and / or application characteristics during the connection establishment phase to negotiate the optimal kernel bypass network transmission technology for data transmission, so as to ensure that the optimal transmission performance can be adaptively obtained in different deployment scenarios, avoid the performance loss caused by using a single transmission protocol in different scenarios, and ensure data transmission efficiency.

[0023] Furthermore, this application detects changes in the network environment in real time and automatically switches between remote direct memory access technology and user-space transmission control protocol based on the changed network environment. This enables timely switching to a more suitable transmission protocol when the network environment fluctuates, improving the flexibility and reliability of network transmission and ensuring network transmission efficiency.

[0024] 5) This application provides specific transmission protocol negotiation strategies based on network environment and / or application characteristics, enabling the entire system to have dynamic adaptive capabilities and effectively maintain the stability and high performance of data transmission.

[0025] 6) This application ensures that the sender's memory layout optimization and the receiver's parsing rules are based on the same format standard by negotiating the target network transmission format between the sender and receiver, thereby improving the correctness and reliability of the zero-copy serialization and parsing process and avoiding parsing errors or data corruption caused by inconsistent formats.

[0026] 7) This application establishes a reverse command channel, enabling the server to proactively send service switching commands to the client, thereby expanding the management and control capabilities of the RPC framework, simplifying the service switching process, and achieving rapid flow switching.

[0027] 8) By carrying a simplified schema version identifier in the serialized data, the receiving end can quickly find the corresponding schema definition based on the identifier, obtain the offset information of each field from the address area, and then read the field from the value area and write it into memory without additional memory copying. It also supports the version evolution of message format, improving the flexibility and maintainability of the system.

[0028] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a system architecture diagram applicable to the embodiments of this application.

[0031] Figure 2 A flowchart illustrating the data transmission method for remote procedure calls provided in this application embodiment.

[0032] Figure 3 This is a schematic diagram of the structure of serialized data provided in an embodiment of this application.

[0033] Figure 4a This is a schematic diagram illustrating the protocol negotiation between the client and the server in an embodiment of this application.

[0034] Figure 4b A flowchart illustrating the server command issuance process provided in this application embodiment.

[0035] Figure 5 A flowchart illustrating another remote procedure call data transmission method provided in this application embodiment.

[0036] Figure 6 This is a schematic diagram of the memory distribution of serialized data provided in an embodiment of this application.

[0037] Figure 7 A flowchart illustrating zero-copy serialization provided in an embodiment of this application.

[0038] Figure 8 This is an architecture diagram of the remote procedure call framework provided in the embodiments of this application.

[0039] Figure 9 A schematic block diagram of a data transmission apparatus for remote procedure calls provided in an embodiment of this application.

[0040] Figure 10 A schematic block diagram of another remote procedure call data transmission device provided in an embodiment of this application.

[0041] Figure 11 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0043] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0044] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0045] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0046] Currently, traditional kernel-mode network transmission protocols such as Transmission Control Protocol (TCP) require switching between user space and kernel space during data transmission. This switching process involves copying data from user space to kernel space or vice versa, inevitably resulting in multiple memory copies that limit network throughput and increase latency. Traditional RPC frameworks based on TCP mainly include gRPC (Google Remote Procedure Call) and brpc (baidu-rpc). Both gRPC and brpc use Protobuf for serialization. The Protobuf serialization process requires multiple memory copies and dynamic memory allocation, leading to excessively high CPU utilization and increased response latency. These issues severely impact RPC communication performance.

[0047] In view of this, this application provides a new approach. To facilitate understanding of this application, the system architecture on which this application is based will first be described. Figure 1 An exemplary system architecture that can be applied to embodiments of this application is shown, such as Figure 1 As shown, the system architecture may include: client, terminal device, and server.

[0048] The server and client are the two main components of an application service. The server side uses a server as its primary hardware infrastructure and may include one or more software service modules. The server and client form a collaborative front-end and back-end.

[0049] The client can be set up on the terminal device. In the embodiments of this application, the client can be a local application, a mini-program, or a web application running through a browser on the terminal device.

[0050] Terminal devices can include, but are not limited to, smart mobile terminals, wearable devices, PCs (Personal Computers), and smart home devices. Smart mobile devices can include devices such as mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), and connected car terminals. Wearable devices can include devices such as smartwatches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality) devices, and mixed reality devices (devices that support both virtual and augmented reality). Smart home devices can include devices such as smart TVs and smart refrigerators with displays.

[0051] The client can interact with the server over a network. In some typical scenarios, the server can be the sender, and the client can be the receiver. For example, in a high-performance computing scenario, the client can send a data request to the server. In response to the request, the server transmits the data to be sent to the client using the method provided in this embodiment, thereby implementing data transmission within an RPC framework. The client receives and parses the data using the method provided in this embodiment.

[0052] In addition to the typical scenarios mentioned above, in other scenarios, the client can also act as the sender and the server as the receiver.

[0053] The server can be a single server, a server cluster consisting of multiple servers, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) services, such as high management difficulty and weak service scalability.

[0054] It should be understood that Figure 1 The number of clients, terminal devices, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of clients, terminal devices, and servers.

[0055] Figure 2 This is a flowchart of a data transmission method for remote procedure calls provided in an embodiment of this application. This method can be performed by... Figure 1 The sending end in the system shown executes this. For example... Figure 2 As shown, the method may include the following steps: Step 201: Optimize the memory layout of the data to be sent to align with the target network transmission format.

[0056] Step 203: Based on the aligned memory layout, generate serialized data, which carries information indicating the data structure of the serialized data.

[0057] Step 205: Use kernel-bypass network transmission technology to transmit serialized data to the receiving end, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0058] As can be seen from the above process, this application uses kernel-bypass network transmission technology to transmit serialized data to the receiving end, bypassing the kernel-mode network transmission stack and avoiding the switch between user mode and kernel mode, thus providing a foundation for zero-copy memory. Under this premise, to avoid memory copying, this application optimizes the memory layout of the data to be sent to align with the target network transmission format, allowing the memory layout of the data to be sent to be directly used as the network transmission format. Therefore, when generating serialized data using the aligned memory layout, there is no need to perform format conversion and copying of the serialized data. In other words, this application proposes a memory-copy-free serialization technology for kernel-bypass network transmission, thereby minimizing end-to-end latency and resource consumption in PRC communication and significantly improving network throughput.

[0059] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments. It should be noted that the terms "target," "first," "second," etc., used in this disclosure do not have limitations in terms of size, order, or quantity, but are only used to distinguish them in name.

[0060] First, the above step 201, namely "optimizing the memory layout of the data to be sent to align with the target network transmission format", will be described in detail with reference to the embodiments.

[0061] The data to be sent refers to the data in the sending end that is to be sent to the receiving end. It can be determined in response to a request from the sending end, or it can be determined by the sending end when actively pushing data.

[0062] Memory layout refers to the organization and storage format of data in memory. It ensures that data can be correctly transmitted and parsed. For example, memory layout can include the type, name, number, and memory address of multiple fields. Network transmission format refers to the format in which data is transmitted over a network. This format can be a binary stream or other formats suitable for network transmission.

[0063] It is understandable that optimizing the memory layout of the data to be sent to align with the target network transmission format allows the memory layout of the data to be sent to be directly used as the network transmission format. Consequently, when using the aligned memory layout to generate serialized data, there is no need to perform format conversion and copying of the serialized data, which can reduce the overhead of memory copying and thus reduce CPU usage.

[0064] Optionally, before optimizing the memory layout of the data to be sent to align with the target network transmission format, the method further includes: negotiating the target network transmission format between the sender and receiver, whereby the target network transmission format may include RAW format or FlatKV format.

[0065] RAW format is the raw binary format in RPC, a lightweight binary format without redundancy or additional encapsulation. FlatKV format is a flattened key-value pair format, which essentially converts complex nested key-value pair data into a single-level, non-nested binary key-value pair sequence, making it a lightweight format. FlatKV is a more self-describing format, as its serialized data includes field offset information, facilitating dynamic schema processing; therefore, FlatKV is a preferred choice.

[0066] Specifically, when there are requirements for transmission flexibility or low-latency transmission, such as when the latency requirement is less than 10 milliseconds, the sending and receiving ends can use RAW format as the target network transmission format; when high-performance transmission is required, such as when the bandwidth requirement is greater than 1 gigabits per second, the sending and receiving ends can use FlatKV format as the target network transmission format.

[0067] It is understood that this application ensures that the sender's memory layout optimization and the receiver's parsing rules are based on the same format standard by negotiating the target network transmission format between the sender and receiver. This improves the correctness and reliability of the zero-copy serialization and parsing process and avoids parsing errors or data corruption caused by inconsistent formats.

[0068] As one possible approach, when optimizing the memory layout of the data to be sent to align with the target network transmission format, the format (Schema definition) corresponding to the target network transmission format can be determined first. The Schema definition includes at least the order and type information of the fields. Based on the Schema definition, at least one of field rearrangement and hole elimination is performed on the memory layout of the data to be sent to align the optimized memory layout with the target network transmission format.

[0069] Field rearrangement refers to matching the data organization in memory with the parsing rules of the network transmission format. This allows the receiving end to locate and extract the values ​​of each field from the received serialized data, either directly or through simple offset calculations, without complex format decoding or large-scale data movement. For example, alignment can be manifested in the order of fields in memory matching the order of fields in the network transmission data packet, and the byte length and order of fields conforming to the network format specification.

[0070] The purpose of hole elimination is to optimize the layout of data structures to minimize padding. For example, to align with the target network transmission format, bytes (i.e., holes) are inserted between fields, resulting in wasted memory. By rearranging the fields through hole elimination technology, compact storage can be achieved to reduce holes.

[0071] For example, techniques such as template metaprogramming can be used to analyze the data to be transmitted to obtain its memory layout. If the target network transmission format is RAW, the optimized memory layout can be aligned with the RAW format by performing field rearrangement and hole elimination. Similarly, if the target network transmission format is FlatKV, the optimized memory layout can be aligned with the FlatKV format by performing field rearrangement and hole elimination.

[0072] The following describes step 203, namely "generating serialized data based on the aligned memory layout, wherein the serialized data carries information indicating the data structure of the serialized data," in detail with reference to the embodiments.

[0073] The "serialization" here is different from the traditional serialization that requires deep copying and encoding; its core lies in adding metadata headers.

[0074] As one possible approach, the information indicating the data structure can include schema version information. When generating serialized data, an address region and a data header can be generated based on the aligned memory layout. The address region includes offset information for each field corresponding to the aligned memory layout, and the data header includes information indicating the data structure of the serialized data, which is the aligned memory layout. Serialized data is obtained based on the data header, address region, and value region, where the value region corresponds to the data after the memory layout optimization.

[0075] In other words, generating serialized data involves adding a header to the front of the optimized memory data block. The header must at least contain schema version information that identifies the structure definition used for the data, and may also include information such as the number of fields.

[0076] In addition, the information indicating the data structure can be any identifier that can uniquely correspond to a data layout descriptor, such as a version number, hash value, or format ID negotiated with the linking phase.

[0077] Serializable data can be generated in several ways. For example, a header containing schema version information and an address region can be encapsulated together in a buffer descriptor. Alternatively, the header containing schema version information, the address region, and the data body (i.e., the value region) can be copied into a contiguous buffer, with the data body sourced from optimized memory layout. It's even possible to generate only a control message containing a data pointer, length, and schema version, transmit this control message over the network, and then directly read and transmit the data body from memory using zero-copy technologies such as RDMA.

[0078] like Figure 3 As shown, serialized data includes a data header, an address area, and a value area. The data header may contain information indicating the data structure of the serialized data (e.g., schema version information), the number of addresses, or the number of fields (also known as the number of features). The information indicating the data structure is used to distinguish serialized data with different data structures; for example, the indication information for serialized data with data structure A can be 1, while the indication information for serialized data with data structure B can be 2. The address area may contain multiple address offsets (e.g., a starting offset), and the number of address offsets is the same as the number of addresses. The value area contains the field values ​​corresponding to each of the multiple address offsets, and the field values ​​are written in an ordered manner according to definitions such as the schema.

[0079] For example, the serialization function of a smart serialization engine obtains the starting offset and length of the data to be sent in memory after layout optimization. A small block of memory is then allocated or reused to construct the header. The header content includes at least: a schema version (e.g., a 32-bit integer with a value of 2) and the number of fields N (e.g., 16). Next, for FlatKV format, an array of offsets (addrs) of length N is used, with each element indicating the starting offset of the corresponding field value in the value region. Because the memory layout is optimized and aligned with the FlatKV format, calculating these offsets is low-cost. Ultimately, the serialized data logically consists of a header, an offset array, and a value region. Those skilled in the art will understand that the specific content, encoding, and length of the header and offset array can vary depending on the chosen target network transmission format (RAW or FlatKV).

[0080] In addition, if the field value is an integer or single-precision floating-point number, since it occupies fewer bytes, the field value can be directly carried in the address area. In this way, the receiving end can directly parse the field value from the address area, avoiding further searching for the field value based on the starting offset.

[0081] In some alternative embodiments, the data to be sent can be a variable field, that is, only the variable field is generated when generating serialized data, thereby achieving incremental encoding and improving serialization efficiency.

[0082] The following describes in detail step 205, namely, "using kernel bypass network transmission technology to transmit serialized data to the receiving end so that the receiving end can parse the serialized data based on information indicating the data structure of the serialized data, wherein the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol", with reference to the embodiments.

[0083] Kernel-bypass network transmission technology refers to technologies that enable application data transmission without or primarily relying on the operating system kernel network protocol stack. In other words, it provides the ability for user-space applications to interact directly with the transmission hardware, laying the foundation for avoiding memory copying and effectively eliminating the performance overhead of the kernel protocol stack. Kernel-bypass network transmission technologies can include Remote Direct Memory Access (RDMA) or User-space TCP (UTCP). RDMA is a direct memory access technology that can transfer data directly from the memory of one computer to another without the intervention of the operating systems of both computers. UTCP is a complete TCP protocol logic implemented in user space, independent of the kernel protocol stack, avoiding system calls and context switching overhead, significantly reducing latency. Furthermore, UTCP uses active polling instead of interrupts to process network packets, which can improve throughput under high load.

[0084] In this embodiment, the sending end and the receiving end can negotiate the kernel bypass network transmission technology to be adopted. For example, Figure 4a This is a schematic diagram illustrating the protocol negotiation between the client (i.e., the sender) and the server (i.e., the receiver) as provided in an embodiment of this application. Figure 4a As shown, the client can preferentially use RDMA to directly transfer serialized data from its user-space buffer to the client's network interface buffer without switching between user mode and kernel mode. If RDMA is unavailable, the client can also use UTCP to map the serialized data from its user-space buffer to the client's network interface buffer, again without switching between user mode and kernel mode. Similarly, the server can also use RDMA to directly transfer serialized data from its user-space buffer to the server's network interface buffer, or use UTCP to map the serialized data from its user-space buffer to the server's network interface buffer, without needing to copy the kernel protocol stack.

[0085] For example, assuming RDMA technology is currently used, the RDMA transmission module has established an RDMA connection with the peer. When the serialized data generated in step S202 needs to be transmitted, the RDMA transmission module's send interface is called, passing in descriptive information such as the memory address and length of the serialized data header and value area. The RDMA transmission module converts this information into a work request that the network interface card (NIC) can understand and submits it to the NIC. The NIC then independently performs DMA read and network send operations. The CPU can return after submitting the request and continue executing other tasks, achieving extremely high processing efficiency and low latency. Those skilled in the art will understand that if a UTCP transmission module is used, the send interface will internally handle data segmentation, acknowledgment, retransmission, and other logic through the user-space TCP protocol stack, ultimately sending the packet to the NIC's send queue through the DPDK interface.

[0086] In some alternative embodiments, a unified transport interface can be defined, that is, RDMA and UTCP can be managed through a unified transport interface, thereby shielding the differences between RDMA and UTCP.

[0087] Furthermore, when establishing a communication connection, the sending and receiving ends can negotiate to use RDMA or UTCP as kernel-bypass network transmission technologies based on the network environment and / or application characteristics.

[0088] Among these, the network environment refers to the environment in which network transmission occurs. The network environment can have evaluation indicators such as latency, bandwidth, and packet loss rate. Therefore, kernel-bypass network transmission technology can be selected based on these evaluation indicators. Application characteristics refer to the application scenario characteristics of the distributed system. Application scenarios can be latency-sensitive scenarios, high-performance scenarios, or general-purpose scenarios, etc.

[0089] It is understood that this application introduces a negotiation mechanism based on network environment and / or application characteristics during the connection establishment phase to negotiate the optimal kernel bypass network transmission technology for data transmission, so as to ensure that the optimal transmission performance can be adaptively obtained in different deployment scenarios, avoid the performance loss caused by using a single transmission protocol in different scenarios, and ensure data transmission efficiency.

[0090] As one possible approach, if the network environment meets the requirements of Remote Direct Memory Access (RDA), negotiate to use RDMA as the kernel-bypass network transmission technology; otherwise, negotiate to use UTCP as the kernel-bypass network transmission technology.

[0091] For example, if the network environment's latency, bandwidth, and packet loss rate all meet the network environment requirements of RDMA technology, then RDMA technology can be used as a kernel-bypass network transmission technology, that is, RDMA technology can be used for network transmission of serialized data; otherwise, UTCP can be used as a kernel-bypass network transmission technology, that is, UTCP can be used for network transmission of serialized data.

[0092] As another possible approach, if the network latency requirement of the application characteristics is higher than the preset latency requirement, negotiate to use RDMA technology as the kernel bypass network transmission technology; otherwise, negotiate to use UTCP as the kernel bypass network transmission technology.

[0093] For example, if the application's network latency requirement is within 10 milliseconds, it can be negotiated to use RDMA technology as a kernel-bypass network transmission technology, that is, to use RDMA technology for network transmission of serialized data; otherwise, it can be negotiated to use UTCP as a kernel-bypass network transmission technology, that is, to use UTCP for network transmission of serialized data.

[0094] As another possible approach, if the network environment meets the network environment requirements of RDMA technology and the network latency requirements of the application characteristics are higher than the preset latency requirements, negotiate to use RDMA technology as the kernel bypass network transmission technology; otherwise, negotiate to use UTCP as the kernel bypass network transmission technology.

[0095] For example, if the network environment's latency, bandwidth, and packet loss rate all meet the network environment requirements of RDMA technology, and the application's network latency requirement is within 10 milliseconds, then RDMA technology can be used as a kernel-bypass network transmission technology, that is, RDMA technology is used for network transmission of serialized data. Otherwise, UTCP can be used as a kernel-bypass network transmission technology, that is, UTCP is used for network transmission of serialized data.

[0096] In another embodiment, in order to cope with dynamic changes in the network environment, in response to the detection of changes in the network environment, the RDMA technology or UTCP can be renegotiated as the kernel bypass network transmission technology based on the changed network environment.

[0097] Specifically, changes in the network environment refer to changes in the evaluation indicators of the network environment, such as bandwidth becoming 0 or latency exceeding a preset time threshold.

[0098] For example, if RDMA technology is unavailable or congestion occurs when using RDMA technology for network transmission, UTCP can be used as a kernel-bypass network transmission technology for data transmission; if UTCP is unavailable or congestion occurs when using UTCP for network transmission, RDMA technology can be used as a kernel-bypass network transmission technology.

[0099] Understandably, this application detects changes in the network environment in real time and automatically switches between remote direct memory access technology and user-space transmission control protocol based on the changed network environment. This enables timely switching to a more suitable transmission protocol when the network environment fluctuates, improving the flexibility and reliability of network transmission and ensuring network transmission efficiency.

[0100] In some scenarios, the server needs to actively manage the client. In this case, the sending end is the server and the receiving end is the client. The method also includes: establishing a reverse command channel when the sending end and the receiving end establish a communication connection; and using the reverse command channel to send control commands to the client. The control commands include service switching commands that indicate switching to the new server.

[0101] The reverse command channel is used by the server to send control commands to the client. These control commands instruct the client to execute corresponding operations. For example, if the control command is a service switching command instructing the client to switch to a new server, it can disconnect the client from the current server and establish a new connection, thus achieving data flow switching. Another example is a data lineage analysis command, which allows the client to quickly return data lineage query results.

[0102] For example, Figure 4b A flowchart of server command issuance provided in the embodiments of this application is shown below. Figure 4b As shown, after the first server is deployed, if a downstream service needs to switch servers, the first server can send a service switching command to the client through the reverse command channel to redirect the client's service, establish a communication connection with the deployed second server, and negotiate the target network transmission format and kernel bypass network transmission technology with the second server. After establishing the communication connection, the client's request is sent to the second server, and the second server responds to the request by serializing the data to be sent and sending it to the client.

[0103] In some optional embodiments, the control command can also be set with an expiration time, that is, the control command can be restored after a preset time interval and continue to send control commands to the client.

[0104] Understandably, this application enables the server to proactively send service switching commands to the client by establishing a reverse command channel, thereby expanding the management and control capabilities of the RPC framework, simplifying the service switching process, and achieving rapid flow switching.

[0105] According to another embodiment, a data transmission method for remote procedure calls is provided. Figure 5 This is a flowchart of a data transmission method for remote procedure calls provided in an embodiment of this application. This method can be performed by... Figure 1 The receiving end in the system shown executes this. For example... Figure 5 As shown, the method may include the following steps: Step 501: Receive serialized data transmitted by the sender using kernel bypass network transmission technology. Align the memory layout of the serialized data with the target network transmission format and generate a new data structure based on the aligned memory layout.

[0106] Step 503: Based on the information indicating the data structure of the serialized data carried by the serialized data, the serialized data is parsed; wherein, kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0107] As can be seen from the above process, this application optimizes the memory layout of the data to be sent to align with the target network transmission format, allowing the memory layout of the data to be sent to be directly used as the network transmission format. Therefore, when generating serialized data using the aligned memory layout, there is no need for format conversion and copying of the serialized data. Furthermore, by employing kernel-bypass network transmission technology, the serialized data is transmitted to the receiving end, bypassing the kernel-mode network transmission stack and reducing context switching and data copying between user mode and kernel mode. This effectively reduces end-to-end latency and resource consumption in PRC communication, significantly improving network throughput.

[0108] First, the above step 501, namely "receiving serialized data transmitted by the sending end using kernel bypass network transmission technology, aligning the memory layout of the serialized data with the target network transmission format, and generating based on the aligned memory layout", will be described in detail with reference to the embodiments.

[0109] The serialized data is the serialized version of the data to be sent; its generation process is detailed in the documentation for... Figure 2 The relevant descriptions of the embodiments shown will not be repeated here.

[0110] Optionally, before optimizing the memory layout of the serialized data to align with the target network transmission format, the method further includes: negotiating the target network transmission format between the sender and receiver, whereby the target network transmission format may include RAW or FlatKV.

[0111] The following describes in detail step 503, namely, "parse the serialized data based on the information of the data structure of the serialized data carried by the serialized data; wherein, the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol," with reference to the embodiments.

[0112] In this embodiment of the application, the sending end and the receiving end can negotiate the kernel bypass network transmission technology to be adopted.

[0113] One possible approach is to include schema version information, which indicates the data structure of the serialized data. Schema version information is used to indicate serialized data with different data structures. For example, the data structure of the serialized data corresponding to schema version A is different from that of the serialized data corresponding to schema version B.

[0114] For example, Figure 6 This is a schematic diagram illustrating the memory distribution of serialized data provided in an embodiment of this application. For example... Figure 6 As shown, serialized data can include a data header, an address area, and a value area. The data header may contain the schema version and the number of addresses. The address area may contain N address offsets and / or field values ​​(in some cases, integer or single-precision floating-point field values ​​can be directly placed in the address area), where N is the number of fields in the schema. The value area contains field values ​​corresponding to multiple address offsets; these field values ​​can be the memory-optimized values ​​of the fields in the data to be sent.

[0115] In this embodiment of the application, the corresponding schema definition can be found based on the schema version information. The schema definition includes at least the order and type information of the fields. Based on the order of the fields, the offset information of each field in the value area of ​​the serialized data is obtained from the address area of ​​the serialized data. Based on the offset information and type information of each field, the field values ​​are read from the value area and written to memory according to the order of the fields.

[0116] For example, Figure 7 A flowchart illustrating zero-copy serialization provided in an embodiment of this application. Figure 7As shown, the corresponding schema definition can be found based on the schema version information. Based on the schema definition, the number (or name), type, and other information of N fields are determined. The corresponding position in the offset array in the address region is found through the number, thus obtaining the starting offset of the corresponding field value in the data region. Finally, according to the field type, bytes of the appropriate length are read from the starting offset and filled into the application memory of the receiving end. Since the memory layout of the sending end has been optimized to align with the target network transmission format, and the receiving end already knows the mapping relationship through the schema definition, the parsing process mainly involves address calculation and direct memory writing, avoiding complex decoding and large amounts of data copying.

[0117] Figure 8 This is an architecture diagram of the remote procedure call framework provided in the embodiments of this application. Figure 8 As shown, the Remote Procedure Call (RPC) framework comprises a transport layer (backend), a presentation layer (middle), and an interaction layer (frontend). The transport layer is responsible for negotiating the optimal transport protocol from among TCP, UTCP, RDMA, and QUIC (Quick UDP Internet Connections), and can switch to other transport protocols, such as from RDMA to UTCP, when network congestion occurs. The presentation layer is responsible for negotiating the network transmission format, which can be RAW or FlatKV. The interaction layer is used for request listening, protocol handshake, and command issuance. Request listening refers to listening to RPC requests and responses. Protocol handshake refers to schema management and dispatch based on the FlatKV format. Command issuance refers to the server actively sending control commands to the client.

[0118] As one possible implementation, the sending end is a server and the receiving end is a client; the method also includes: establishing a reverse command channel when the receiving end and the sending end establish a communication connection; using the reverse command channel to receive control commands sent by the server, the control commands including a service switching command indicating a switch to a new server; and switching the communication connection established with the server to the communication connection established with the new server.

[0119] The reverse command channel, also known as the return channel, is used by the server to send control commands to the client. These control commands instruct the client to perform the corresponding operations. For example, if the control command is a service switching command instructing the client to switch to a new server, it can disconnect the client from the current server and establish an RPC communication connection with the new server, thus achieving data flow switching.

[0120] Understandably, this application enables the server to proactively send service switching commands to the client by establishing a reverse command channel, thereby expanding the management and control capabilities of the RPC framework, simplifying the service switching process, and achieving rapid flow switching.

[0121] Taking RDMA combined with FlatKV as an example, suppose a client initiates an RPC request. When the client and server establish a connection, they negotiate to use RDMA as the transport protocol and FlatKV as the target network transport format. Then, the client sends a service request to the server. Upon receiving this request, the server optimizes the memory layout of the data to be sent according to the FlatKV format based on the schema definition, ensuring that the data's layout in memory is aligned with the FlatKV format. The server's intelligent serialization engine then only needs to append a header containing schema version information and the number of fields, along with a calculated offset array, to the data to be sent, thereby generating serialized data. The RDMA transport module submits a pointer to this serialized data to the network interface card (NIC), which reads the serialized data via DMA and sends it over the network.

[0122] The client receives serialized data via RDMA and places it in a buffer. The receiving end's intelligent serialization engine queries the corresponding schema definition based on the schema version number in the data header to obtain the field number and type. It then looks up the offset array using the field number to obtain the starting offset of the corresponding field in the value region. Based on the field type, it reads the corresponding length of data from the starting offset and writes it into the application memory. Throughout this process, data flows between server-side memory and client-side memory, reducing memory copying and avoiding kernel network stack processing.

[0123] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0124] According to another embodiment, a data transmission apparatus for remote procedure calls is provided. Figure 9 A schematic block diagram of a data transmission apparatus for a remote procedure call according to one embodiment is shown, the apparatus being disposed in Figure 1 In the architecture shown, the sending end and the receiving end establish a communication connection. For example... Figure 9As shown, the device 900 includes a memory optimization unit 901, a serialization unit 902, and a network transmission unit 903. It may further include a protocol negotiation unit 904, a format negotiation unit 905, a command issuance unit 906, and a first communication interaction unit 907. The main functions of each component are as follows: The memory optimization unit 901 is configured to optimize the memory layout of the data to be transmitted to align with the target network transmission format. Serialization unit 902 is configured to generate serialized data based on an aligned memory layout, the serialized data carrying information indicating the data structure of the serialized data; The network transmission unit 903 is configured to use kernel-bypass network transmission technology to transmit the serialized data to the receiving end through the communication interaction unit 907, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0125] As one possible implementation, the memory optimization unit 901 can be configured to: determine the schema definition corresponding to the target network transmission format, the schema definition including at least the order and type information of the fields; based on the schema definition, perform at least one of field rearrangement and hole elimination on the memory layout of the data to be sent, so that the optimized memory layout is aligned with the target network transmission format.

[0126] As one possible implementation, the serialization unit 902 can be configured to: generate an address region and a data header based on the aligned memory layout, wherein the address region includes offset information corresponding to each field in the aligned memory layout, and the data header includes information indicating the data structure of the serialized data, wherein the data structure of the serialized data is the aligned memory layout; and obtain the serialized data based on the data header, the address region, and the value region, wherein the value region corresponds to the data after the memory layout optimization.

[0127] As one possible implementation, the device 900 also includes: The protocol negotiation unit 904 is configured to, when the sending end and the receiving end establish the communication connection, negotiate to use Remote Direct Memory Access Technology or User-mode Transmission Control Protocol as the kernel bypass network transmission technology based on the network environment and / or application characteristics.

[0128] Furthermore, the protocol negotiation unit 904 can be specifically configured as follows: If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA), negotiate to use RDA as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UDP) as the kernel-bypass network transmission technology; or... If the network latency requirement of the application feature is higher than the preset latency requirement, negotiate to use Remote Direct Memory Access (RDA) as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology; or... If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA) technology, and the network latency requirement of the application feature is higher than the preset latency requirement, the RDA technology will be negotiated to be used as the kernel bypass network transmission technology; otherwise, the user-mode transmission control protocol will be negotiated to be used as the kernel bypass network transmission technology.

[0129] Protocol negotiation unit 904 can also be configured as follows: In response to the detection of a change in the network environment, based on the changed network environment, the remote direct memory access technology or user-space transfer control protocol is renegotiated as the kernel bypass network transmission technology.

[0130] As one possible implementation, the device 900 also includes: The format negotiation unit 905 is configured to negotiate the target network transmission format between the sending end and the receiving end, and the target network transmission format includes: RAW format or FlatKV format.

[0131] As one possible implementation, the sending end is a server and the receiving end is a client. The device 900 also includes: The command issuing unit 906 is configured to establish a reverse command channel when the sending end and the receiving end establish the communication connection; and to send control commands to the client through the first communication interaction unit 907 using the reverse command channel. The control commands include a service switching command indicating a switch to a new server.

[0132] According to another embodiment, a data transmission apparatus for remote procedure calls is provided. Figure 10 A schematic block diagram of a data transmission apparatus for a remote procedure call according to one embodiment is shown, the apparatus being disposed in Figure 1 In the architecture shown, the receiver and the sender establish a communication connection. For example... Figure 10As shown, the device 1000 includes a network transmission unit 1001 and a data parsing unit 1002, and may further include a service switching unit 1003, a format negotiation unit 1004, a protocol negotiation unit 1005, and a second communication interaction unit 1006. The main functions of each component are as follows: The network transmission unit 1001 is configured to receive serialized data transmitted by the sending end through the second communication interaction unit 1006 using kernel bypass network transmission technology. The memory layout of the serialized data is aligned with the target network transmission format and generated based on the aligned memory layout. The data parsing unit 1002 is configured to parse the serialized data based on information indicating the data structure of the serialized data carried by the serialized data; wherein the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

[0133] As one possible implementation, the information indicating the data structure of the serialized data includes schema version information; the data parsing unit 1002 can be specifically configured to: obtain the schema version information from the data header of the serialized data; based on the schema version information, find the corresponding schema definition, the schema definition including at least the order and type information of the fields; based on the order of the fields, obtain the offset information of each field from the address area of ​​the serialized data in the value area of ​​the serialized data; based on the offset information and type information of each field, read the field values ​​from the value area according to the order of the fields and write them into memory.

[0134] In one possible implementation, the sending end is a server, and the receiving end is a client; the device 1000 includes: The service switching unit 1003 is configured to establish a reverse command channel when the receiving end establishes the communication connection with the sending end; to receive control commands sent by the server through the second communication interaction unit 1006 using the reverse command channel, the control commands including a service switching command indicating a switch to a new server; and to switch the communication connection established with the server to the communication connection established with the new server.

[0135] As one possible implementation, the device 1000 also includes: The format negotiation unit 1004 is configured to negotiate the target network transmission format between the sender and receiver. The target network transmission format includes RAW format or FlatKV format.

[0136] As one possible implementation, the device 1000 also includes: The protocol negotiation unit 1005 is configured to, when the sending end and the receiving end establish the communication connection, negotiate to use Remote Direct Memory Access Technology or User-mode Transmission Control Protocol as the kernel bypass network transmission technology based on the network environment and / or application characteristics.

[0137] Furthermore, the protocol negotiation unit 1005 can be specifically configured as follows: If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA), negotiate to use RDA as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UDP) as the kernel-bypass network transmission technology; or... If the network latency requirement of the application feature is higher than the preset latency requirement, negotiate to use Remote Direct Memory Access (RDA) as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology; or... If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA) technology, and the network latency requirement of the application feature is higher than the preset latency requirement, the RDA technology will be negotiated to be used as the kernel bypass network transmission technology; otherwise, the user-mode transmission control protocol will be negotiated to be used as the kernel bypass network transmission technology.

[0138] The protocol negotiation unit 1005 can also be configured as follows: In response to the detection of a change in the network environment, based on the changed network environment, the remote direct memory access technology or user-space transfer control protocol is renegotiated as the kernel bypass network transmission technology.

[0139] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the description of the method embodiments. The system and device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0140] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0141] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0142] And an electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.

[0143] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0144] in, Figure 11 The architecture of an electronic device is illustrated, which may include a processor 1110, a video display adapter 1111, a disk drive 1112, an input / output interface 1113, a network interface 1114, and a memory 1120. The processor 1110, video display adapter 1111, disk drive 1112, input / output interface 1113, network interface 1114, and memory 1120 can communicate with each other via a communication bus 1130.

[0145] The processor 1110 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.

[0146] The memory 1120 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1120 can store the operating system 1121 for controlling the operation of the electronic device 1100, and the basic input / output system (BIOS) 1122 for controlling the low-level operations of the electronic device 1100. Additionally, it can store a web browser 1123, a data storage management system 1124, and a remote procedure call data transmission device 1125, etc. The aforementioned remote procedure call data transmission device 1125 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 1120 and executed by the processor 1110.

[0147] Input / output interface 1113 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.

[0148] Network interface 1114 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0149] Bus 1130 includes a pathway for transmitting information between various components of the device, such as processor 1110, video display adapter 1111, disk drive 1112, input / output interface 1113, network interface 1114, and memory 1120.

[0150] It should be noted that although the above-described device only shows the processor 1110, video display adapter 1111, disk drive 1112, input / output interface 1113, network interface 1114, memory 1120, bus 1130, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.

[0151] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0152] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A data transmission method for remote procedure calls, characterized in that, Applied to a sending end, wherein a communication connection is established between the sending end and the receiving end, the method includes: Optimize the memory layout of the data to be sent to align with the target network transmission format; Based on the aligned memory layout, serialized data is generated, the serialized data carrying information indicating the data structure of the serialized data; The serialized data is transmitted to the receiving end using kernel-bypass network transmission technology, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

2. The method according to claim 1, characterized in that, The step of optimizing the memory layout of the data to be sent to align with the target network transmission format includes: Determine the schema definition corresponding to the target network transmission format, wherein the schema definition includes at least the order and type information of the fields; Based on the schema definition, at least one of field rearrangement and hole elimination is performed on the memory layout of the data to be sent, so that the optimized memory layout is aligned with the target network transmission format.

3. The method according to claim 1, characterized in that, The generation of serialized data based on the aligned memory layout includes: Based on the aligned memory layout, an address region and a data header are generated. The address region includes offset information for each field corresponding to the aligned memory layout. The data header includes information indicating the data structure of the serialized data, and the data structure of the serialized data is the aligned memory layout. Based on the data header, the address region, and the value region, the serialized data is obtained, where the value region corresponds to the data after the memory layout optimization.

4. The method according to claim 1, characterized in that, The method further includes at least one of the following: When establishing the communication connection, the sending end and the receiving end negotiate to use remote direct memory access technology or user-mode transmission control protocol as the kernel bypass network transmission technology based on the network environment and / or application characteristics. In response to the detection of a change in the network environment, based on the changed network environment, the remote direct memory access technology or user-space transfer control protocol is renegotiated as the kernel bypass network transmission technology.

5. The method according to claim 4, characterized in that, The negotiation uses Remote Direct Memory Access (RDA) or User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology, including: If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA), negotiate to use RDA as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UDP) as the kernel-bypass network transmission technology; or... If the network latency requirement of the application feature is higher than the preset latency requirement, negotiate to use Remote Direct Memory Access (RDA) as the kernel-bypass network transmission technology; otherwise, negotiate to use User-space Transmission Control Protocol (UTP) as the kernel-bypass network transmission technology; or... If the network environment meets the network environment requirements of Remote Direct Memory Access (RDA) technology, and the network latency requirement of the application feature is higher than the preset latency requirement, the RDA technology will be negotiated to be used as the kernel bypass network transmission technology; otherwise, the user-mode transmission control protocol will be negotiated to be used as the kernel bypass network transmission technology.

6. The method according to claim 1, characterized in that, Before optimizing the memory layout of the data to be sent to align with the target network transmission format, the method further includes: The sending end and the receiving end negotiate the target network transmission format to be used, and the target network transmission format includes: RAW format or FlatKV format.

7. The method according to any one of claims 1 to 6, characterized in that, The sending end is a server, and the receiving end is a client; the method further includes: When the sending end and the receiving end establish the communication connection, a reverse command channel is established; The reverse command channel is used to send control commands to the client, including service switching commands instructing a switch to a new server.

8. A data transmission method for remote procedure call, characterized in that, Applied to a receiving end, wherein a communication connection is established between the receiving end and the sending end, the method includes: The serialized data transmitted by the sending end is received using kernel bypass network transmission technology. The memory layout of the serialized data is aligned with the target network transmission format, and the data is generated based on the aligned memory layout. Based on the information indicating the data structure of the serialized data carried by the serialized data, the serialized data is parsed; wherein, the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

9. The method according to claim 8, characterized in that, The information indicating the data structure of the serialized data includes schema version information; parsing the serialized data based on the information indicating the data structure carried by the serialized data includes: Obtain the Schema version information from the data header of the serialized data; Based on the Schema version information, the corresponding Schema definition is found, and the Schema definition includes at least the order and type information of the fields; Based on the order of the fields, the offset information of each field in the value region of the serialized data is obtained from the address region of the serialized data; Based on the offset and type information of each field, the field values ​​are read from the value area and written into memory in the order of the fields.

10. The method according to claim 8 or 9, characterized in that, The sending end is a server, and the receiving end is a client; the method further includes: When the receiving end and the sending end establish the communication connection, a reverse command channel is established; The reverse command channel is used to receive control commands sent by the server, including service switching commands indicating a switch to a new server. The communication connection established with the server is switched to the communication connection established with the new server.

11. A data transmission device for remote procedure call, characterized in that, Applied to a transmitting end, wherein a communication connection is established between the transmitting end and the receiving end, the device includes: The memory optimization unit is configured to optimize the memory layout of the data to be sent to align with the target network transmission format. A serialization unit is configured to generate serialized data based on an aligned memory layout, the serialized data carrying information indicating the data structure of the serialized data; The network transmission unit is configured to transmit the serialized data to the receiving end using kernel-bypass network transmission technology, so that the receiving end can parse the serialized data based on the information indicating the data structure of the serialized data. The kernel-bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

12. A data transmission device for remote procedure call, characterized in that, Applied to a receiving end, wherein a communication connection is established between the receiving end and the sending end, the method includes: The network transmission unit is configured to receive serialized data transmitted by the sending end using kernel bypass network transmission technology, wherein the memory layout of the serialized data is aligned with the target network transmission format and generated based on the aligned memory layout. The data parsing unit is configured to parse the serialized data based on information indicating the data structure of the serialized data carried by the serialized data; wherein the kernel bypass network transmission technology includes remote direct memory access technology or user-mode transmission control protocol.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 10.

14. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 10.

15. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 10.