CN-122001832-A - Message transmission method, device, equipment, storage medium and product
Abstract
The application provides a message transmission method, a device, equipment, a storage medium and a product, wherein the method comprises the steps of obtaining a first descriptor of a target message, wherein the target message is a message sent to a second virtual machine by a first virtual machine, obtaining a first memory cache by converting the first descriptor, determining whether the first virtual machine and the second virtual machine are in the same computing node, transmitting the second descriptor of the target message to the second virtual machine based on the first memory cache when the computing node is the same, wherein the second descriptor is used for indicating the second virtual machine to copy the target message from the first virtual machine, or transmitting a third descriptor of the target message to a first physical network card based on the first memory cache, a tunnel header and a message header in the target message when the computing node is not the same, and the third descriptor is used for indicating a first physical network card to copy a data load in the target message from the first virtual machine.
Inventors
- Liao Caiqiang
- YANG LEYUAN
- ZHAO XINXIN
Assignees
- 中移(苏州)软件技术有限公司
- 中国移动通信集团有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260120
Claims (10)
- 1. A method for transmitting a message, the method comprising: Acquiring a first descriptor of a target message, wherein the target message is a message sent to a second virtual machine by a first virtual machine; Obtaining a first memory cache by converting the first descriptor; determining whether the first virtual machine and the second virtual machine are at the same computing node; and transmitting a third descriptor of the target message to a first physical network card based on the first memory cache, a tunnel header and a message header in the target message when the second virtual machine is not in the same computing node, wherein the third descriptor is used for indicating the first physical network card to copy a data load in the target message from the first virtual machine, so as to send the target message to the second virtual machine based on the data load and the message header.
- 2. The method of claim 1, wherein the obtaining the first descriptor of the target message comprises: And after the first descriptor is filled into the virtual queue of the first virtual machine through the first virtualization input/output front end driver, the first descriptor is acquired from the virtual queue of the first virtual machine through the first virtualization input/output rear end driver.
- 3. The method of claim 1, wherein the obtaining the first memory cache by converting the first descriptor comprises: acquiring unloading information, a client physical address and a length of the target message based on the first descriptor; mapping the client physical address to an input-output virtual address; And obtaining the first memory cache based on the offloading information, the input-output virtual address and the length.
- 4. The method of claim 1, wherein determining whether the first virtual machine and the second virtual machine are at the same compute node comprises determining whether the first virtual machine and the second virtual machine are at the same compute node through a flow table lookup operation based on the first memory cache.
- 5. The method of any of claims 1 to 4, wherein the transmitting the second descriptor of the target message to the second virtual machine based on the first memory cache comprises: Filling the second descriptor into a virtual queue of the second virtual machine based on the first memory cache through a second virtualized input-output back end driver, so that the second virtual machine obtains the second descriptor through a second virtualized input-output front end driver, and copying the target message from the first virtual machine based on the obtained second descriptor.
- 6. The method according to any one of claims 1 to 4, wherein the transmitting the third descriptor of the target message to the first physical network card based on the first memory buffer, the tunnel header, and the header in the target message comprises: The tunnel header and the message header are added to the first memory cache, so that a second memory cache is obtained; And filling the third descriptor into a network card queue of the first physical network card based on the second memory buffer through polling mode driving, so that the first physical network card obtains the message header and the data load from the first virtual machine through direct memory access operation based on the third descriptor, and sends the target message to the second virtual machine based on the data load and the message header.
- 7. A message transmission apparatus, the apparatus comprising: The system comprises an acquisition unit, a first processing unit and a second processing unit, wherein the acquisition unit is used for acquiring a first descriptor of a target message, wherein the target message is a message sent to a second virtual machine by a first virtual machine; an obtaining unit, configured to obtain a first memory cache by converting the first descriptor; A determining unit, configured to determine whether the first virtual machine and the second virtual machine run on the same computing node; And the transmission unit is used for transmitting a second descriptor of the target message to the second virtual machine based on the first memory cache when the second virtual machine runs on the same computing node, wherein the second descriptor is used for indicating the second virtual machine to copy the target message from the first virtual machine, or transmitting a third descriptor of the target message to a first physical network card based on the first memory cache, a tunnel header and a message header in the target message when the second virtual machine does not run on the same computing node, wherein the third descriptor is used for indicating the first physical network card to copy a data load in the target message from the first virtual machine, so as to send the target message to the second virtual machine based on the data load and the message header.
- 8. An electronic device, the electronic device comprising: A memory for storing computer executable instructions or computer programs; a processor for implementing the method according to any one of claims 1 to 6 when executing computer-executable instructions or computer programs stored in the memory.
- 9. A computer readable storage medium storing a computer program or computer executable instructions which, when executed by a processor, implement the method of any one of claims 1 to 6.
- 10. A computer program product comprising a computer program or computer-executable instructions which, when executed by a processor, implement the method of any one of claims 1 to 6.
Description
Message transmission method, device, equipment, storage medium and product Technical Field The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a product for transmitting a message. Background The Virtual Switch (vSwitch) is mainly responsible for a Virtual Machine (VM) network data forwarding plane, and assumes a message forwarding function of a computing node where the Virtual Machine is located, and connects communications between the Virtual machines and between the Virtual Machine and a physical host. Currently, a virtual switch is generally implemented by an Open Virtual Switch (OVS) based on a data plane Development Kit (DATA PLANE Development Kit, DPDK), and although the OVS accelerated by the DPDK directly bypasses a data path in a kernel mode, the message processing speed of a physical network card and a virtual network port (such as vhostuser network card) can be accelerated to a certain extent. However, a large number of message copying operations still exist, so that not only a large amount of computing power of a central processing unit (Central Processing Unit, CPU) is consumed, but also the consumption of a memory is increased along with the application release of a large amount of memory space, the forwarding delay of a message is increased, the instantaneity of network data is influenced, the network bandwidth is reduced, and the packet rate of a packet is reduced. Disclosure of Invention The embodiment of the application provides a message transmission method, a device, equipment, a storage medium and a product, which can improve network performance. The technical scheme of the embodiment of the application is realized as follows: the embodiment of the application provides a message transmission method, which comprises the following steps: Acquiring a first descriptor of a target message, wherein the target message is a message sent to a second virtual machine by a first virtual machine; Obtaining a first memory cache by converting the first descriptor; determining whether the first virtual machine and the second virtual machine are at the same computing node; and transmitting a third descriptor of the target message to a first physical network card based on the first memory cache, a tunnel header and a message header in the target message when the second virtual machine is not in the same computing node, wherein the third descriptor is used for indicating the first physical network card to copy a data load in the target message from the first virtual machine, so as to send the target message to the second virtual machine based on the data load and the message header. In some exemplary embodiments, the obtaining the first descriptor of the target message includes: And after the first descriptor is filled into the virtual queue of the first virtual machine through the first virtualization input/output front end driver, the first descriptor is acquired from the virtual queue of the first virtual machine through the first virtualization input/output rear end driver. In some exemplary embodiments, the obtaining the first memory cache by converting the first descriptor includes: acquiring unloading information, a client physical address and a length of the target message based on the first descriptor; mapping the client physical address to an input-output virtual address; And obtaining the first memory cache based on the offloading information, the input-output virtual address and the length. In some example embodiments, the determining whether the first virtual machine and the second virtual machine are at the same computing node comprises: and based on the first memory cache, determining whether the first virtual machine and the second virtual machine are in the same computing node through a flow table query operation. In some exemplary embodiments, the transmitting, based on the first memory cache, the second descriptor of the target message to the second virtual machine includes: Filling the second descriptor into a virtual queue of the second virtual machine based on the first memory cache through a second virtualized input-output back end driver, so that the second virtual machine obtains the second descriptor through a second virtualized input-output front end driver, and copying the target message from the first virtual machine based on the obtained second descriptor. In some exemplary embodiments, the transmitting, to the first physical network card, the third descriptor of the target packet based on the first memory buffer, the tunnel header, and the header in the target packet includes: The tunnel header and the message header are added to the first memory cache, so that a second memory cache is obtained; And filling the third descriptor into a network card queue of the first physical network card based on the second memory buffer through polling mode driving, so that the first physical n