A data loading method, device, equipment and computer readable medium
By migrating the TCP/IP protocol stack from kernel mode to user mode and utilizing the interaction between the user-mode protocol stack and dynamic libraries, the performance consumption and resource binding issues caused by the kernel-mode protocol stack in Tair are resolved, resulting in more efficient data processing and easier debugging.
Patent Information
- Application Number
- CN202310317487.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-03-21
AI Technical Summary
In Tair, the configuration server and data server handle connections through the kernel's TCP/IP protocol stack, resulting in high overhead from context switching between user mode and kernel mode. This makes it impossible to separate them from application resources, thus impacting performance.
The TCP/IP protocol stack is migrated from kernel mode to user mode, and packet processing is performed through the user-mode protocol stack. Dynamic libraries and data plane development kits are used for interaction to achieve an independent process for packet vectors, thus removing the dependency on the kernel-mode protocol stack.
The performance consumption of the kernel-mode protocol stack has been optimized, the context switching between user mode and kernel mode has been avoided, the trial and error cost has been reduced, and the convenience of debugging and the flexibility of customization have been improved.
Smart Images

Figure CN116383175B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer technology and digital healthcare, and in particular to a data loading method, apparatus, device, and computer-readable medium. Background Technology
[0002] With the rise of artificial intelligence (AI) technology, loading medical data from configuration servers, data servers, and clients using AI can support functions such as disease-assisted diagnosis, health management, and remote consultations. This medical data includes, but is not limited to, personal health records, prescriptions, and examination reports.
[0003] Tair (Taobao Pair, or Tair for short) is a distributed key-value storage engine developed by Taobao, widely used in distributed high-speed caching scenarios on internet platforms. A Tair cluster includes three mandatory modules: a configuration server, a data server, and a client. Tair performance optimization typically involves various solutions such as client performance optimization, storage mode selection, and batch access. However, the configuration server and data server in Tair, as standard socket-type applications, handle connection establishment, request reading, and response return with the client through the kernel's TCP / IP protocol stack. Since Tair itself is a user-space application, calling the kernel-space TCP / IP protocol stack incurs the overhead of context switching between user and kernel modes. Furthermore, the kernel protocol stack is bound to the application, making it impossible to decouple them in terms of resource consumption. The traditional kernel-mode protocol stack incurs significant CPU (Central Processing Unit), memory, and kernel-mode-to-user-mode performance overhead. Therefore, optimization is needed to mitigate this performance loss. Summary of the Invention
[0004] In view of the shortcomings of the prior art described above, the purpose of this application is to provide a data loading method, apparatus, device and computer-readable medium to solve the problems existing in the prior art.
[0005] To achieve the above and other related objectives, this application provides a data loading method, the method comprising the following steps:
[0006] Obtain the first data packet;
[0007] The first data packet is processed into a vector data packet to obtain a data packet vector corresponding to the first data packet, and the data packet vector is used as an independent process of the first user-space protocol stack.
[0008] The dynamic library, either pre-acquired or acquired in real-time, is used as a socket interface and interacts with the data packet vector, which is an independent process, to transfer the packets from the kernel-mode protocol stack to the first user-mode protocol stack for loading.
[0009] Optionally, the process of obtaining the first data packet includes:
[0010] Retrieve application service data packets from the distributed key-value storage engine;
[0011] Based on the application service data message, the user-space protocol stack corresponding to the application service data message is matched from multiple user-space protocol stacks and used as the first user protocol stack;
[0012] The first data packet is obtained from the target network interface card (NIC); wherein the target NIC includes a NIC associated with the first user-space protocol stack.
[0013] Optionally, the process of performing vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and using the data packet vector as an independent process of the first user-space protocol stack, includes:
[0014] The first data packet is processed as a vector data packet, and the first data packet is loaded using a network stack to obtain a data packet vector corresponding to the first data packet, and the data packet vector is cached in a preset storage space;
[0015] The driver is invoked in the preset storage space, and the data packet vectors in the preset storage space are sent and received using the data plane development kit, serving as an independent process of the first user-mode protocol stack.
[0016] Optionally, before using the pre-acquired or real-time dynamic library as the socket interface, the method further includes: stripping the first user-space protocol stack from the client application and loading the pre-acquired or real-time dynamic library through a first environment variable.
[0017] Optionally, when using a pre-acquired or real-time dynamic library as a socket interface and interacting with a data packet vector as an independent process, the method further includes:
[0018] Configure a shared memory space and encapsulate a target message queue based on the shared memory space; wherein, the shared memory space is a large page cache generated in user space using large pages according to shared memory technology, and the target message queue is used to complete the communication interaction between the dynamic library and the data packet vector;
[0019] The first user-space protocol stack is run in a first-in-first-out polling mode, and the function flag in the shared memory space is monitored for changes. When the function flag changes, the corresponding function is executed.
[0020] Optionally, when using the data plane development kit to send and receive data packet vectors in a preset storage space, the method further includes:
[0021] This involves replacing multithreading with multicore programming and setting CPU affinity to bind a single thread to a single CPU core; and...
[0022] The kernel of the central processing unit controls the memory of the node to use non-uniform memory access.
[0023] This application also provides a data loading apparatus, the apparatus comprising:
[0024] The data packet module is used to acquire the first data packet;
[0025] The vector processing module is used to perform vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and to use the data packet vector as an independent process of the first user-space protocol stack.
[0026] The data loading module is used to use pre-acquired or real-time dynamic libraries as socket interfaces and interact with data packet vectors as independent processes to transfer messages from the kernel-mode protocol stack to the first user-mode protocol stack for loading.
[0027] Optionally, the vector processing module includes: a data plane development kit, a transmission protocol unit, a session unit, and a communication unit;
[0028] The data plane development kit is used to send and receive data packet vectors in a preset storage space as an independent process of the first user-space protocol stack, wherein the data packet vectors are cached in the preset storage space and generated by combining the first data packets;
[0029] The transmission protocol unit is used to transmit data packet vectors as a data stream to the session unit;
[0030] The session unit is used to create session objects based on the data stream, maintain the use of multi-core programming to replace multi-threading, and set the affinity of the central processing unit to bind a single thread to a single central processing unit kernel so that the data stream can be synchronized between different kernels;
[0031] The communication unit is used to provide a first-in-first-out polling mode for the data stream, so that the vector processing module and the data loading module can communicate and interact.
[0032] This application also provides a data loading device, including:
[0033] processor; and,
[0034] A computer-readable medium storing instructions that, when executed by the processor, cause the device to perform any of the methods described above.
[0035] This application also provides a computer-readable medium having instructions stored thereon, the instructions being loaded by a processor and executed as described in any of the above methods.
[0036] As described above, this application provides a data recording method, apparatus, device, and computer-readable medium, which have the following beneficial effects:
[0037] This application first acquires a first data packet, then performs vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and uses this data packet vector as an independent process of the first user-mode protocol stack. Finally, a pre-acquired or real-time dynamic library is used as a socket interface and interacts with the data packet vector as an independent process to transfer the messages from the kernel-mode protocol stack to the first user-mode protocol stack for loading. Therefore, this application moves the TCP / IP protocol stack, originally implemented in kernel mode, to user mode via a user-mode network protocol stack. This not only avoids the context switching overhead between user mode and kernel mode, optimizing the performance loss of the traditional kernel-mode protocol stack, but also makes debugging the program in user mode more convenient. Furthermore, with version iterations, trimming and customizing the kernel protocol stack will significantly reduce the cost of trial and error. Attached Figure Description
[0038] Figure 1 This is a schematic diagram illustrating an exemplary system architecture that applies the technical solutions in one or more embodiments of this application;
[0039] Figure 2 A schematic flowchart illustrating a data loading method provided in one embodiment of this application;
[0040] Figure 3This is a network communication diagram of a user-space protocol stack provided in one embodiment of this application;
[0041] Figure 4 A schematic diagram of a framework for implementing data loading using a user-space network protocol stack, provided in one embodiment of this application;
[0042] Figure 5 A flowchart illustrating a data plane development kit provided in one embodiment of this application;
[0043] Figure 6 This is a schematic diagram of the hardware structure of a data loading device provided in one embodiment of this application;
[0044] Figure 7 This is a schematic diagram of the hardware structure of a data loading device suitable for implementing one or more embodiments of this application. Detailed Implementation
[0045] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0046] It should be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0047] Tair: Taobao Pair, is a distributed key-value storage engine developed by Taobao.
[0048] TCP / IP stands for Transmission Control Protocol / Internet Protocol.
[0049] The TCP / IP protocol stack is a collection of network protocols that form the core framework of network communication. It defines how terminals connect to the Internet and how data is transmitted between them.
[0050] User-space protocol stack refers to the TCP / IP protocol stack that runs in user space.
[0051] User mode is a run level in an operating system, corresponding to kernel mode. User mode is the privileged level at which ordinary user processes run; most applications that users directly interact with run in user mode.
[0052] Key-Value: A key-value pair.
[0053] TairServer: Storage server.
[0054] Socket: A socket is an abstraction of an endpoint for bidirectional communication between application processes on different hosts on a network. A socket represents one end of inter-process communication on the network, providing a mechanism for application-layer processes to exchange data using network protocols.
[0055] NIC: Network Interface Card, a device used to connect a computer to a local area network (LAN).
[0056] VPP: Vector Packet Processing.
[0057] VCL: Visual Component Library, abbreviated as VCL.
[0058] LD_PRELOAD is an environment variable in Linux systems that can affect the runtime linker of a program, allowing predefined dynamic link libraries to be loaded preferentially before the program runs.
[0059] DPDK: Data Plane Development Kit, is an open-source data plane development toolkit. It is a user-space library and driver set provided by Intel to address packet processing performance issues in Linux SMP environments.
[0060] NUMA: Non-Uniform Memory Access Architecture, abbreviated as NUMA.
[0061] FIFO stands for First In First Out. In computers, a FIFO queue is a traditional method of sequential execution, where the first instruction to enter completes and exits before the next instruction is executed.
[0062] Session: When a webpage is accessed on a server, a block of memory is allocated on the server side; this memory is called a Session. This memory is associated with the browser. This browser refers to the browser window or a child window of the browser. This means that only the browser associated with the current Session is allowed to access the page; even newly opened browsers on the same machine cannot access it. If another browser also needs to store a Session, it will create its own Session.
[0063] UIO: Userspace I / O, abbreviated as UIO; it is an I / O technology that runs in user space. In Linux systems, most device drivers run in kernel space, and can be called by applications in user space.
[0064] Cache Miss: This means that the current cache cannot retrieve the required data, so the data needs to be retrieved from the next lower level cache.
[0065] Figure 1 A schematic diagram of an exemplary system architecture that can apply the technical solutions of one or more embodiments of this application is shown. Figure 1 As shown, the system architecture 100 may include terminal device 110, network 120, and server 130. Terminal device 110 may include various electronic devices such as smartphones, tablets, laptops, and desktop computers. Server 130 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal device 110 and server 130, such as a wired communication link or a wireless communication link.
[0066] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group composed of multiple server devices. In addition, the technical solutions provided in this application embodiment can be applied to terminal device 110, or to server 130, or can be implemented jointly by terminal device 110 and server 130. This application does not impose any special limitations on this.
[0067] In one embodiment of this application, the terminal device 110 or server 130 can first acquire a first data packet, then perform vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and use the data packet vector as an independent process of the first user-mode protocol stack; finally, the pre-acquired or real-time dynamic library is used as a socket interface and interacts with the data packet vector as an independent process to transfer the message of the kernel-mode protocol stack to the first user-mode protocol stack for loading. By using the terminal device 110 or server 130 to execute the data loading method, the TCP / IP protocol stack originally implemented in kernel mode can be moved to user mode through the user-mode network protocol stack. This not only avoids the context switching overhead between user mode and kernel mode and optimizes the performance consumption loss of the traditional kernel-mode protocol stack, but also makes it easier to implement and debug programs in user mode by moving the TCP / IP protocol stack originally implemented in kernel mode to user mode through the user-mode network protocol stack. Furthermore, with version iteration, trimming and customization based on the kernel protocol stack will greatly reduce the cost of trial and error.
[0068] The above sections introduced an exemplary system architecture that applies the technical solution of this application. Next, we will continue to introduce the data loading method of this application.
[0069] Figure 2 A schematic flowchart of a data loading method according to an embodiment of this application is shown. Specifically, in an exemplary embodiment, as follows... Figure 2 As shown, this embodiment provides a data loading method, which includes the following steps:
[0070] S210, Obtain the first data packet. As an example, the process of obtaining the first data packet in this embodiment includes: obtaining an application service data packet from a distributed key-value storage engine; based on the application service data packet, matching the user-space protocol stack corresponding to the application service data packet from multiple user-space protocol stacks, and using it as the first user protocol stack; obtaining the first data packet from a target network interface card; wherein, the target network interface card includes a network interface card associated with the first user-space protocol stack.
[0071] S220, Perform vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and use the data packet vector as an independent process of the first user-space protocol stack;
[0072] S230, the dynamic library obtained in advance or in real time is used as a socket interface and interacts with the data packet vector as an independent process to transfer the message of the kernel mode protocol stack to the first user mode protocol stack for loading.
[0073] Therefore, this embodiment demonstrates that by moving the TCP / IP protocol stack, originally implemented in kernel mode, to user mode via a user-mode network protocol stack, it not only avoids the context switching overhead between user mode and kernel mode, thus optimizing the performance loss of the traditional kernel-mode protocol stack, but also simplifies program debugging in user mode. Furthermore, with version iterations, tailoring and customizing the kernel protocol stack significantly reduces trial-and-error costs.
[0074] In an exemplary embodiment, the process of performing vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and using the data packet vector as an independent process of the first user-mode protocol stack, includes: performing vector data packet processing on the first data packet, loading the first data packet using a network stack to obtain a data packet vector corresponding to the first data packet, and caching the data packet vector in a preset storage space; calling a driver in the preset storage space, and using a data plane development kit to send and receive the data packet vector in the preset storage space, thus using it as an independent process of the first user-mode protocol stack. Therefore, this embodiment solves the problems of system interrupts, context switching, system calls, and system scheduling that currently exist in the kernel protocol stack by transferring tasks such as data packet processing, memory management, and processor scheduling to the preset storage space, while the kernel only handles some control instructions. As an example, the preset storage space in this embodiment includes, but is not limited to, user space.
[0075] In an exemplary embodiment, before using the pre-acquired or real-time dynamic library as the socket interface, the method may further include: stripping the first user-space protocol stack from the client application and loading the pre-acquired or real-time dynamic library through a first environment variable. Therefore, this embodiment uses a VPP+VCL separate deployment mode to strip the user-space protocol stack from the application, that is, separating the resource usage of the user-space protocol stack from the application, and loading the VCL dynamic library through LD_PRELOAD (environment variable) to achieve non-intrusive acceleration for Tair.
[0076] In an exemplary embodiment, when a pre-acquired or real-time dynamic library is used as a socket interface and interacts with a data packet vector as an independent process, the method may further include: configuring a shared memory space and encapsulating a target message queue based on the shared memory space; wherein the shared memory space is a large-page cache generated in user space using large pages according to shared memory technology, and the target message queue is used to complete the communication interaction between the dynamic library and the data packet vector; the first user-space protocol stack is run in a first-in-first-out (FIFO) polling mode, and the system monitors whether the function flag in the shared memory space changes, and executes the corresponding function when the function flag changes. Therefore, this embodiment reduces cache misses by using a large-page cache instead of a regular cache. Furthermore, this embodiment uses a FIFO polling mode, which allows for communication between the VCL and VPP based on the message queue encapsulated in shared memory.
[0077] In an exemplary embodiment, the process of sending and receiving data packet vectors in a preset storage space using the data plane development kit may further include: replacing multithreading with multicore programming and setting CPU affinity to bind a single thread to a single CPU core; and controlling the CPU core to use the memory of a non-uniform memory access node. Thus, this embodiment uses multicore programming technology instead of multithreading technology and sets CPU affinity to bind threads and CPU cores one-to-one, reducing scheduling and switching between them. Simultaneously, by controlling the CPU core to use the memory of a non-uniform memory access node, this embodiment can maximize the use of the CPU core's memory within its NUMA node, avoiding cross-node memory access.
[0078] In another exemplary embodiment of this application, this application also provides a data loading method using a user-space network protocol stack, including the following steps:
[0079] The dynamic library VCL is selected based on the distributed key-value storage engine Tair;
[0080] Data packets are obtained from the target network interface card (NIC); wherein, in this embodiment, the target NIC includes a network interface card associated with the user-space protocol stack, and the network communication method of the user-space protocol stack in this embodiment is as follows: Figure 3 As shown.
[0081] The acquired data packets are processed by VPP or vector data packet processing to obtain the corresponding data packet vectors. At the same time, the data packet vectors are implemented as an independent process in user space to implement the TCP / IP protocol stack.
[0082] The VCL dynamic library is used to hijack the Socket class interface and communicate with the backend VPP to transfer the packets of the kernel-mode protocol stack to the user-mode protocol stack for loading.
[0083] Therefore, this embodiment separates the protocol stack from the application side using the VPP+VCL separate deployment mode, that is, the protocol stack and the application are separated in terms of resource usage, and the VCL dynamic library is loaded by LD_PRELOAD (environment variable), thus achieving non-intrusive acceleration for Tair.
[0084] The schematic diagram of the framework for data loading using a user-space network protocol stack is shown below. Figure 4 As shown. In Figure 4 In this architecture, VCL is used to implement Socket class interface hijacking and interact with the backend VPP. FIFO, a message queue based on shared memory, provides a first-in-first-out polling mode between VCL and VPP for data stream communication. Session maintains the mapping between the transport layer and upper-layer application sessions. The user-space TCP / IP protocol stack corresponds to the kernel's TCP / IP protocol stack. The Data Plane Development Kit (DPDK) is used to transfer packet transmission and reception from kernel mode to user mode.
[0085] The workflow of the Data Plane Development Kit (DPDK) is as follows: Figure 5 As shown. Among them, the data packets flow through the Data Plane Development Kit (DPDK) as follows: network card → UIO driver → DPDK user space packet sending and receiving → user space TCP / IP protocol stack → Socket-like interface → application. This is equivalent to bypassing the kernel and sending and receiving packets directly in user space through the Data Plane Development Kit (DPDK), thereby optimizing the kernel's consumption loss. Specifically, the Data Plane Development Kit (DPDK) accelerates the performance of the user space protocol stack in the following ways: (1) Separation of control layer and data layer: The tasks of data packet processing, memory management, processor scheduling, etc. are transferred to the preset storage space to be completed, while the kernel is only responsible for processing some control instructions. In this way, there are no problems such as system interrupts, context switching, system calls, system scheduling, etc. mentioned above. (2) Multi-core programming technology replaces multi-threading technology: Multi-core programming technology is used to replace multi-threading technology, and the affinity of the CPU is set to bind the threads and CPU cores one to one, reducing the scheduling and switching between them. (3) Avoid cross-node memory use: The CPU core uses the memory of the NUMA node where it is located, avoiding cross-node memory access. (4) Huge page cache: Use huge page cache instead of ordinary cache to reduce cache misses. (5) Lock-free technology: Use lock-free technology to solve resource contention problems.
[0086] Therefore, this embodiment utilizes a user-space protocol stack for Tair network performance acceleration, offering the following advantages: 1) Higher performance. Tair itself is a user-space application, calling the kernel-space TCP / IP protocol stack, inevitably incurring context switching overhead between user and kernel modes. Furthermore, and most importantly, the kernel protocol stack is bound to the application, making it impossible to separate them in terms of resource consumption—the previously mentioned separate deployment. 2) Easier debugging. Debugging programs under the kernel is cumbersome and prone to causing kernel crashes. Debugging in user space is much easier. 3) Easier customization. With each version iteration, the kernel protocol stack becomes increasingly bloated due to historical baggage. Integrating new features requires more dependencies and greater caution, even lengthening bug fixes. User-space protocol stacks avoid these problems, allowing for customization and tailoring based on the kernel stack. Easier debugging also significantly reduces trial-and-error costs.
[0087] In summary, this embodiment provides a data loading method. First, a first data packet is acquired. Then, the first data packet undergoes vector data packet processing to obtain a data packet vector corresponding to the first data packet. This data packet vector is then used as an independent process of a first user-mode protocol stack. Finally, a pre-acquired or real-time dynamic library is used as a socket interface and interacts with the data packet vector as an independent process to transfer packets from the kernel-mode protocol stack to the first user-mode protocol stack for loading. Therefore, this method moves the TCP / IP protocol stack, originally implemented in kernel mode, to user mode via a user-mode network protocol stack. This not only avoids the context switching overhead between user mode and kernel mode, optimizing the performance loss of traditional kernel-mode protocol stacks, but also makes debugging the program in user mode more convenient. Furthermore, with version iterations, trimming and customizing the kernel protocol stack significantly reduces trial-and-error costs.
[0088] like Figure 6 As shown, this application also provides a data loading apparatus, the apparatus comprising:
[0089] The data packet module 610 is used to acquire a first data packet. As an example, the process of acquiring the first data packet in this embodiment includes: acquiring an application service data packet from a distributed key-value storage engine; based on the application service data packet, matching the user-space protocol stack corresponding to the application service data packet from multiple user-space protocol stacks, and using it as the first user protocol stack; acquiring the first data packet from a target network interface card (NIC); wherein the target NIC includes a NIC associated with the first user-space protocol stack.
[0090] Vector processing module 620 is used to perform vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and to use the data packet vector as an independent process of the first user-space protocol stack.
[0091] The data loading module 630 is used to use the pre-acquired or real-time dynamic library as a socket interface and interact with the data packet vector as an independent process to transfer the message of the kernel mode protocol stack to the first user mode protocol stack for loading.
[0092] Therefore, this embodiment demonstrates that by moving the TCP / IP protocol stack, originally implemented in kernel mode, to user mode via a user-mode network protocol stack, it not only avoids the context switching overhead between user mode and kernel mode, thus optimizing the performance loss of the traditional kernel-mode protocol stack, but also simplifies program debugging in user mode. Furthermore, with version iterations, tailoring and customizing the kernel protocol stack significantly reduces trial-and-error costs.
[0093] In one exemplary embodiment, the vector processing module includes: a data plane development kit, a transport protocol unit, a session unit, and a communication unit;
[0094] The data plane development kit is used to send and receive data packet vectors in a preset storage space as an independent process of the first user-space protocol stack. The data packet vectors are cached in the preset storage space and generated by combining the first data packets. As an example, the preset storage space in this embodiment includes, but is not limited to, the user space.
[0095] The transmission protocol unit is used to transmit data packet vectors as a data stream to the session unit;
[0096] The session unit is used to create session objects based on the data stream, maintain the use of multi-core programming to replace multi-threading, and set the affinity of the central processing unit to bind a single thread to a single central processing unit kernel so that the data stream can be synchronized between different kernels;
[0097] The communication unit is used to provide a first-in-first-out polling mode for the data stream, so that the vector processing module and the data loading module can communicate and interact.
[0098] In an exemplary embodiment, the process of performing vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and using the data packet vector as an independent process of the first user-mode protocol stack, includes: performing vector data packet processing on the first data packet, loading the first data packet using a network stack to obtain a data packet vector corresponding to the first data packet, and caching the data packet vector in a preset storage space; calling a driver in the preset storage space, and using a data plane development kit to send and receive the data packet vector in the preset storage space, thus using it as an independent process of the first user-mode protocol stack. Therefore, this embodiment solves the problems of system interrupts, context switching, system calls, and system scheduling that currently exist in the kernel protocol stack by transferring tasks such as data packet processing, memory management, and processor scheduling to the preset storage space, while the kernel only handles some control instructions. As an example, the preset storage space in this embodiment includes, but is not limited to, user space.
[0099] In an exemplary embodiment, before using the pre-acquired or real-time dynamic library as the socket interface, the method may further include: stripping the first user-space protocol stack from the client application and loading the pre-acquired or real-time dynamic library through a first environment variable. Therefore, this embodiment uses a VPP+VCL separate deployment mode to strip the user-space protocol stack from the application, that is, separating the resource usage of the user-space protocol stack from the application, and loading the VCL dynamic library through LD_PRELOAD (environment variable) to achieve non-intrusive acceleration for Tair.
[0100] In an exemplary embodiment, when a pre-acquired or real-time dynamic library is used as a socket interface and interacts with a data packet vector as an independent process, the method may further include: configuring a shared memory space and encapsulating a target message queue based on the shared memory space; wherein the shared memory space is a large-page cache generated in user space using large pages according to shared memory technology, and the target message queue is used to complete the communication interaction between the dynamic library and the data packet vector; the first user-space protocol stack is run in a first-in-first-out (FIFO) polling mode, and the system monitors whether the function flag in the shared memory space changes, and executes the corresponding function when the function flag changes. Therefore, this embodiment reduces cache misses by using a large-page cache instead of a regular cache. Furthermore, this embodiment uses a FIFO polling mode, which allows for communication between the VCL and VPP based on the message queue encapsulated in shared memory.
[0101] In an exemplary embodiment, the process of sending and receiving data packet vectors in a preset storage space using the data plane development kit may further include: replacing multithreading with multicore programming and setting CPU affinity to bind a single thread to a single CPU core; and controlling the CPU core to use the memory of a non-uniform memory access node. Thus, this embodiment uses multicore programming technology instead of multithreading technology and sets CPU affinity to bind threads and CPU cores one-to-one, reducing scheduling and switching between them. Simultaneously, by controlling the CPU core to use the memory of a non-uniform memory access node, this embodiment can maximize the use of the CPU core's memory within its NUMA node, avoiding cross-node memory access.
[0102] In another exemplary embodiment of this application, this application also provides a data loading apparatus employing a user-space network protocol stack, for performing the following steps:
[0103] The dynamic library VCL is selected based on the distributed key-value storage engine Tair;
[0104] Data packets are obtained from the target network interface card (NIC); wherein, in this embodiment, the target NIC includes a network interface card associated with the user-space protocol stack, and the network communication method of the user-space protocol stack in this embodiment is as follows: Figure 3 As shown.
[0105] The acquired data packets are processed by VPP or vector data packet processing to obtain the corresponding data packet vectors. At the same time, the data packet vectors are implemented as an independent process in user space to implement the TCP / IP protocol stack.
[0106] The VCL dynamic library is used to hijack the Socket class interface and communicate with the backend VPP to transfer the packets of the kernel-mode protocol stack to the user-mode protocol stack for loading.
[0107] Therefore, this embodiment separates the protocol stack from the application side using the VPP+VCL separate deployment mode, that is, the protocol stack and the application are separated in terms of resource usage, and the VCL dynamic library is loaded by LD_PRELOAD (environment variable), thus achieving non-intrusive acceleration for Tair.
[0108] The schematic diagram of the framework for data loading using a user-space network protocol stack is shown below. Figure 4 As shown. In Figure 4In this architecture, VCL is used to implement Socket class interface hijacking and interact with the backend VPP. FIFO, a message queue based on shared memory, provides a first-in-first-out polling mode between VCL and VPP for data stream communication. Session maintains the mapping between the transport layer and upper-layer application sessions. The user-space TCP / IP protocol stack corresponds to the kernel's TCP / IP protocol stack. The Data Plane Development Kit (DPDK) is used to transfer packet transmission and reception from kernel mode to user mode.
[0109] The workflow of the Data Plane Development Kit (DPDK) is as follows: Figure 5 As shown. Among them, the data packets flow through the Data Plane Development Kit (DPDK) as follows: network card → UIO driver → DPDK user space packet sending and receiving → user space TCP / IP protocol stack → Socket-like interface → application. This is equivalent to bypassing the kernel and sending and receiving packets directly in user space through the Data Plane Development Kit (DPDK), thereby optimizing the kernel's consumption loss. Specifically, the Data Plane Development Kit (DPDK) accelerates the performance of the user space protocol stack in the following ways: (1) Separation of control layer and data layer: The tasks of data packet processing, memory management, processor scheduling, etc. are transferred to the preset storage space to be completed, while the kernel is only responsible for processing some control instructions. In this way, there are no problems such as system interrupts, context switching, system calls, system scheduling, etc. mentioned above. (2) Multi-core programming technology replaces multi-threading technology: Multi-core programming technology is used to replace multi-threading technology, and the affinity of the CPU is set to bind the threads and CPU cores one to one, reducing the scheduling and switching between them. (3) Avoid cross-node memory use: The CPU core uses the memory of the NUMA node where it is located, avoiding cross-node memory access. (4) Huge page cache: Use huge page cache instead of ordinary cache to reduce cache misses. (5) Lock-free technology: Use lock-free technology to solve resource contention problems.
[0110] Therefore, this embodiment utilizes a user-space protocol stack for Tair network performance acceleration, offering the following advantages: 1) Higher performance. Tair itself is a user-space application, calling the kernel-space TCP / IP protocol stack, inevitably incurring context switching overhead between user and kernel modes. Furthermore, and most importantly, the kernel protocol stack is bound to the application, making it impossible to separate them in terms of resource consumption—the previously mentioned separate deployment. 2) Easier debugging. Debugging programs under the kernel is cumbersome and prone to causing kernel crashes. Debugging in user space is much easier. 3) Easier customization. With each version iteration, the kernel protocol stack becomes increasingly bloated due to historical baggage. Integrating new features requires more dependencies and greater caution, even lengthening bug fixes. User-space protocol stacks avoid these problems, allowing for customization and tailoring based on the kernel stack. Easier debugging also significantly reduces trial-and-error costs.
[0111] In summary, this embodiment provides a data loading device. First, a first data packet is acquired. Then, the first data packet undergoes vector data packet processing to obtain a data packet vector corresponding to the first data packet. This data packet vector is then used as an independent process of a first user-mode protocol stack. Finally, a pre-acquired or real-time dynamic library is used as a socket interface and interacts with the data packet vector as an independent process to transfer packets from the kernel-mode protocol stack to the first user-mode protocol stack for loading. Therefore, this device moves the TCP / IP protocol stack, originally implemented in kernel mode, to user mode via a user-mode network protocol stack. This not only avoids the context switching overhead between user mode and kernel mode, optimizing the performance loss of traditional kernel-mode protocol stacks, but also makes debugging programs in user mode more convenient. Furthermore, with version iterations, trimming and customization based on the kernel protocol stack significantly reduces trial-and-error costs.
[0112] It should be noted that the data loading device and the data loading method provided in the above embodiments belong to the same concept. The specific way each module performs its operation has been described in detail in the method embodiments and will not be repeated here. In practical applications, the data loading device provided in the above embodiments can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the system into different functional modules to complete all or part of the functions described above. This application does not impose any limitations on this. Therefore, this application effectively overcomes the various shortcomings of the prior art and has high industrial application value.
[0113] In an exemplary embodiment, the data loading apparatus and / or data loading method described in some of the above embodiments can be used in the field of digital healthcare. For example, the data loading apparatus and / or data loading method can be applied to load medical data. The medical data in this embodiment includes, but is not limited to: personal health records, electronic prescription data, medical text data, examination report data, etc.; furthermore, the medical data in this embodiment can also be medical images, including but not limited to: medical images of the stomach, abdomen, heart, knees, brain, etc.; such as CT (Computed Tomography), MRI (Magnetic Resonance Imaging), US (ultrasonic), X-ray images, electroencephalograms, and images generated by medical instruments using optical imaging. The medical text in this embodiment can be an electronic healthcare record, an electronic personal health record, including medical records, electrocardiograms, medical images, and a series of electronic records with archival value. In the medical field, through the above data loading method, the user's required medical record information can be retrieved from a massive amount of electronic medical records based on an artificial intelligence model, which helps to provide users with medical record references.
[0114] This application also provides a data loading device, which may include: one or more processors; and one or more machine-readable media storing instructions thereon, which, when executed by the one or more processors, cause the device to perform... Figure 2 The method described. Figure 7 A schematic diagram of a data loading device 700 is shown. (See attached diagram.) Figure 7 As shown, the data loading device 700 includes: a processor 710, a memory 720, a power supply 730, a display unit 740, and an input unit 760.
[0115] The processor 710 is the control center of the data loading device 700. It connects various components via interfaces and lines, and executes various functions of the data loading device 700 by running or executing software programs and / or data stored in the memory 720, thereby providing overall monitoring of the data loading device 700. In this embodiment, when the processor 710 calls the computer program stored in the memory 720, it executes... Figure 2The method described herein. Optionally, processor 710 may include one or more processing units; preferably, processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. In some embodiments, the processor and memory may be implemented on a single chip; in some embodiments, they may also be implemented on separate chips.
[0116] The memory 720 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, various applications, etc.; the data storage area may store data created based on the use of the data loading device 700, etc. In addition, the memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device, etc.
[0117] The data loading device 700 also includes a power supply 730 (such as a battery) that supplies power to various components. The power supply can be logically connected to the processor 710 through a power management system, thereby enabling the management of charging, discharging, and power consumption.
[0118] The display unit 740 can be used to display information input by the user or information provided to the user, as well as various menus of the data loading device 700. In this embodiment, it is mainly used to display the display interfaces of various applications in the data loading device 700, as well as text, images, and other objects displayed in the display interfaces. The display unit 740 may include a display panel 750. The display panel 750 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0119] Input unit 760 can be used to receive information such as numbers or characters input by the user. Input unit 760 may include touch panel 770 and other input devices 780. Touch panel 770, also known as touch screen, can collect touch operations on or near the user (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 770).
[0120] Specifically, the touch panel 770 can detect user touch operations and the signals generated by these operations, converting them into touch point coordinates and sending them to the processor 710. It can also receive and execute commands from the processor 710. Furthermore, the touch panel 770 can be implemented using various types of sensors, including resistive, capacitive, infrared, and surface acoustic wave sensors. Other input devices 780 can include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.
[0121] Of course, the touch panel 770 can cover the display panel 750. When the touch panel 770 detects a touch operation on or near it, it transmits the information to the processor 710 to determine the type of touch event. Subsequently, the processor 710 provides corresponding visual output on the display panel 750 based on the type of touch event. Although in Figure 7 In this embodiment, the touch panel 770 and the display panel 750 are two separate components to realize the input and output functions of the data loading device 700. However, in some embodiments, the touch panel 770 and the display panel 750 can be integrated to realize the input and output functions of the data loading device 700.
[0122] The data loading device 700 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, depending on the specific application requirements, the data loading device 700 may also include other components such as a camera.
[0123] This application also provides a computer-readable storage medium storing instructions that, when executed by one or more processors, enable the device to perform the functions described in this application. Figure 2 The method described.
[0124] It will be understood by those skilled in the art that Figure 7 This is merely an example of a data loading device and does not constitute a limitation on the device. The device may include more or fewer components than illustrated, or a combination of certain components, or different components. For ease of description, the above sections are divided into modules (or units) according to their functions and described separately. Of course, in implementing this application, the functions of each module (or unit) can be implemented in one or more software or hardware components.
[0125] Those skilled in the art will understand that this application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application, and should be understood to be implementable by computer program instructions for each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams. These computer program instructions may be applied to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0126] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A data loading method, characterized in that, The method includes the following steps: Obtain the first data packet; The first data packet is processed into a vector data packet to obtain a data packet vector corresponding to the first data packet, and the data packet vector is used as an independent process of the first user-space protocol stack. The dynamic library, which is obtained in advance or in real time, is used as a socket interface and interacts with the data packet vector, which is an independent process, to transfer the messages of the kernel-mode protocol stack to the first user-mode protocol stack for loading. The process of performing vector packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and using the data packet vector as an independent process of the first user-mode protocol stack includes: performing vector packet processing on the first data packet, loading the first data packet using a network stack to obtain a data packet vector corresponding to the first data packet, and caching the data packet vector in a preset storage space; calling the driver in the preset storage space, and using a data plane development kit to send and receive the data packet vector in the preset storage space as an independent process of the first user-mode protocol stack; When using a pre-acquired or real-time dynamic library as a socket interface and interacting with a data packet vector as an independent process, the method further includes: configuring a shared memory space and encapsulating a target message queue based on the shared memory space; wherein the shared memory space is a large page cache generated in user space using large pages according to shared memory technology, and the target message queue is used to complete the communication interaction between the dynamic library and the data packet vector; running the first user-space protocol stack in a first-in-first-out polling mode, monitoring whether the function flag in the shared memory space changes, and executing the corresponding function when the function flag changes.
2. The data loading method according to claim 1, characterized in that, The process of obtaining the first data packet includes: Retrieve application service data packets from the distributed key-value storage engine; Based on the application service data message, the user-space protocol stack corresponding to the application service data message is matched from multiple user-space protocol stacks and used as the first user protocol stack; The first data packet is obtained from the target network interface card (NIC); wherein the target NIC includes a NIC associated with the first user-space protocol stack.
3. The data loading method according to claim 1, characterized in that, Before using the pre-acquired or real-time dynamic library as the socket interface, the method further includes: stripping the first user-space protocol stack from the client application and loading the pre-acquired or real-time dynamic library through a first environment variable.
4. The data loading method according to claim 1, characterized in that, When using the data plane development kit to send and receive data packet vectors in the preset storage space, the method further includes: This involves replacing multithreading with multicore programming and setting CPU affinity to bind a single thread to a single CPU core; and... The kernel of the central processing unit controls the memory of the node to use non-uniform memory access.
5. A data loading device, characterized in that, The device includes: The data packet module is used to acquire the first data packet; The vector processing module is used to perform vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and to use the data packet vector as an independent process of the first user-space protocol stack. The data loading module is used to use the pre-acquired or real-time dynamic library as a socket interface and interact with the data packet vector as an independent process to transfer the message of the kernel mode protocol stack to the first user mode protocol stack for loading. The process by which the vector processing module performs vector data packet processing on the first data packet to obtain a data packet vector corresponding to the first data packet, and uses the data packet vector as an independent process of the first user-mode protocol stack, includes: performing vector data packet processing on the first data packet, loading the first data packet using the network stack to obtain a data packet vector corresponding to the first data packet, and caching the data packet vector in a preset storage space; calling the driver in the preset storage space, and using the data plane development kit to send and receive the data packet vector in the preset storage space, as an independent process of the first user-mode protocol stack; When the data loading module uses a pre-acquired or real-time dynamic library as a socket interface and interacts with a data packet vector as an independent process, it further includes: configuring a shared memory space and encapsulating a target message queue based on the shared memory space; wherein, the shared memory space is a large page cache generated in user space using large pages according to shared memory technology, and the target message queue is used to complete the communication interaction between the dynamic library and the data packet vector; running the first user-space protocol stack in a first-in-first-out polling mode, monitoring whether the function flag in the shared memory space changes, and executing the corresponding function when the function flag changes.
6. The data loading device according to claim 5, characterized in that, The vector processing module includes: a data plane development kit, a transmission protocol unit, a session unit, and a communication unit; The data plane development kit is used to send and receive data packet vectors in the preset storage space as an independent process of the first user-space protocol stack, wherein the data packet vectors are cached in the preset storage space and generated by combining the first data packets; The transmission protocol unit is used to transmit data packet vectors as a data stream to the session unit; The session unit is used to create session objects based on the data stream, maintain the use of multi-core programming to replace multi-threading, and set the affinity of the central processing unit to bind a single thread to a single central processing unit kernel so that the data stream can be synchronized between different kernels; The communication unit is used to provide a first-in-first-out polling mode for the data stream, so that the vector processing module and the data loading module can communicate and interact.
7. A data loading device, characterized in that, include: processor; and, A computer-readable medium storing instructions that, when executed by the processor, cause the device to perform the method as described in any one of claims 1 to 4.
8. A computer-readable medium, characterized in that, It stores instructions that are loaded by a processor and executed as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Data transmission method, server and computer readable storage medium
CN110932890A
SSLVPN implementation method based on DPDK and VPP
CN114095251A