Data transmission method, apparatus, system, host device, and storage medium
By using packet filtering and shared memory in cloud computing, the problem of excessive memory consumption in virtual machine communication is solved, data forwarding efficiency is improved, and the communication process is simplified.
Patent Information
- Application Number
- CN202412000397.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In cloud computing, when virtual machines communicate with each other on the same node and across nodes, existing technologies require data copying in the kernel space of the node, resulting in excessive memory consumption and low data forwarding efficiency.
The destination address information of the data packets to be forwarded is intercepted and parsed by the packet filter. The packet filter is matched with the device information table in the virtual machine using shared memory. If the match is successful, the data packet is stored in the shared memory and retrieved by the target virtual machine through the shared memory, thus avoiding copying in the node kernel mode.
It reduces the consumption of node memory resources, improves the data forwarding efficiency of virtual machines on the same node, simplifies the communication method, and avoids the impact on cross-node communication.
Smart Images

Figure CN119854210B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, and particularly relates to a data transmission method, device, system, host equipment and storage medium. BACKGROUND
[0002] A data processing unit (DPU) serves cloud computing, and is used for performing data input / output (IO) tasks of virtual machines across nodes or in the same node in a data center environment. The DPU can forward data packets through a virtual IO path without additionally occupying computing resources of the data center.
[0003] In the related art, when the DPU processes IO communication of the virtual machines in the same node, the data is copied once in the kernel state of the node, and then forwarded to the user state for forwarding by the DPU, which not only occupies too much memory of the node, but also reduces the efficiency of data forwarding. SUMMARY
[0004] The present application provides a data transmission method, device, system, host equipment and storage medium, which can not only simplify the communication mode, accelerate the efficiency of data forwarding of the virtual machines in the same node, but also reduce the occupation of memory resources and improve the performance of the node.
[0005] The technical solution of the present application is implemented as follows:
[0006] In a first aspect, the present application provides a data transmission method, which comprises the following steps:
[0007] In response to a to-be-forwarded data packet entering a kernel of a host equipment, the to-be-forwarded data packet is intercepted and parsed by a data packet filter to determine destination address information of the to-be-forwarded data packet;
[0008] The destination address information is matched with device information table by the data packet filter to determine a result of virtual machine matching;
[0009] In a case where the result of virtual machine matching is successful, a target virtual machine in the host equipment is determined by the data packet filter, the to-be-forwarded data packet is stored in shared memory, and the target virtual machine is controlled to acquire the to-be-forwarded data packet through the shared memory.
[0010] In a second aspect, the present application provides a data transmission device, which comprises the following steps:
[0011] The parsing module is configured to, in response to a to-be-forwarded data packet entering a kernel of a host equipment, intercept and parse the to-be-forwarded data packet by a data packet filter to determine destination address information of the to-be-forwarded data packet;
[0012] determining a result of the virtual machine matching;
[0013] storing the to-be-forwarded data packet into the shared memory and controlling the target virtual machine to acquire the to-be-forwarded data packet from the shared memory.
[0014] In a third aspect, an embodiment of the present application provides a host device, which comprises at least one virtual machine, a data packet filter and a shared memory; wherein:
[0015] the data packet filter is configured to: in response to a to-be-forwarded data packet entering a kernel of the host device, intercept and analyze the to-be-forwarded data packet, determine destination address information of the to-be-forwarded data packet, perform virtual machine matching on the destination address information and the device information table, determine a result of the virtual machine matching, and in a case where the result of the virtual machine matching is successful, determine a target virtual machine in the host device and store the to-be-forwarded data packet into the shared memory;
[0016] the virtual machine is configured to read the shared memory to acquire the to-be-forwarded data packet.
[0017] In a fourth aspect, an embodiment of the present application provides a data transmission system, which comprises at least one host device as described in the third aspect; wherein:
[0018] the host device is configured to perform the data transmission method as described in the first aspect.
[0019] In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the data transmission method as described in the first aspect.
[0020] The application provides a data transmission method, device, system, host equipment and storage medium. Firstly, after a to-be-forwarded data packet enters a kernel, the to-be-forwarded data packet is intercepted and analyzed by a data packet filter to determine destination address information of the to-be-forwarded data packet. In this way, the to-be-forwarded data packet is not copied in the kernel state of a node, thereby reducing the occupation of memory resources of the node and improving the performance of the node. Secondly, the data packet filter performs virtual machine matching on the destination address information and device information table, and in the case that the virtual machine matching succeeds, the to-be-forwarded data packet is stored to shared memory, and then the target virtual machine acquires the to-be-forwarded data packet through the shared memory. In this way, the data packets transmitted by the virtual machines of the same node can be separated and directly transmitted by the shared memory, which simplifies the communication mode between the virtual machines of the same node, improves the data forwarding efficiency of the virtual machines of the same node, and avoids affecting the communication between the virtual machines across nodes. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 FIG. 1 is a schematic diagram of a data transmission process;
[0022] Figure 2 FIG. 2 is a schematic diagram of a step flow of a data transmission method provided by an embodiment of the application;
[0023] Figure 3 FIG. 3 is a schematic diagram of a component structure of a data transmission device provided by an embodiment of the application;
[0024] Figure 4 FIG. 4 is a schematic diagram of a component structure of a host equipment in an embodiment of the application Figure 1 ;
[0025] Figure 5 FIG. 5 is a schematic diagram of a component structure of a host equipment provided by an embodiment of the application Figure 2 ;
[0026] Figure 6 FIG. 6 is a schematic diagram of a component structure of a data transmission system provided by an embodiment of the application;
[0027] Figure 7 FIG. 7 is a schematic diagram of an execution flow of a data transmission system provided by an embodiment of the application. DETAILED DESCRIPTION
[0028] In order to enable more detailed understanding of the features and technical contents of the embodiments of the application, the implementation of the embodiments of the application is described in detail below with reference to the accompanying drawings, which are only used for reference and do not limit the embodiments of the application.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to be limiting of this application.
[0030] In the following description, reference is made to the "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" can be the same subset or a different subset of all possible embodiments and can be combined with each other as long as there is no conflict.
[0031] It should also be noted that the terms "first", "second", "third" etc. used in the embodiments of the present application are only used to distinguish similar objects, and do not represent a specific order of the objects. Understandably, "first", "second", "third" can be interchanged in a specific order or sequence as long as it is allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0032] In the process of gradual evolution of cloud computing technology, in order to meet the functional requirements of different businesses, the cluster size of the data center increases, the structure becomes more complex, and the IO burden of the node also becomes heavier. In the implementation of the traditional technical architecture, the work of data forwarding depends on the central processing unit (CPU) on the node, which causes a bottleneck in the computing power of the data center. The business has not yet run, and only by accessing network data, a large amount of computing power resources is consumed, which is a performance overhead that cannot be borne. Therefore, with the evolution of technology, DPU is applied to cloud computing, DPU is better at basic layer application tasks, such as network protocol processing, switching and routing calculation, etc. Data forwarding tasks are offloaded from CPU to themselves, DPU uses computing power to speed up operations on these tasks, thereby reducing the burden on CPU and reducing the performance loss of data center.
[0033] DPU is a new programmable multi-core processor, which is generally a system on chip (SoC). In the current DPU virtual network architecture, data IO tasks are uniformly handed over to DPU for processing. The host, or node, adopts a virtio data path acceleration (vDPA) scheme, which is a virtio-based virtual IO path acceleration scheme. The scheme decouples the data path and the control path between the front and back ends of virtio, offloads the back end of the data path to the physical network card, and keeps the back end of the control path in the kernel or DPDK. On the premise of not occupying additional host computing resources, the effect of zero loss of virtual IO path is achieved.
[0034] When there are multiple hosts in the network topology, data transmission is more complex. When the data packet enters the host, it triggers a system interrupt, places the data packet in the buff buffer, and notifies the kernel. The kernel protocol stack takes the network frame from the buffer and processes it layer by layer. Figure 1 Figure 1 is a schematic diagram of a data transmission process. As shown in Figure 1 When the virtual machines across nodes communicate, they will pass through the physical network card and virtual network card of the host once. For example, when virtual machine 1 1011 in host 1 101 sends a data packet to virtual machine 3 1021 in host 2 102, it first copies once in the kernel mode, then transmits it to the system-level chip 1014 in the user mode through the data path acceleration process 1013, that is, the vDPA process, and finally sends it to host 2 102 through the virtual network card of host 1 101. After host 2 102 receives the data packet, it also performs the step of copying once in the kernel mode, and then transmits it to the data path acceleration process of host 2 102, which sends it to the corresponding virtual machine 3 1021 through the virtual network card by the data path acceleration process. Alternatively, virtual machine 1 1011 in host 1 101 sends a data packet to virtual machine 2 1012 in host 1 101, which also needs to copy once in the kernel mode of host 1 101, then transmit it to the system-level chip 1014 in the user mode through the data path acceleration process 1013, and then transmit it to the virtual machine 2 102 in the kernel mode. It should be understood that the data transmission between virtual machine 3 1021 and virtual machine 4 1022 in host 2 102 is also in the same way. As can be seen, whether the communication is between virtual machines across nodes or within the same node, it will pass through the host kernel mode, copy the data once, and then transmit it to the user mode, and finally reach the internal virtual machine through the virtual IO path of the data processor process.
[0035] In such a scenario, due to the characteristics of virtual machines, communication between multiple virtual machines on the same host or communication between virtual machines across nodes will involve data copying in the host kernel, multiple memory access operations, and reduced efficiency. At the same time, both intra-node and inter-node IO access need to pass through the DPU virtual IO path, which is costly for intra-node IO access.
[0036] Based on this, the embodiment of the present application provides a data transmission method, device, system, host equipment and storage medium. First, after the to-be-forwarded data packet enters the kernel, the to-be-forwarded data packet is intercepted and analyzed by the data packet filter to determine the destination address information of the to-be-forwarded data packet. In this way, the to-be-forwarded data packet is not copied in the kernel state of the node, thereby reducing the occupation of the memory resources of the node and improving the performance of the node. Secondly, the data packet filter matches the destination address information with the device information table in the virtual machine, and in the case that the virtual machine matching is successful, the to-be-forwarded data packet is stored in the shared memory, and then the target virtual machine obtains the to-be-forwarded data packet through the shared memory. In this way, the data packets transmitted by the virtual machines of the same node can be separated and directly transmitted by the shared memory, which simplifies the communication mode between the virtual machines of the same node, improves the data forwarding efficiency of the virtual machines of the same node, and avoids affecting the communication between the virtual machines across nodes.
[0037] The present application will be further described in detail below with the aid of the accompanying drawings and specific embodiments.
[0038] In an embodiment of the present application, Figure 2 A step flowchart of a data transmission method provided by an embodiment of the present application is shown. The method can be applied to any host equipment in the following data transmission system. Figure 2 As shown in the figure, the data transmission method can include:
[0039] S201, in response to the to-be-forwarded data packet entering the kernel of the host equipment, the to-be-forwarded data packet is intercepted and analyzed by the data packet filter to determine the destination address information of the to-be-forwarded data packet.
[0040] It should be noted that the user state and the kernel state are two running states of the operating system. The process or program in the kernel state can access any data, and the process or program in the user state can only access limited resources. In the embodiment of the present application, at least one virtual machine runs in the kernel state of the host equipment, and based on the implementation process of the operating system, when the to-be-forwarded data packet is sent by the virtual machine inside the host equipment or other host equipment outside the host equipment, it first enters the kernel state of the host equipment.
[0041] In the embodiment of the present application, the data packet filter can refer to an extended Berkeley packet filter (eBPF), and the data packet filter runs in the kernel state and the user state in the form of a process, which can be packaged into a service for calling by the CPU or other processing modules in the host equipment. When the to-be-forwarded data packet enters the kernel state of the host equipment, it can be intercepted by the eBPF service. The intercepted to-be-forwarded data packet will not be copied in the host kernel, thereby reducing the occupation of the memory resources.
[0042] Further, the eBPF service parses the to-be-forwarded data packet, extracts destination address information of the to-be-forwarded data packet based on a preset communication protocol by which the virtual machines in the host device or the virtual machines across nodes communicate.
[0043] S202, the destination address information is matched with the device information table by the data packet filter to determine a virtual machine matching result.
[0044] In the embodiments of the present application, the device information table is an information table maintained by the host device, which includes relevant information of some virtual machine devices or other virtual devices in the host device, such as IP address information corresponding to the virtual machine.
[0045] The data packet filter, i.e., the eBPF service, can further match the extracted destination address information in the to-be-forwarded data packet with the information in the device information table to determine a virtual machine matching result.
[0046] The virtual machine matching can mean that the eBPF service finds whether there is a virtual machine in the host device that receives the to-be-forwarded data packet and is in a working state and can normally read and write the shared memory connection based on the destination address information of the to-be-forwarded data packet. It should be understood that the virtual machine matching result is successful, which means that the virtual machine is determined, and the virtual machine matching result is failed, which means that the virtual machine is not determined.
[0047] S203, in the case that the virtual machine matching result is successful, the target virtual machine in the host device is determined by the data packet filter, the to-be-forwarded data packet is stored in the shared memory, and the target virtual machine is controlled to acquire the to-be-forwarded data packet through the shared memory.
[0048] In the embodiments of the present application, the shared memory means a memory space that can be directly accessed by each virtual machine, the eBPF service and the virtual network card. The host device includes at least one virtual machine, and after the configuration of each virtual machine is completed, the processing module in the host device controls the virtual machine after the start to establish a connection with the shared memory, and notifies the host device. In addition, when the connection relationship between the virtual machine and the shared memory changes, the host device is also notified.
[0049] When the result of the virtual machine matching is successful, i.e., the eBPF service determines that the virtual machine receiving the to-be-forwarded data packet is in the host device, i.e., the target virtual machine, and the target virtual machine is normally connected with the shared memory, the data packet filter can store the to-be-forwarded data packet in the shared memory, and the processing module in the host device or the data packet filter notifies the target virtual machine to read the to-be-forwarded data packet in the shared memory.
[0050] It should be noted that the IP address of the virtual machine is maintained by the host device after the configuration is completed, and is notified to other virtual machines in the same host device through broadcasting. Based on different specific implementations, in the bridge mode, other host devices can obtain the IP address of the virtual machine in the host device; in other modes, such as the NAT mode, the network of the virtual machine and the host is isolated. In the embodiment of the present application, the host device can be similar to the NAT mode, and a set of IP addresses of the virtual machines are maintained inside the host. External host devices access the virtual machines in the host device through a specific port. In this way, the external host device cannot obtain the IP address of the virtual machine in the host device, and the result of the virtual machine matching is failed. That is to say, only the virtual machines in the same node can obtain the IP address and transmit the data packet through the shared memory.
[0051] Alternatively, in some embodiments, the host device can notify other host devices of the IP address of the virtual machine in some modes, so that other host devices transmit data packets to the virtual machine based on the obtained IP address of the virtual machine. In this case, the result of the virtual machine matching is successful, and other host devices can also send data packets to the virtual machine of the host device through the shared memory.
[0052] The embodiment of the present application provides a data transmission method. First, after the to-be-forwarded data packet enters the kernel, the data packet filter intercepts and analyzes the to-be-forwarded data packet to determine the destination address information of the to-be-forwarded data packet. In this way, the to-be-forwarded data packet is not copied in the kernel state of the node, thereby reducing the occupation of the memory resources of the node and improving the performance of the node. Second, the data packet filter performs virtual machine matching on the destination address information and the device information table, and stores the to-be-forwarded data packet in the shared memory in the case of successful virtual machine matching, and then the target virtual machine obtains the to-be-forwarded data packet through the shared memory. In this way, the data packets transmitted by the virtual machines in the same node can be separated and directly transmitted by the shared memory, which simplifies the communication mode between the virtual machines in the same node, improves the data forwarding efficiency of the virtual machines in the same node, and avoids affecting the communication of the virtual machines across nodes.
[0053] In another embodiment of the present application, before the step S202 of performing virtual machine matching on the destination address information and the device information table by the data packet filter, the data transmission method can further include:
[0054] S301, for at least one virtual machine in the host device, obtaining a connection state of each virtual machine and the shared memory.
[0055] In the embodiments of the present application, the host device includes at least one virtual machine, as described above, after the virtual machine is started, it needs to establish a connection with the shared memory. Moreover, after the host device allocates the shared memory for the virtual network card, each virtual machine connects the shared memory, or when the connection state of the virtual machine and the shared memory changes, the host device needs to be notified, so that the processing module in the host device obtains the current connection state of each virtual machine and the shared memory.
[0056] Among them, the connection state of the virtual machine and the shared memory can include active, inactive and unknown, etc.
[0057] S302, assigning a number and address information for each virtual machine.
[0058] In the embodiments of the present application, after the virtual machine successfully connects with the shared memory, the processing module in the host device can assign corresponding information to it, which can include a number, also known as an identification code (Identity Document or Identification, ID), can also include address information (IP), and connection state (Status), etc.
[0059] It should be noted that the number and address information assigned by the host device to the virtual machine does not repeat the number and address information corresponding to the existing virtual machine. After the assignment is completed, the host device can notify other virtual machines in the host device of the address of the virtual machine through broadcast.
[0060] S303, based on the connection state of each virtual machine and the shared memory, the corresponding number and the corresponding address information, constructing a device information table.
[0061] It should be noted that the number and address information corresponding to each virtual machine includes a number, address information, connection state, etc., which can be used as a piece of information corresponding to the virtual machine in the device information table, and the number and address information in the piece of information exist uniquely in the device information table.
[0062] In the embodiments of the present application, the host device internally records and maintains the device information table, which is used to record and maintain the virtual machines that need to communicate through the shared memory. If there is a virtual machine that needs to communicate through the shared memory in the host device, a virtual machine can be selected from the list for data transmission.
[0063] Exemplarily, in the case that the host device includes 4 virtual machines, the device information table can be as shown in Table 1:
[0064] Table 1
[0065] Number Address information Connection state 001 1.1.1.1 Active 002 1.1.1.2 Active 003 1.1.1.3 Active 004 1.1.1.4 Disconnected … … …
[0066] It can be seen that, in the device information table, the virtual machine 1 is assigned with the number 001, the address information is 1.1.1.1, and the connection state with the shared memory is active; the virtual machine 2 is assigned with the number 002, the address information is 1.1.1.2, and the connection state with the shared memory is active; the virtual machine 3 is assigned with the number 003, the address information is 1.1.1.3, and the connection state with the shared memory is active; and the virtual machine 4 is assigned with the number 004, the address information is 1.1.1.4, and the connection state with the shared memory is disconnected. It should be understood that other virtual machines can also be configured in the device information table, and the information corresponding to the newly configured virtual machines can be added in the device information table in the above manner.
[0067] The embodiment of the present application provides a data transmission method, a host device assigns a number and address information to each virtual machine, determines the connection state of the virtual machine with a shared memory, and takes the connection state as device information data corresponding to the virtual machine, and constructs a device information table based on the device information data corresponding to all virtual machines. In this way, the host device can timely know the current connection state of each virtual machine, and accurately control the data forwarding path of the host device.
[0068] In some embodiments, in the step S301, the connection state of each virtual machine with the shared memory can include:
[0069] S401, sending a state query packet to each virtual machine.
[0070] In the embodiment of the present application, after the processing module in the host device constructs the device information table, the processing module can also monitor the connection state of the virtual machine in the host device with the shared memory. Specifically, the host device can send a state query packet to each virtual machine at intervals of a first preset time. The state query packet can include a query instruction for querying whether the virtual machine can currently normally read and write the shared memory.
[0071] S402, determining the connection state of each virtual machine with the shared memory based on the packet reply of each virtual machine.
[0072] In the embodiments of the present application, the processing module in the host device needs to reply to the host device based on the reply message within the second preset time after sending the state query message for each virtual machine. The host device can determine the connection state of each virtual machine with the shared memory based on the reply message of each virtual machine, for example, whether to reply and the content of the reply message.
[0073] It should be noted that for the virtual machine normally connected with the shared memory, the reply message is normally sent to the host device within the second preset time, and the content of the message is active, so the host device determines that the connection state of the virtual machine with the shared memory is active.
[0074] It should be further noted that for the virtual machine disconnected with the shared memory, the reply message can be normally sent to the host device within the second preset time, and the content of the message is disconnected, so the host device determines that the connection state of the virtual machine with the shared memory is disconnected. In addition, the disconnection of the virtual machine with the shared memory is generally initiated by the virtual machine, the association with the shared memory is released, and the host device is actively notified to change the connection state of the virtual machine with the shared memory to disconnected.
[0075] It should be further noted that when the memory resource is insufficient, the virtual machine is unexpectedly closed, or the like, the host device cannot send the reply message to the host device within the second preset time to feed back the connection state of the virtual machine with the shared memory, so the host device can determine that the connection state of the virtual machine with the shared memory is unknown.
[0076] In some embodiments, the data transmission method can further include updating the device information table based on the connection state of each virtual machine with the shared memory.
[0077] Therefore, the processing module or the packet filter in the host device determines the connection state of each virtual machine with the shared memory based on the reply message of each virtual machine, including the aforementioned active, disconnected, unknown, and the like. The host device can compare the newly determined connection state of each virtual machine with the shared memory with the connection state of each virtual machine with the shared memory in the device information table, and replace the connection state of the virtual machine with the shared memory in the device information table with the newly determined connection state when they are inconsistent. Alternatively, all the connection states of the virtual machines with the shared memory in the device information table can be directly replaced with the newly determined connection states according to the correspondence with the virtual machines.
[0078] It should be further noted that in other cases, as described above, when the virtual machine actively disconnects with the shared memory to change the connection state, the host device updates the device information table synchronously when receiving the notification of the virtual machine.
[0079] The embodiment of the present application provides a data transmission method, a host device realizes real-time monitoring on the connection state of each virtual machine and shared memory by sending a state query message to the virtual machine. In this way, the host device can determine the connection state of the virtual machine in time, avoids storing the to-be-forwarded data packet into the shared memory when the virtual machine cannot read and write the shared memory, and causes loss of the to-be-forwarded data packet, thereby improving the reliability of data transmission.
[0080] In another embodiment of the present application, for the step S202, the address information in the device information table is matched with the destination address information by the packet filter, and the result of the virtual machine matching can include:
[0081] S501, the address information in the device information table is matched with the destination address information by the packet filter, and the result of the address matching is determined.
[0082] As described above, the device information table contains the number, address information and connection state of the virtual machine and the like. In the embodiment of the present application, the eBPF service in the host device traverses the address information corresponding to each virtual machine in the device information table, and matches the address information in the device information table with the destination address information from top to bottom, that is, whether there is address information consistent with the destination address information in the device information table is compared.
[0083] It should be understood that, in the case that the result of the address matching is successful, it is determined that the to-be-forwarded data packet is sent by the virtual machine in the same node to another virtual machine in the same node, and then the step S502 is further executed to determine the result of the virtual machine matching. In the case that the result of the address matching is failed, it is determined that the to-be-forwarded data packet is sent across nodes, for example, the virtual machine in the host device is sent by other nodes or the virtual machine in the host device is sent by the virtual machine in other nodes, and then the virtual machine matching fails and the communication is not performed through the shared memory.
[0084] S502, in the case that the result of the address matching is successful, the address information matched with the destination address information in the device information table is taken as the address information of the target virtual machine by the packet filter, and the connection state of the target virtual machine and the shared memory in the device information table is obtained.
[0085] In the embodiment of the present application, further, if the result of the address matching is successful, the eBPF service in the host device can also determine the address information matched successfully, the virtual machine corresponding to the address information is the target virtual machine, and the connection state of the target virtual machine and the shared memory in the device information table is read according to the correspondence between the address information and the number and the connection state in the device information table, and whether the connection state is active is judged.
[0086] S503, determining the result of the virtual machine matching based on the result of the address matching and the connection state of the target virtual machine and the shared memory.
[0087] In the embodiment of the present application, the eBPF service in the host device can perform address matching based on the foregoing steps, and determine the result of the virtual machine matching based on the result of the address matching. For example, as described above, when the result of the address matching is successful and the connection state of the target virtual machine and the shared memory is active, it is considered that the destination address of the data packet to be forwarded is the target virtual machine in the same node and can communicate through the shared memory, and the result of the virtual machine matching is successful, and the data packet to be forwarded is copied and stored in the shared memory.
[0088] Alternatively, when the result of the address matching is successful and the connection state of the target virtual machine and the shared memory is not active, for example, disconnected or unknown, it is considered that the communication between the target virtual machine and the shared memory is abnormal, and at this time, it is determined that the result of the virtual machine matching is failed. Alternatively, when the result of the address matching is failed, the target virtual machine in the device state table cannot be determined, and at this time, it is also determined that the result of the virtual machine matching is failed. In the case that the result of the virtual machine matching is failed, the data packet to be forwarded is no longer separated into the shared memory, but enters the kernel state to copy the data and then forwards based on the process in the following embodiment.
[0089] The embodiment of the present application provides a data transmission method, which matches the address information in the device information table with the destination address information by a packet filter, and determines the connection state of the matched target virtual machine and the shared memory after the matching is successful. In this way, the data packet to be forwarded is stored in the shared memory only when the target virtual machine is connected to the shared memory normally, avoiding the target virtual machine from being unable to normally read after being stored in the shared memory, leading to the loss of the data packet to be forwarded, and improving the accuracy and reliability of data transmission.
[0090] In another embodiment of the present application, for the step S203, the control of the target virtual machine to obtain the data packet to be forwarded through the shared memory can include:
[0091] S601, sending a notification message to the target virtual machine.
[0092] In the embodiment of the present application, the eBPF service in the host device can send a notification message to the target virtual machine after storing the data packet to be forwarded in the shared memory. For example, the notification message can include the address information of the data packet to be forwarded in the shared memory.
[0093] S602, reading the shared memory through the target virtual machine to obtain the data packet to be forwarded in response to the notification message.
[0094] In the embodiment of the present application, after receiving the notification message, the target virtual machine parses the notification message to obtain the address information of the to-be-forwarded data packet in the shared memory, and reads the to-be-forwarded data packet in the shared memory based on the address information.
[0095] It should be understood that, in order to avoid occupying the shared memory, the to-be-forwarded data packet in the shared memory can be deleted after the target virtual machine reads the to-be-forwarded data packet.
[0096] The embodiment of the present application provides a data transmission method. After storing the to-be-forwarded data packet in the shared memory, the target virtual machine sends a notification message to the target virtual machine, so that the target virtual machine reads the to-be-forwarded data packet in the shared memory. In this way, the target virtual machine can correctly and timely obtain the to-be-forwarded data packet in the shared memory, and the timeliness of data transmission is ensured.
[0097] In another embodiment of the present application, in the case where the result of the virtual machine matching is failure, the data transmission method can further include:
[0098] S701, sending the to-be-forwarded data packet to a data processor.
[0099] In the embodiment of the present application, the data processor can be a DPU service. In the case where the result of the virtual machine matching is failure, that is, the to-be-forwarded data packet is not the data forwarded between the virtual machines in the same node, the data processor can be a data packet filter (eBPF service) that sends the to-be-forwarded data packet to the data processor for processing. The data processor can be a service running in the user mode.
[0100] S702, storing the to-be-forwarded data packet in the forwarding memory by the data processor.
[0101] It should be noted that the host device allocates two pieces of direct memory access (DMA) memory for the virtual network card, which are respectively used for cross-node access, that is, the forwarding memory, and same-node access, that is, the shared memory.
[0102] The data processor stores the data in the forwarding memory, further notifies the virtual network card to read the to-be-forwarded data packet in the forwarding memory, and sends the to-be-forwarded data packet to the target virtual machine.
[0103] S703, reading the to-be-forwarded data packet in the forwarding memory by the virtual network card, and sending the to-be-forwarded data packet to the corresponding virtual machine based on the destination address information of the to-be-forwarded data packet.
[0104] It should be further explained that the data processor can extract the destination address information in the to-be-forwarded data packet and notify the virtual network card of the destination address information, or the virtual network card directly obtains the destination address information. As described above, the destination address information can be a virtual machine in the node that is not connected with the shared memory, or can be a virtual machine across nodes, or can be a source node that is a virtual machine across nodes.
[0105] Further, the virtual network card sends the destination address information to the corresponding virtual machine or node based on the obtained destination address information.
[0106] The embodiment of the application provides a data transmission method, when the virtual machine matching fails, the data processor forwards the to-be-forwarded data packet to the target virtual machine through the virtual network card based on the forwarding memory. In this way, it can be ensured that all to-be-forwarded data packets in the host device can be forwarded in time, and the fault tolerance of the method is improved.
[0107] In another embodiment of the application, the data transmission method can further include:
[0108] S801, obtaining filter data traffic forwarded by the packet filter, shared memory data traffic stored by the packet filter to the shared memory, and forwarding memory data traffic forwarded by the data processor.
[0109] In the embodiment of the application, the filter data traffic can refer to the number of to-be-forwarded data packets processed by the packet filter (eBPF service). As known from the foregoing embodiment, the to-be-forwarded data packet is first entered into the kernel mode of the host device and intercepted and parsed by the packet filter, regardless of whether the to-be-forwarded data packet is sent by a virtual machine in the same node or a virtual machine across nodes. Therefore, the filter data traffic represents the traffic of all data packets processed by the host device.
[0110] In the embodiment of the application, the shared memory data traffic can refer to the number of to-be-forwarded data packets stored by the packet filter to the shared memory in the case of successful virtual machine matching, that is, the sum of the number of to-be-forwarded data packets read by all virtual machines in the host device through the shared memory.
[0111] In the embodiment of the application, the forwarding memory data traffic can refer to the number of to-be-forwarded data packets processed by the data processor (DPU service) and forwarded to the target virtual machine through the shared memory in the case of failed virtual machine matching.
[0112] S802, determining whether the data traffic of the host device is normal through the data consistency maintenance process based on the filter data traffic, the shared memory data traffic, and the forwarding memory data traffic.
[0113] As known from the foregoing, the quantity relationship of the three flows should be: the filter data flow is equal to the sum of the shared memory data flow and the forwarding memory data flow.
[0114] In the embodiments of the present application, the data consistency maintenance process is generally run in the user mode, which is used to obtain the three flows and monitor and count the three flows, and based on the quantity relationship, it is ensured that data omission or repeated forwarding does not occur, thereby ensuring the data consistency and stability of the host device.
[0115] It should be noted that the data consistency maintenance process can also be used to obtain other flows of the host device, such as data flow entering the virtual network card, data flow processed and forwarded by the data processor (DPU service), etc., which are not limited here, and further based on these flows, a corresponding quantity relationship is constructed, thereby ensuring the data consistency.
[0116] The embodiments of the present application provide a data transmission method, which monitors and counts the host device through the data consistency maintenance process, ensures that data omission or repeated forwarding does not occur, thereby ensuring the data consistency and stability of the host device.
[0117] In another embodiment of the present application, Figure 3 A component structure schematic diagram of a data transmission device provided by the embodiments of the present application is shown in FIG. 3. Figure 3 As shown in FIG. 3, the data transmission device can include:
[0118] The analysis module 3001 is configured to, in response to a to-be-forwarded data packet entering the kernel of the host device, intercept and analyze the to-be-forwarded data packet through the data packet filter, and determine the destination address information of the to-be-forwarded data packet.
[0119] The determination module 3002 is configured to perform virtual machine matching on the destination address information and the device information table through the data packet filter, and determine the result of the virtual machine matching.
[0120] The storage module 3003 is configured to, in the case that the result of the virtual machine matching is successful, determine the target virtual machine in the host device through the data packet filter, store the to-be-forwarded data packet to the shared memory, and control the target virtual machine to obtain the to-be-forwarded data packet through the shared memory.
[0121] In some embodiments, the determination module 3002 is further configured to, for at least one virtual machine in the host device, obtain the connection state of each virtual machine and the shared memory; assign a number and address information to each virtual machine; and based on the connection state of each virtual machine and the shared memory, the corresponding number and the corresponding address information, construct the device information table.
[0122] In some embodiments, the determining module 3002 is further configured to send a state query packet to each virtual machine, determine the connection state of each virtual machine with the shared memory based on the reply of each virtual machine to the state query packet, and update the device information table based on the connection state of each virtual machine with the shared memory.
[0123] In some embodiments, the determining module 3002 is further configured to perform address matching between the address information in the device information table and the destination address information through the packet filter, determine the result of the address matching, in the case that the result of the address matching is successful, take the address information in the device information table that matches the destination address information as the address information of the target virtual machine through the packet filter, and obtain the connection state of the target virtual machine with the shared memory in the device information table, and determine the result of the virtual machine matching through the packet filter based on the result of the address matching and the connection state of the target virtual machine with the shared memory.
[0124] In some embodiments, the storage module 3003 is further configured to send a notification packet to the target virtual machine, and read the shared memory through the target virtual machine to obtain the data packet to be forwarded in response to the notification packet.
[0125] In some embodiments, the storage module 3003 is further configured to send the data packet to be forwarded to the data processor, store the data packet to be forwarded to the forwarding memory through the data processor, read the data packet to be forwarded in the forwarding memory through the virtual network card, and send the data packet to be forwarded to the corresponding virtual machine based on the destination address information of the data packet to be forwarded.
[0126] In some embodiments, the determining module 3002 is further configured to obtain the filter data flow forwarded by the packet filter, the shared memory data flow stored by the packet filter to the shared memory, and the forwarding memory data flow forwarded by the data processor, and determine whether the data flow of the host device is normal through the data consistency maintenance process based on the filter data flow, the shared memory data flow, and the forwarding memory data flow.
[0127] In another embodiment of the present application, Figure 4 The composition structure of a host device in an embodiment of the present application is shown in Figure 1 FIG. 4. As shown in Figure 4 FIG. 4, the host device 40 includes at least one virtual machine, a packet filter 402, and a shared memory 403; wherein:
[0128] The data packet filter 402 is configured to, in response to a to-be-forwarded data packet entering a kernel of the host device 40, intercept and parse the to-be-forwarded data packet, determine destination address information of the to-be-forwarded data packet, perform virtual machine matching on the destination address information and the device information table, determine a result of the virtual machine matching, and in a case where the result of the virtual machine matching is successful, determine a target virtual machine in the host device 40 and store the to-be-forwarded data packet in the shared memory 403.
[0129] The virtual machine is configured to read the shared memory to obtain the to-be-forwarded data packet.
[0130] As shown in FIG. 4, the host device 40 includes at least one virtual machine, for example, a first virtual machine 4011, a second virtual machine 4012, and an Nth virtual machine 4013. All the virtual machines are connected with the data packet filter 402 and the shared memory 403, and N is a positive integer greater than or equal to 1. Figure 4
[0131] As described above, the shared memory 403 is the fastest in a plurality of process communication modes, and data communication through the shared memory 403 can achieve a significant speedup effect. When the plurality of virtual machines based on the DPU communicate, the transmission mode is relatively complex, which relies on the DPU virtual network card of the host and the related processing in the kernel mode. Data transmission through the shared memory can significantly improve the IO access rate. Moreover, the data packet filter needs to copy data through the virtual machine kernel and does not need to pass through a complex DPU virtual IO path, thereby reducing the resource occupation of the virtual machine to the host and improving the transmission rate.
[0132] In this way, in the embodiment of the present application, the shared memory is allocated for the virtual network card on the host device, and a separate traffic management process is deployed on the host device. The service manages all virtual machines and vDPA devices of the node. The service internally uses a data packet filter based on the eBPF technology to filter data streams and separate the same-node data. The same-node data no longer passes through the DPU virtual IO path, but directly communicates through the shared memory on the host to achieve the effect of accelerating the communication rate of the same-node virtual machine.
[0133] In some embodiments, Figure 5 A composition structure of a host device provided in the embodiment of the present application is shown in FIG. 4. Figure 2 As shown in FIG. 4, the host device further includes a data processor 404, a forwarding memory 405, and a virtual network card 406. Wherein: Figure 5 The data processor 404 is configured to, in a case where the result of the virtual machine matching is failed, receive and store the to-be-forwarded data packet in the forwarding memory.
[0134] The data processor 404 is configured to, in a case where the result of the virtual machine matching is failed, receive and store the to-be-forwarded data packet in the forwarding memory.
[0135] Virtual network adapter 406 is used to read the data packets to be forwarded from the forwarding memory 405 and send the data packets to be forwarded to the corresponding virtual machine based on the destination address information of the data packets to be forwarded.
[0136] The forwarding memory 405 is connected to the data processor 404 and the virtual network card 406 respectively, and the virtual network card 406 is connected to at least one virtual machine respectively.
[0137] It should also be noted that the host device 40 can be used to execute any of the methods provided in the above embodiments, and both belong to the same inventive concept. Therefore, the host device 40 may also include any other possible elements, units or devices to execute any step in the above methods, so that the host device 40 can achieve the corresponding function.
[0138] This application provides a host device that effectively improves upon existing technologies where data copying in kernel mode results in high memory consumption and slow data communication. Furthermore, by separating data packets on the virtual network interface card and monitoring their movement, it effectively improves the data transmission rate between virtual machines on the same node while ensuring data consistency.
[0139] In yet another embodiment of this application, Figure 6 This is a schematic diagram illustrating the structural composition of a data transmission system provided in an embodiment of this application. Figure 6 As shown, the data transmission system 50 includes at least one host device as described in the foregoing embodiments; wherein: the host device is used to perform the method as described in the foregoing embodiments.
[0140] like Figure 6 As shown, in at least one host device, each host device is communicatively connected to the remaining host devices. For example, the first host device 501 is communicatively connected to the second host device 502 through the Mth host devices 503. Here, M is a positive integer greater than or equal to 1.
[0141] In this embodiment, the host device deploys a management service on the host machine and uses eBPF technology to separate kernel-mode data, filtering out data transmitted between virtual machines within the same host machine. Shared memory is allocated to the virtual network interface card (NIC), and virtual machines on the same node no longer communicate through the DPU virtual I / O path but directly through shared memory. This changes the communication method of virtual machines on the same node, accelerates the communication rate, and does not interfere with cross-node virtual machine communication, thereby effectively improving the I / O access rate of virtual machines on the same node and also improving the overall network communication rate of the system.
[0142] The embodiment of the present application provides a data transmission system, in which the communication of virtual machines in the same node no longer passes through a DPU virtual IO path, but performs IO access in a shared memory mode. The system allocates two pieces of DMA memory for each virtual network card in a host device, which are respectively used for cross-node access and same-node access, wherein the memory for same-node access is shared memory. A host deployment management process is arranged to filter out same-node data and directly transmit the same-node data via the shared memory, so as to improve the IO access rate of the same node.
[0143] In another embodiment of the present application, Figure 7 An execution flow diagram of a data transmission system provided by the embodiment of the present application is shown in FIG. 1. Figure 7 As shown in FIG. 1, in order to improve the communication rate of virtual machines in the same node, an IO path management process and a DPU flow monitoring device are designed, and the details are as follows:
[0144] First, the host IO path management process. In order to manage the DPU virtual machines in the same node and ensure that they can communicate through the shared memory, an IO path management process on the host is designed to manage the connection of all DPU virtual machines in the node with the shared memory, and to separate the data flow of the node, so that the data flow no longer passes through the DPU virtual IO path, but directly communicates through the shared memory. The flow management process has the following mechanisms inside:
[0145] (1) Device Info marking mechanism. When a virtual machine successfully connects the shared memory, device information (Device Info) is allocated to the virtual machine, including ID, IP and Status information. Each Device Info exists only in one host. The host records the device information table (Info list) inside to record and maintain the virtual machines that need to communicate through the shared memory. After the host opens the shared memory for the virtual network card, each virtual machine connecting the shared memory needs to notify the host, at this time, the host records the device information of the virtual machine, which means that the virtual machine has connected the shared memory, and in the subsequent process, if a virtual machine needs to communicate through the shared memory, only a virtual machine is selected from the list for data transmission.
[0146] The host records the device information and also monitors their status, which specifically refers to whether the virtual machine can normally read and write the shared memory. The host records a status value according to the connection of each host device with the shared memory, and the recording logic is as follows:
[0147] For the virtual machine normally connecting the shared memory, the host records the Device Info and sets the status as active;
[0148] For the disconnected virtual machine (usually the virtual machine itself initiates, disassociates with the shared memory), the host marks its state as inactive;
[0149] When the memory resource is insufficient, the virtual machine is unexpectedly closed, and the host cannot receive the connection shared memory state feedback from the virtual machine within the timeout time, the host marks its state as unknown.
[0150] (2) Communication retrieval mechanism. Based on the Device Info marking mechanism described above, the corresponding address of the virtual machine and the state of the connection shared memory can be found. The communication retrieval algorithm of the present application is as follows:
[0151] Traverse the Device Info list, such as the information in Table 1 above, match the destination address information (destIP, DIP) in the data packet with the address information (Device IP) in the list. If it cannot be matched, it is considered that the data packet is sent to the virtual machine across the node, and it does not communicate through the shared memory.
[0152] After matching the IP, judge whether the shared memory connection state corresponding to the IP is active
[0153] If the state is active, it is considered that the target address of this data packet is the virtual machine on the same node, and it can communicate through the shared memory, and the data packet will be copied to the shared memory;
[0154] If the state is not active, it is considered that the communication between the node and the shared memory is not normal, at this time the data packet is not separated into the shared memory, but according to the previous process, the data is copied into the kernel mode, and then forwarded.
[0155] (3) eBPF data packet separation mechanism. As Figure 7 shown, in order to reduce the data copy in the kernel mode, the present application designs an eBPF data packet separation mechanism. Figure 7 In the data transmission system 50, the first host device 501 and the second host device 502 are included, and the first host device includes the shared memory 403, the first virtual machine 4011 and the second virtual machine 4012 connected with the shared memory 403, the data packet filter 402 connected with the shared memory 403, and the data processor 404 connected with the data packet filter 402; the second host device 502 includes the third virtual machine 4014 and the fourth virtual machine 4015 as an example. It should be understood that Figure 7 the internal structures of the first host device 501 and the second host device 502 are simplified, and the complete internal structure can be referred to in the foregoing embodiments Figure 5 .
[0156] When the data packet enters the host kernel, it is intercepted and parsed by the packet filter 402 (eBPF service), and the IP is matched based on the communication retrieval algorithm in the above, if the data packet destination address DIP corresponds to the virtual machine in the current host, then the data is put into the shared memory 403, and read by one of the target virtual machines, i.e. the first virtual machine 4011 and the second virtual machine 4012; if DIP is not in the current host, then enter the original process, copy and forward the data by the kernel, and then enter the user state, enter the data processor (DPU) 404 for processing and forwarding, and forward to the third virtual machine 4014 or the fourth virtual machine 4015. The specific algorithm process is as follows:
[0157] When the data enters the host, the packet filter 402 judges whether the data packet is the same node data, if it is the same node data, then according to the communication retrieval algorithm, the information in the Device Info list is traversed, and the DIP in the data packet is matched with the Device IP in the list in turn.
[0158] If a matching IP is successfully found, the data is stored in the shared memory 403. The target virtual machine can read the data in the shared memory 403 to complete the communication.
[0159] If the matching fails, it may be a cross-node virtual machine, or the virtual machine in the same node does not normally connect the shared memory 403. At this time, the data packet filter 402 does not need to separate the data packet according to the normal data processor 404 virtual IO path transmission.
[0160] The cross-border data is forwarded to other external nodes after being processed by the data processor 404.
[0161] Secondly, the application also sets a data consistency maintenance process as a monitoring device, which respectively monitors and statistics the data flow entering the virtual network card, the data flow forwarded on the shared memory, the data flow passing through the DPU virtual IO path, the filter data flow forwarded by the packet filter, the shared memory data flow forwarded by the shared memory, and the forwarding memory data flow forwarded by the data processor, etc., to ensure that data omission or data repeated forwarding does not occur, and to ensure that the DPU IO path can still operate normally in the case of abnormality of the shared memory, and the entire network link will not be interrupted, thereby ensuring the data consistency and stability in the entire system.
[0162] The application provides a data transmission system, wherein a host device comprises an IO path management process, which can separate same-node data through an eBPF technology and establish a shared memory communication channel of a same-node DPU virtual machine, so that same-node traffic does not need to pass through a DPU virtual IO path, and the communication mode is simplified. Inside the management process, a device information table marking mechanism and a communication retrieval mechanism are used to manage a local virtual machine and shared memory; through an eBPF packet separation mechanism, same-node data traffic is filtered out, and the data traffic is directly communicated through the shared memory without passing through a DPU. The host device further comprises a data consistency maintenance process, and through the traffic monitoring device, total data traffic on a virtual network card, data traffic entering the shared memory and data traffic passing through the DPU virtual IO path can be monitored.
[0163] It can be understood that, in the embodiment, the "unit" can be a partial circuit, a partial processor, a partial program or software, etc., and of course can be a module, and can also be non-modular. Moreover, the components in the embodiment can be integrated in a processing unit, or can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function module.
[0164] When the integrated unit is realized in the form of a software function module and is not sold or used as an independent product, the integrated unit can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiment can be embodied in the form of a software product, the computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in the embodiment. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.
[0165] Therefore, the embodiment provides a computer readable storage medium, which stores a computer program. When the computer program is executed by at least one processor, the steps of the method described in any one of the foregoing embodiments are implemented.
[0166] The above merely describes preferred embodiments of the present application, but should not be used to limit the protection scope of the present application, and any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
[0167] The embodiment of the present application further provides a computer program product containing instructions, including a computer program or instructions, which, when executed by a processor, implement the steps in the method provided by the above method embodiment.
[0168] It should be understood that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details of the present application that are not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0169] It should be understood that the "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" or "in some embodiments" appearing throughout the specification does not necessarily mean the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above processes does not mean the execution order, and the execution order of the processes should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The sequence number of the above embodiments of the present application is only for description, not representing the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between each embodiment, and the same or similar parts can be referred to each other, and for the sake of brevity, the description is not repeated here.
[0170] It should also be noted that in the present application, the terms "comprising", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus including a series of elements includes not only those elements, but also other elements not explicitly listed, or further includes elements inherent to such a process, method, article or apparatus. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article or apparatus including the element.
[0171] The sequence number of the above embodiments of the present application is only for description, not representing the advantages and disadvantages of the embodiments.
[0172] The methods disclosed in the several method embodiments of the present application can be combined arbitrarily without conflict, to obtain new method embodiments.
[0173] The features disclosed in several product embodiments provided by the present application can be arbitrarily combined, without conflict, to obtain new product embodiments.
[0174] The features disclosed in several method or device embodiments provided by the present application can be arbitrarily combined, without conflict, to obtain new method embodiments or device embodiments.
[0175] The above description is merely illustrative of the application, and the scope of the application is not limited thereto. Any modifications, equivalent replacements, and improvements made by those skilled in the art within the technical scope of the present application should be included in the scope of the present application. Therefore, the scope of the present application should be determined by the scope of the claims.
[0176] The above description is merely illustrative of the application, and the scope of the application is not limited thereto. Any modifications, equivalent replacements, and improvements made by those skilled in the art within the technical scope of the present application should be included in the scope of the present application. Therefore, the scope of the present application should be determined by the scope of the claims.
Claims
1. A data transmission method, characterized by, The data transmission method comprises: In response to a to-be-forwarded data packet entering a kernel of a host device, the to-be-forwarded data packet is intercepted and parsed by a packet filter, and destination address information of the to-be-forwarded data packet is determined; The packet filter is used to perform virtual machine matching on the destination address information and a device information table, and a result of the virtual machine matching is determined; In a case where the result of the virtual machine matching is successful, the packet filter is used to determine a target virtual machine in the host device, the to-be-forwarded data packet is stored in a shared memory, and the target virtual machine is controlled to acquire the to-be-forwarded data packet from the shared memory; The data transmission method further comprises: Filter data traffic forwarded by the packet filter, shared memory data traffic stored in the shared memory by the packet filter, and forwarding memory data traffic forwarded by a data processor are acquired; Based on the filter data traffic, the shared memory data traffic, and the forwarding memory data traffic, a data consistency maintenance process is used to determine whether data traffic of the host device is normal.
2. The data transmission method of claim 1, wherein, Before the packet filter is used to perform virtual machine matching on the destination address information and the device information table, the data transmission method further comprises: For at least one virtual machine in the host device, a connection state of each virtual machine with the shared memory is acquired; Each virtual machine is assigned a number and address information; Based on the connection state of each virtual machine with the shared memory, the corresponding number, and the corresponding address information, the device information table is constructed.
3. The data transmission method of claim 2, wherein, The acquisition of the connection state of each virtual machine with the shared memory comprises: A state query packet is sent to each virtual machine; Based on a packet reply of each virtual machine, the connection state of each virtual machine with the shared memory is determined; The data transmission method further comprises: Based on the connection state of each virtual machine with the shared memory, the device information table is updated.
4. The data transmission method of claim 1, wherein, The packet filter is used to perform virtual machine matching on the destination address information and the device information table, and the result of the virtual machine matching is determined, which comprises: The packet filter is used to perform address matching on the address information in the device information table and the destination address information in sequence, and a result of the address matching is determined; In a case where the result of the address matching is successful, the packet filter is used to take address information in the device information table that matches the destination address information as address information of the target virtual machine, and acquire a connection state of the target virtual machine with the shared memory in the device information table; Based on the result of the address matching and the connection state of the target virtual machine with the shared memory, the packet filter is used to determine the result of the virtual machine matching.
5. The data transmission method of claim 1, wherein, The control of the target virtual machine to acquire the to-be-forwarded data packet from the shared memory comprises: A notification packet is sent to the target virtual machine; In response to the notification packet, the target virtual machine is used to read the shared memory, and the to-be-forwarded data packet is acquired.
6. The data transmission method of any of claims 1 to 5, wherein, In a case where the result of the virtual machine matching is failure, the data transmission method further comprises: sending the to-be-forwarded data packet to a data processor; storing the to-be-forwarded data packet in a forwarding memory by the data processor; reading the to-be-forwarded data packet in the forwarding memory by a virtual network card, and sending the to-be-forwarded data packet to a corresponding virtual machine based on destination address information of the to-be-forwarded data packet.
7. A data transmission apparatus, characterized by comprising: The data transmission apparatus comprises: a parsing module configured to, in response to a to-be-forwarded data packet entering a kernel of a host device, intercept and parse the to-be-forwarded data packet by a packet filter, and determine destination address information of the to-be-forwarded data packet; a determining module configured to determine a result of virtual machine matching by the packet filter by matching the destination address information with a device information table; a storing module configured to, in a case where the result of the virtual machine matching is success, determine a target virtual machine in the host device by the packet filter, store the to-be-forwarded data packet in a shared memory, and control the target virtual machine to acquire the to-be-forwarded data packet from the shared memory; the determining module is further configured to acquire filter data traffic forwarded by the packet filter, shared memory data traffic stored in the shared memory by the packet filter, and forwarding memory data traffic forwarded by a data processor; and determine whether data traffic of the host device is normal by a data consistency maintenance process based on the filter data traffic, the shared memory data traffic, and the forwarding memory data traffic.
8. A host device, comprising: The host device comprises at least one virtual machine, a packet filter, and a shared memory; wherein: the packet filter is configured to, in response to a to-be-forwarded data packet entering a kernel of a host device, intercept and parse the to-be-forwarded data packet, determine destination address information of the to-be-forwarded data packet, match the destination address information with a device information table to determine a result of virtual machine matching, and in a case where the result of the virtual machine matching is success, determine a target virtual machine in the host device and store the to-be-forwarded data packet in the shared memory; the virtual machine is configured to acquire the to-be-forwarded data packet from the shared memory; the host device is configured to acquire filter data traffic forwarded by the packet filter, shared memory data traffic stored in the shared memory by the packet filter, and forwarding memory data traffic forwarded by a data processor; and determine whether data traffic of the host device is normal by a data consistency maintenance process based on the filter data traffic, the shared memory data traffic, and the forwarding memory data traffic.
9. The host device of claim 8, wherein, The host device further comprises a data processor, a forwarding memory, and a virtual network card; wherein: the data processor is configured to, in a case where the result of the virtual machine matching is failure, receive and store the to-be-forwarded data packet in the forwarding memory; The virtual network card is configured to read the to-be-forwarded data packet in the forwarding memory and send the to-be-forwarded data packet to a corresponding virtual machine based on destination address information of the to-be-forwarded data packet.
10. A data transmission system, characterized by The data transmission system comprises at least one host device as claimed in claim 8 or 9; wherein: The host device is configured to perform the data transmission method as claimed in any one of claims 1 to 6.
11. A computer readable storage medium having stored thereon a computer program, characterized in that The computer program, when executed by a processor, implements the data transmission method as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Virtual machine data transmission method and device based on eBPF, equipment and storage medium
CN115589383A
Signaling processing method, system and device and storage medium
CN118301562A