Network communication control method and device, computer equipment and storage medium
By combining RDMA technology and dynamic link aggregation, dynamic aggregation and link negotiation of virtual devices are achieved, which solves the problems of high latency and lack of dynamicity in traditional network communications, and provides high-performance, low-latency and reliable network communications plan.
Patent Information
- Application Number
- CN202411034292.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-26
AI Technical Summary
Traditional TCP/IP network communication is high in high-performance computing services, and a single network link is difficult to meet the needs of high bandwidth and reliability. Traditional link aggregation technology lacks dynamics and fault recovery capabilities and cannot adapt to the network environment. and rapid changes in business needs.
Combining the direct memory access advantages of RDMA technology and the flexibility of dynamic link aggregation, virtual equipment is created by binding virtual function modules through software, realizing dynamic aggregation of virtual equipment, and establishing an aggregation link with the switch through the link aggregation control protocol. , reduce costs and improve system scalability and flexibility.
It realizes high-performance and low-latency network communication, providing high-performance, reliable and flexible network communication solutions for applications such as data centers, cloud computing and high-performance computing.
Smart Images

Figure CN119030825A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a network communication control method, device, computer equipment and storage medium. Background Art
[0002] At present, with the continuous development of applications such as data centers, cloud computing, and high-performance computing (HPC), the performance and reliability requirements of network communications are getting higher and higher. Traditional TCP / IP network communications are gradually unable to meet the needs of these high-performance computing services, mainly because the latency and CPU load caused by TCP / IP protocol stack processing remain high. In order to solve these problems, RDMA (Remote Direct Memory Access) technology came into being. It uses direct memory access to achieve direct transmission of data buffers between two nodes during network transmission, greatly improving the efficiency of data transmission and reducing latency.
[0003] However, a single network link cannot meet the bandwidth and reliability requirements of high-performance applications. Therefore, link aggregation technology was introduced to combine multiple physical links into one logical link to achieve bandwidth superposition and reliability improvement. However, traditional link aggregation technology lacks dynamicity and fault recovery capabilities, and cannot adapt to the rapid changes in network environment and business needs. Summary of the invention
[0004] Based on this, it is necessary to provide a network communication control method, device, computer equipment and storage medium to address the above technical problems, which combines the direct memory access advantages of remote direct memory access technology and the flexibility and reliability of dynamic link aggregation to provide more efficient and reliable network communication services.
[0005] In one aspect, a network communication control method is provided, the method comprising:
[0006] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0007] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0008] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0009] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0010] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0011] In one embodiment, the step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices includes:
[0012] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0013] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0014] In one embodiment, each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including:
[0015] Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0016] Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0017] If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0018] If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0019] In one embodiment, in response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the alternative group until all virtual devices in the active group are normal includes:
[0020] Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group;
[0021] If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group;
[0022] The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
[0023] In one embodiment, the network communication control method further includes:
[0024] When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing;
[0025] Setting the main thread to be responsible for allocating communication tasks and executing communication tasks;
[0026] The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
[0027] In one embodiment, the network communication control method further includes:
[0028] When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time;
[0029] If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group;
[0030] Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group;
[0031] When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group;
[0032] When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
[0033] In one embodiment, the network communication control method further includes:
[0034] When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails;
[0035] When a virtual device in the active group fails to send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails;
[0036] In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails;
[0037] Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly;
[0038] If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group;
[0039] If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working;
[0040] The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
[0041] In another aspect, a network communication control device is provided, the device comprising:
[0042] Constructing a virtual device module for binding a preset number of Ethernet virtual function modules to kernel state drivers to obtain multiple virtual devices;
[0043] A virtual device grouping module, configured to select a first number of virtual devices to be pre-selected into an active group, and select a second number of virtual devices to be pre-selected into a candidate group;
[0044] Constructing a protocol data unit module, used to obtain a physical function module associated with the Ethernet virtual function module, obtain information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0045] A virtual device status judgment module, used for each of the virtual devices to send the link aggregation control protocol data unit to the switch through the physical network card, and detect whether a normal receipt is received. If so, the virtual device is judged to be normal, otherwise, the virtual device is judged to be abnormal;
[0046] The active group management module is used to replace the abnormal virtual device in the active group with a normal virtual device in the alternative group in response to the presence of an abnormal virtual device in the active group, until all virtual devices in the active group are normal, and the active group is used for data transmission.
[0047] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0048] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0049] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0050] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0051] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0052] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0053] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0054] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0055] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0056] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0057] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0058] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0059] The above-mentioned network communication control method, device, computer equipment and storage medium create virtual devices by binding virtual functions through software, realize dynamic aggregation of virtual devices, and negotiate with switches to establish aggregated links through link aggregation control protocols. By realizing virtual devices at the software level, costs are reduced and the scalability and flexibility of the system are improved. On the basis of the aggregated link, the RDMA driver is loaded for the network card virtual function to realize remote direct memory access and improve data transmission efficiency. Through the combination of dynamic link aggregation and RDMA technology, high-performance and low-latency network communication is achieved, providing a high-performance, reliable and flexible network communication solution for applications such as data centers, cloud computing and high-performance computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0061] Figure 1 This is an application environment diagram of a network communication control method in one embodiment of the present application;
[0062] Figure 2 A data interaction method of a network communication control method in an RDMA scenario in an embodiment of the present application;
[0063] Figure 3 A flowchart of a network communication control method in one embodiment of the present application;
[0064] Figure 4 In one embodiment of the present application, a preset number of Ethernet virtual function modules are bound to kernel state drivers to obtain a schematic diagram of the virtual device steps;
[0065] Figure 5 A flowchart showing the steps of each of the virtual devices sending the link aggregation control protocol data unit to the switch through the physical network card in one embodiment of the present application, detecting whether a normal receipt is received, and if so, determining that the virtual device is normal, and if not, determining that the virtual device is abnormal;
[0066] Figure 6 A flowchart of the steps of replacing the abnormal virtual device in the active group with a normal virtual device in the alternative group in response to an abnormal virtual device in the active group in an embodiment of the present application until all virtual devices in the active group are normal;
[0067] Figure 7 A schematic diagram of allocating links on each virtual device of an active group to three threads for processing in one embodiment of the present application;
[0068] Figure 8 This is a structural block diagram of a network communication control device in one embodiment of the present application;
[0069] Fig. 9 This is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0071] As described in the background technology, RDMA is a remote direct memory access technology that allows user programs to bypass the operating system kernel and directly interact with the network card for network communication. The main features of RDMA include: No CPU intervention required: The application can directly access the remote host memory without consuming any CPU resources in the remote host, reducing the delay and CPU occupancy during data transmission. High bandwidth and low latency: RDMA bypasses the protocol stack provided by the operating system and directly transmits data under the network transport layer, so it has higher bandwidth utilization and lower latency. Support for zero copy and kernel bypass: RDMA avoids unnecessary data copying and context switching, further improving the efficiency of data transmission.
[0072] Link aggregation is a technology that combines multiple physical links into one logical link, aiming to improve network bandwidth and reliability. Traditional link aggregation technologies mainly include static link aggregation and dynamic link aggregation. Static link aggregation: The physical links participating in the aggregation are pre-specified during configuration. Once the configuration is completed, these links will always transmit data as a whole. However, static link aggregation lacks flexibility and cannot adapt to the rapid changes in network environment and business needs. Dynamic link aggregation: Dynamically adjust the physical links participating in the aggregation according to network load and link quality. When a link fails or the load is too high, network operation and maintenance personnel can manually remove it from the aggregation group and add a new link to the aggregation group. Dynamic link aggregation has higher flexibility and reliability, but it is relatively complex to implement and maintain.
[0073] To solve the above problems, an embodiment of the present invention creatively proposes a network communication control method, which combines the direct memory access advantages of RDMA technology and the flexibility and reliability of dynamic link aggregation to provide more efficient and reliable network communication services.
[0074] The network communication control method provided by the present application optimizes the management of dynamic link aggregation and implements a fault recovery mechanism by using RDMA technology. Dynamic link aggregation is a network communication technology that bundles multiple physical links together through automatic negotiation and protocols to increase bandwidth, improve reliability and load balancing. Automatic negotiation and protocols such as LACP, Link Aggregation Control Protocol, are used to achieve dynamic aggregation of Ethernet links, also known as link aggregation or link bundling, which allows two or more physical ports to be combined into a logical link, also known as an aggregated link or a bundled link, thereby providing higher bandwidth and redundancy.
[0075] Traditionally, the implementation of dynamic link aggregation relies on complex mechanisms in the hardware protocol stack, including link aggregation control protocol data unit mechanism, bonding state maintenance mechanism, and FIFO pipe switching mechanism, etc. The present invention proposes a network communication control method, which implements a link aggregation and fault disaster recovery mode at the physical server operating system level through software to reduce costs and improve the sustainability of the system.
[0076] The network communication control method can be applied to Figure 1 In the application environment shown. In terms of specific implementation, the method includes binding multiple Ethernet virtual function modules (VF) in kernel state to form virtual devices, virtual network cards and virtual switches, and grouping and aggregating the multiple virtual devices and virtual network cards formed, and then actively sending custom or existing link negotiation messages to perform aggregation operations, and finally adding corresponding link detection and fault recovery mechanisms to achieve fast, efficient, energy-saving and reliable unification.
[0077] The network communication control method also includes loading appropriate drivers (such as Ethernet drivers or RDMA drivers) for different Ethernet virtual function modules outside the hardware protocol stack, and allocating and combining DMA addresses through a peripheral controller interface (PCI) re-registration module to achieve transmission of memory data on different physical links.
[0078] The reason why the network communication control method is based on RDMA is that RDMA does not pass through the kernel protocol stack, has high performance, and does not cause too much burden on the CPU and memory. However, if the Transmission Control Protocol (TCP) network performs too many virtual device groupings, it is very easy to cause a great impact on CPU and memory resources. Therefore, this solution is only implemented in RDMA scenarios. RDMA scenarios such as Figure 2 shown.
[0079] In one embodiment, Figure 3 As shown, a network communication control method is provided, comprising the following steps:
[0080] Step S1, binding a preset number of Ethernet virtual function modules to kernel state drivers to obtain multiple virtual devices;
[0081] Step S2, selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0082] Step S3, obtaining a physical function module (PF) associated with the Ethernet virtual function module, obtaining information of a physical network card corresponding to the physical function module, and constructing a link aggregation control protocol data unit according to the information of the physical network card;
[0083] Step S4, each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, otherwise, the virtual device is determined to be abnormal;
[0084] Step S5: in response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0085] Among them, virtual devices are created by binding virtual functions through software, dynamic aggregation of virtual devices is realized, and aggregated links are established through negotiation with switches through link aggregation control protocols. The realization of virtual devices at the software level reduces costs and improves the scalability and flexibility of the system. On the basis of aggregated links, RDMA drivers are loaded for network card virtual functions to achieve remote direct memory access and improve data transmission efficiency. Through the combination of dynamic link aggregation and RDMA technology, high-performance, low-latency network communication is achieved, providing high-performance, reliable and flexible network communication solutions for applications such as data centers, cloud computing and high-performance computing.
[0086] Steps S3-S4 are the construction and sending of negotiation messages. Based on the acquired physical network card information, a link aggregation control protocol data unit is constructed. This article uses LACPDU as an example for illustration, and LACPDU may not be used in actual implementation. LACPDU is sent to the switch through the physical network card to achieve negotiation, connection establishment and perception of the LAG (Link Aggregation Group) status with the switch.
[0087] like Figure 4 As shown, in this embodiment, the step of binding a preset number of Ethernet virtual function modules to kernel state drivers to obtain virtual devices includes:
[0088] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0089] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0090] like Figure 5 As shown, in this embodiment, each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, it is determined that the virtual device is normal, and if not, it is determined that the virtual device is abnormal, including:
[0091] Step S41, controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0092] Step S42, detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0093] Step S43, if a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0094] Step S44: If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0095] like Figure 6 As shown, in this embodiment, in response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the alternative group until all virtual devices in the active group are normal, including:
[0096] Step S51, determining the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, adding the corresponding virtual device to the active group, if the identification is abnormal, adding the corresponding virtual device to the backup group, and selecting a virtual device with a normal identification from the backup group to add to the active group;
[0097] Step S52, if the virtual device pre-selected into the active group has an abnormal flag, and there is no virtual device with a normal flag in the backup group, the virtual device with the abnormal flag in the active group is added to the backup group;
[0098] Step S53, obtaining the number of all virtual devices with normal flags in the active group, and if the number of all virtual devices with normal flags in the active group is less than the first number, giving an alarm and working according to the active group.
[0099] In this embodiment, the network communication control method further includes:
[0100] When there is a virtual device with an abnormal flag set in the candidate group, detecting whether there is a virtual device that is not pre-selected into the active group and the candidate group;
[0101] If there is no virtual device that is not pre-selected into the active group and the candidate group, then the process ends;
[0102] If there are virtual devices that are not pre-selected into the active group and the candidate group, a virtual device with a normal flag is acquired and added to the candidate group to replace the virtual device with an abnormal flag in the candidate group.
[0103] The present application ensures that there are a maximum number of available virtual devices in the alternative group by replacing the virtual devices with abnormal flags in the alternative group with redundant virtual devices with normal flags, thereby facilitating replacement of virtual devices with physical link failures in the active group.
[0104] like Figure 7 As shown, in this embodiment, the network communication control method further includes:
[0105] When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing;
[0106] Setting the main thread to be responsible for allocating communication tasks and executing communication tasks;
[0107] The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
[0108] The above content is for resource allocation and management of the activity group: the links on each virtual device of the activity group are assigned to three threads for processing to prevent a large number of links from occupying the same thread. The main thread is responsible for allocating and executing communication tasks, while the other two secondary threads are only responsible for executing tasks. By reasonably allocating device resources of different resource groups, the correctness and efficiency of data transmission are ensured.
[0109] In this embodiment, the network communication control method further includes:
[0110] When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time;
[0111] If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group;
[0112] Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group;
[0113] When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group;
[0114] When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
[0115] During application operation, if new virtual devices are added to the physical server or some virtual devices are reduced, you want to adjust the capacity of the active group or backup group. If you want to adjust the capacity of the backup group, you can directly adjust, add or delete devices in the backup group. If you want to adjust the capacity of the active group, increase it: select devices from the backup group to add to the active group, and add new devices to the backup group. Reduce it: first assign the links on the deleted device to other devices, and then delete the device directly.
[0116] In this embodiment, the network communication control method further includes:
[0117] When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails;
[0118] When a virtual device in the active group fails to successfully send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails;
[0119] In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails;
[0120] Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly;
[0121] If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group;
[0122] If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working;
[0123] The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
[0124] The above content is the fault recovery mechanism, including fault detection and fault recovery. When a physical link fails, the link is quickly switched and recovered through fault detection and device replacement to ensure the reliability and continuity of data transmission.
[0125] Fault detection: Each link formed by a virtual device senses the fault of the physical link through LACPDU. When LACPDU cannot be successfully sent or received, it may mean that the physical link has failed.
[0126] Among them, fault recovery: when the device finds that it may fail, it informs the program through the event notification mechanism. First, select a virtual device from the backup group to confirm the connectivity. If qualified, it will swap the group position with the virtual device in the active group that failed. If unqualified, poll the next virtual device in the backup group. If there is still no qualified device after the round-robin training, an alarm will be issued and the faulty virtual device will be directly added to the backup group. The remaining devices in the active group continue to work, and the connections on the faulty virtual device will be evenly distributed to other virtual devices in the active group. If the virtual device enters the backup group because it is unavailable (including being found to be unavailable when selected from the backup group to enter the active group), an unavailable mark is set for the device. Every one minute, the connectivity of the virtual device with the unavailable mark is re-checked until the connectivity test passes and the virtual device mark is cancelled. At the same time, when a virtual device has an unavailable mark, it cannot be selected to enter the active group.
[0127] In the above network communication control method, virtual devices are created by binding virtual functions through software, dynamic aggregation of virtual devices is realized, and aggregation links are established through negotiation with switches through link aggregation control protocols. By realizing virtual devices at the software level, costs are reduced and the scalability and flexibility of the system are improved. On the basis of the aggregated link, the RDMA driver is loaded for the network card virtual function to realize remote direct memory access and improve data transmission efficiency. Through the combination of dynamic link aggregation and RDMA technology, high-performance and low-latency network communication is achieved, providing a high-performance, reliable and flexible network communication solution for applications such as data centers, cloud computing and high-performance computing.
[0128] In one embodiment, Figure 8 As shown, a network communication control device 10 is provided, including: a virtual device construction module 1, a virtual device grouping module 2, a protocol data unit construction module 3, a virtual device state judgment module 4, and an activity group management module 5.
[0129] The virtual device construction module 1 is used to perform kernel-mode driver binding on a preset number of Ethernet virtual function modules to obtain a plurality of virtual devices.
[0130] The virtual device grouping module 2 is used to select a first number of virtual devices to be pre-selected into an active group, and select a second number of virtual devices to be pre-selected into a candidate group.
[0131] The protocol data unit construction module 3 is used to obtain the physical function module associated with the Ethernet virtual function module, obtain the information of the physical network card corresponding to the physical function module, and construct the link aggregation control protocol data unit according to the information of the physical network card.
[0132] The virtual device status judgment module 4 is used for each virtual device to send the link aggregation control protocol data unit to the switch through the physical network card, and detect whether a normal receipt is received. If so, the virtual device is determined to be normal, otherwise, the virtual device is determined to be abnormal.
[0133] The active group management module 5 is used for replacing the abnormal virtual device in the active group with a normal virtual device in the alternative group in response to the presence of an abnormal virtual device in the active group, until all virtual devices in the active group are normal, and the active group is used for data transmission.
[0134] In this embodiment, the step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices includes:
[0135] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0136] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0137] In this embodiment, each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including:
[0138] Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0139] Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0140] If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0141] If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0142] In this embodiment, in response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the candidate group until all virtual devices in the active group are normal includes:
[0143] Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group;
[0144] If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group;
[0145] The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
[0146] In this embodiment, if Figure 8 As shown, the network communication control device 10 further includes: an alternative group management module 6 .
[0147] The alternative group management module 6 is used for: when there is a virtual device with an abnormal flag set in the alternative group, detecting whether there is a virtual device that is not pre-selected into the active group and the alternative group; if there is no virtual device that is not pre-selected into the active group and the alternative group, ending the process; if there is a virtual device that is not pre-selected into the active group and the alternative group, acquiring a virtual device with a normal flag set and adding it to the alternative group to replace the virtual device with the abnormal flag set in the alternative group.
[0148] The present application ensures that there are a maximum number of available virtual devices in the alternative group by replacing the virtual devices with abnormal flags in the alternative group with redundant virtual devices with normal flags, thereby facilitating replacement of virtual devices with physical link failures in the active group.
[0149] In this embodiment, if Figure 8 As shown, the network communication control device 10 further includes: a resource allocation and management module 7 .
[0150] The resource allocation and management module 7 is used for: when the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first sub-thread and the second sub-thread for task processing; setting the main thread to be responsible for allocating communication tasks and executing communication tasks; setting the first sub-thread and the second sub-thread to be responsible for executing tasks.
[0151] In this embodiment, if Figure 8 As shown, the network communication control device 10 also includes: a virtual device network pressure management module 8.
[0152] The virtual device network pressure management module 8 is used to: when the active group is working, monitor the network pressure on each virtual device in the active group in real time; if the network pressure on the target virtual device in the active group is greater than a preset threshold, control some links on the target virtual device to be allocated to other virtual devices in the active group; determine whether to adjust the capacity of the active group by monitoring the network pressure on each virtual device in the active group; when the capacity of the active group is increased, select virtual devices with normal flags from the backup group and add them to the active group, and add new virtual devices to the backup group; when the capacity of the active group is reduced, first allocate the links on the virtual devices pre-deleted in the active group to other virtual devices in the active group, and then directly delete the pre-deleted virtual devices.
[0153] In this embodiment, if Figure 8 As shown, the network communication control device 10 further includes: a fault recovery mechanism module 9.
[0154] The fault recovery mechanism module 9 is used to: when the active group is working, detect in real time whether the physical link corresponding to each virtual device in the active group fails; when the virtual device in the active group cannot successfully send or receive the link aggregation control protocol data unit, determine that the physical link corresponding to the virtual device fails; in response to the physical link corresponding to the virtual device in the active group failing, set an unavailable mark for the virtual device with the physical link failure; select a virtual device with a normal mark from the backup group, and detect whether the physical link corresponding to the virtual device is connected and qualified; if qualified, swap the position of the virtual device in the backup group and the virtual device with the unavailable mark in the active group; if If it fails, a virtual device with a normal flag in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with the unavailable flag in the active group is added to the alternative group, and the connections on the virtual device with the unavailable flag in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working; the virtual device with the unavailable flag in the backup group is rechecked at intervals of the first time period to see whether its corresponding physical link is connected and qualified. When the connection is qualified, the unavailable flag of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable flag to prevent it from being selected into the active group.
[0155] In the above network communication control device, virtual functions are bound by software to create virtual devices, realize dynamic aggregation of virtual devices, and negotiate with switches through link aggregation control protocols to establish aggregated links. By realizing virtual devices at the software level, costs are reduced and the scalability and flexibility of the system are improved. On the basis of the aggregated link, the RDMA driver is loaded for the network card virtual function to realize remote direct memory access and improve data transmission efficiency. Through the combination of dynamic link aggregation and RDMA technology, high-performance, low-latency network communication is achieved, providing a high-performance, reliable and flexible network communication solution for applications such as data centers, cloud computing and high-performance computing.
[0156] For the specific definition of the network communication control device, please refer to the definition of the network communication control method above, which will not be repeated here. Each module in the above-mentioned network communication control device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0157] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0158] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0159] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0160] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0161] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0162] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0163] In one embodiment, the computer program further implements the following steps when executed by a processor:
[0164] The step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices comprises:
[0165] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0166] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including:
[0169] Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0170] Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0171] If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0172] If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] In response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the candidate group until all virtual devices in the active group are normal includes:
[0175] Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group;
[0176] If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group;
[0177] The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
[0178] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0179] The network communication control method further includes:
[0180] When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing;
[0181] Setting the main thread to be responsible for allocating communication tasks and executing communication tasks;
[0182] The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0184] The network communication control method further includes:
[0185] When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time;
[0186] If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group;
[0187] Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group;
[0188] When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group;
[0189] When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] The network communication control method further includes:
[0192] When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails;
[0193] When a virtual device in the active group fails to send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails;
[0194] In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails;
[0195] Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly;
[0196] If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group;
[0197] If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working;
[0198] The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
[0199] For the specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method of network communication control above, which will not be repeated here.
[0200] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in Figure Y. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store network communication control data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a network communication control method is implemented.
[0201] Those skilled in the art will understand that the structure shown in FIG. Y is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0202] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0203] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0204] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0205] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0206] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0207] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0208] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0209] The step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices comprises:
[0210] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0211] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0212] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0213] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including:
[0214] Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0215] Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0216] If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0217] If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0218] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0219] In response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the candidate group until all virtual devices in the active group are normal includes:
[0220] Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group;
[0221] If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group;
[0222] The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
[0223] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0224] The network communication control method further includes:
[0225] When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing;
[0226] Setting the main thread to be responsible for allocating communication tasks and executing communication tasks;
[0227] The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
[0228] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0229] The network communication control method further includes:
[0230] When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time;
[0231] If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group;
[0232] Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group;
[0233] When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group;
[0234] When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
[0235] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0236] The network communication control method further includes:
[0237] When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails;
[0238] When a virtual device in the active group fails to successfully send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails;
[0239] In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails;
[0240] Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly;
[0241] If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group;
[0242] If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working;
[0243] The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
[0244] For the specific limitations on the steps implemented when the processor executes the computer program, please refer to the limitations on the network communication control method above, which will not be repeated here.
[0245] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0246] Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices;
[0247] Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group;
[0248] Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card;
[0249] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal;
[0250] In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the candidate group until all virtual devices in the active group are normal.
[0251] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0252] The step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices comprises:
[0253] Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number;
[0254] The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
[0255] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0256] Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including:
[0257] Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card;
[0258] Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal;
[0259] If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device;
[0260] If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
[0261] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0262] In response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the candidate group until all virtual devices in the active group are normal includes:
[0263] Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group;
[0264] If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group;
[0265] The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
[0266] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0267] The network communication control method further includes:
[0268] When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing;
[0269] Setting the main thread to be responsible for allocating communication tasks and executing communication tasks;
[0270] The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
[0271] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0272] The network communication control method further includes:
[0273] When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time;
[0274] If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group;
[0275] Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group;
[0276] When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group;
[0277] When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
[0278] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0279] The network communication control method further includes:
[0280] When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails;
[0281] When a virtual device in the active group fails to successfully send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails;
[0282] In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails;
[0283] Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly;
[0284] If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group;
[0285] If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working;
[0286] The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
[0287] For the specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the method of network communication control above, which will not be repeated here.
[0288] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0289] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0290] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A network communication control method, characterized in that: include: Binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain multiple virtual devices; Selecting a first number of virtual devices to be pre-selected into an active group, and selecting a second number of virtual devices to be pre-selected into a candidate group; Acquire a physical function module associated with the Ethernet virtual function module, acquire information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card; Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal; In response to the presence of an abnormal virtual device in the active group, the abnormal virtual device in the active group is replaced with a normal virtual device in the alternative group until all virtual devices in the active group are normal, and the active group is used for data transmission.
2. The network communication control method according to claim 1, characterized in that: The step of binding a preset number of Ethernet virtual function modules to kernel-mode drivers to obtain virtual devices comprises: Determine the required number of virtual devices according to system requirements and network environment, where the required number of virtual devices is greater than or equal to the sum of the first number and the second number; The preset number of the Ethernet virtual function modules is set to be greater than or equal to the required number of the virtual devices.
3. The network communication control method according to claim 1, characterized in that: Each of the virtual devices sends the link aggregation control protocol data unit to the switch through the physical network card, and detects whether a normal receipt is received. If so, the virtual device is determined to be normal, and if not, the virtual device is determined to be abnormal, including: Controlling the virtual devices one by one to send the link aggregation control protocol data units to the switch through the physical network card; Detecting whether a receipt from the switch is obtained after the link aggregation control protocol data unit is sent, and if a receipt is received, determining whether the receipt information is normal; If a receipt is received after the link aggregation control protocol data unit is sent, and the receipt information is normal, a normal flag is set for the corresponding virtual device; If no receipt is received after the link aggregation control protocol data unit is sent, or the receipt information contains rejection or abnormal information, an abnormal flag is set for the corresponding virtual device.
4. The network communication control method according to claim 3, characterized in that: In response to the presence of an abnormal virtual device in the active group, replacing the abnormal virtual device in the active group with a normal virtual device in the candidate group until all virtual devices in the active group are normal includes: Determine the identification of each virtual device pre-selected into the active group one by one, if the identification is normal, add the corresponding virtual device to the active group, if the identification is abnormal, add the corresponding virtual device to the backup group, and select a virtual device with a normal identification from the backup group to add to the active group; If the virtual device pre-selected into the active group has an abnormal identifier, and there is no virtual device with a normal identifier in the backup group, the virtual device with the abnormal identifier in the active group is added to the backup group; The number of all virtual devices with normal flags set in the active group is obtained. If the number of all virtual devices with normal flags set in the active group is less than the first number, an alarm is issued and the work is performed according to the active group.
5. The network communication control method according to claim 1, characterized in that: The network communication control method further includes: When the activity group is working, setting the link of each virtual device in the activity group to be allocated to the main thread, the first secondary thread and the second secondary thread for task processing; Setting the main thread to be responsible for allocating communication tasks and executing communication tasks; The first secondary thread and the second secondary thread are set to be responsible for executing tasks.
6. The network communication control method according to claim 1, characterized in that: The network communication control method further includes: When the activity group is working, monitoring the network pressure on each virtual device in the activity group in real time; If the network pressure on the target virtual device in the active group is greater than a preset threshold, controlling some links on the target virtual device to be distributed to other virtual devices in the active group; Determining whether to adjust the capacity of the activity group by monitoring the network pressure on each virtual device in the activity group; When the capacity of the active group is increased, virtual devices with normal flags are selected from the backup group and added to the active group, and new virtual devices are added to the backup group; When the capacity of the active group is reduced, the links on the pre-deleted virtual device in the active group are first allocated to other virtual devices in the active group, and then the pre-deleted virtual device is directly deleted.
7. The network communication control method according to claim 1, characterized in that: The network communication control method further includes: When the active group is working, detecting in real time whether a physical link corresponding to each virtual device in the active group fails; When a virtual device in the active group fails to successfully send or receive a link aggregation control protocol data unit, determining that a physical link corresponding to the virtual device fails; In response to a failure of a physical link corresponding to a virtual device in the active group, setting an unavailable mark for the virtual device whose physical link fails; Select a virtual device with a normal flag from the backup group, and detect whether the physical link corresponding to the virtual device is connected properly; If qualified, swapping the virtual device in the backup group with the virtual device marked as unavailable in the active group; If it fails, a virtual device with a normal flag set in the backup group is polled. If there is still no virtual device with a qualified physical link connection after the polling is completed, an alarm is issued and the virtual device with an unavailable flag set in the active group is added to the alternative group, and the connections on the virtual devices with an unavailable flag set in the active group are evenly distributed to other virtual devices in the active group, and the remaining virtual devices in the active group are controlled to continue working; The virtual device with an unavailable mark in the backup group is rechecked at an interval of a first time period to see whether its corresponding physical link is connected properly. When the connection is qualified, the unavailable mark of the virtual device is cancelled. When the connection is unqualified, the virtual device is kept with the unavailable mark to prevent it from being selected into the active group.
8. A network communication control device, characterized in that: The device comprises: Constructing a virtual device module for binding a preset number of Ethernet virtual function modules to kernel state drivers to obtain multiple virtual devices; A virtual device grouping module, configured to select a first number of virtual devices to be pre-selected into an active group, and select a second number of virtual devices to be pre-selected into a candidate group; Constructing a protocol data unit module, used to obtain a physical function module associated with the Ethernet virtual function module, obtain information of a physical network card corresponding to the physical function module, and construct a link aggregation control protocol data unit according to the information of the physical network card; A virtual device status judgment module, used for each of the virtual devices to send the link aggregation control protocol data unit to the switch through the physical network card, and detect whether a normal receipt is received. If so, the virtual device is judged to be normal, otherwise, the virtual device is judged to be abnormal; The active group management module is used to replace the abnormal virtual device in the active group with a normal virtual device in the alternative group in response to the presence of an abnormal virtual device in the active group, until all virtual devices in the active group are normal, and the active group is used for data transmission.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
