A method, system and related devices for binding virtual devices of multiple physical devices

CN114064263BActive Publication Date: 2026-10-20HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011308800.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-08-03
Filing Date
2020-11-20
Publication Date
2026-10-20
Estimated Expiration
2040-11-20

AI Technical Summary

Technical Problem

该模式提供了容错机制,可以提高网络连接的可用性,但同时该模式降低了资源利用率,在有N个物理设备的情况下,其资源利用率仅为1/N,此外也不具备负载均衡能力

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064263B_ABST
    Figure CN114064263B_ABST
Patent Text Reader

Abstract

The application provides a method, system and related device for binding virtual devices to multiple physical devices. The method comprises: creating multiple physical device sets based on multiple physical devices, wherein at least two physical device sets in the multiple physical device sets comprise a same physical device; creating one or more virtual devices corresponding to any one of the multiple physical device sets; and receiving data issued by a service application by using the virtual device. By creating multiple physical device sets and creating a virtual device corresponding to each physical device set to receive data issued by a service application, each physical device can participate in data processing, the resource utilization of the physical device is effectively improved, and load balancing of multiple physical devices is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese Patent Application No. 202010769410.8, filed on August 3, 2020, entitled "A Method and Apparatus for Binding Virtual Devices with Multiple Physical Devices", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This invention relates to the field of cloud computing technology, and in particular to a method, system, and related equipment for binding virtual devices to multiple physical devices. Background Technology

[0003] Currently, in order to improve resource utilization, system performance, and reliability, multi-physical device bonding technology is becoming increasingly popular. For example, network interface card bonding technology under Linux can abstract (bind) multiple physical network interfaces into a single logical network interface card within the system, which can effectively improve network throughput, achieve network redundancy, load balancing, and other functions.

[0004] After binding multiple physical devices into a single virtual device, its operating mode needs to be configured. Generally, it's configured as a primary / standby mode. In this mode, only one physical device is the primary device, and the others are standby devices. That is, only one physical device is active at any given time, and the others only become active again if the currently active device fails. This mode provides fault tolerance and can improve network connectivity availability, but it also reduces resource utilization. With N physical devices, its resource utilization is only 1 / N, and it lacks load balancing capabilities.

[0005] Therefore, improving resource utilization and increasing the load balancing capability of multiple physical devices in scenarios where multiple physical devices are bound to virtual devices is an urgent problem to be solved. Summary of the Invention

[0006] This invention discloses a method, system, and related equipment for binding virtual devices to multiple physical devices. It creates multiple sets of physical devices based on multiple physical devices, and creates virtual devices corresponding to different physical devices for each physical device set to support business applications, thereby improving resource utilization and achieving load balancing of multiple physical devices.

[0007] In a first aspect, this application provides a method for binding virtual devices to multiple physical devices, comprising: a server creating multiple physical device sets based on multiple physical devices, wherein at least two of the multiple physical device sets include the same physical device; the server creating one or more virtual devices corresponding to any one of the multiple physical device sets; and the server using the virtual devices to receive data issued by a business application.

[0008] Optionally, the physical devices involved in this application include, but are not limited to, NICs, GPUs, and NPUs.

[0009] In the solution provided in this application, when multiple physical devices exist, the server creates multiple physical device sets based on these physical devices, thereby binding the multiple physical devices together. The same physical device can belong to different physical device sets. Then, a corresponding virtual device is created for each physical device set, and the created virtual device is used to receive data sent by the upper-layer business application. This ensures that each physical device participates in data processing, effectively improving resource utilization and achieving load balancing among multiple physical devices.

[0010] In conjunction with the first aspect, in one possible implementation of the first aspect, the server provides an input interface for prompting the user to input creation parameters for a set of physical devices; the server obtains the creation parameters through the input interface and creates multiple sets of physical devices based on the creation parameters.

[0011] Optionally, the input interface includes a configuration interface, an application programming interface (API), and an input template.

[0012] In the solution provided in this application, users can input creation parameters through the configuration interface or API interface provided by the server, thereby creating multiple physical device sets based on the creation parameters, so that multiple physical device sets can perform business processing simultaneously, thereby improving resource utilization.

[0013] In conjunction with the first aspect, in one possible implementation of the first aspect, the server creates a first physical device set and a second physical device set based on the first physical device and the second physical device. The first physical device set and the second physical device set each include a master device and at least one backup device, wherein the master device of the first physical device set is the first physical device, and the master device of the second physical device set is the second physical device.

[0014] In the solution provided in this application, when the server creates a set of physical devices, it ensures that the master device of each set of physical devices is different, thereby ensuring that each physical device can participate in business processing and improving resource utilization.

[0015] In conjunction with the first aspect, in one possible implementation of the first aspect, the server creates a first virtual device based on a first set of physical devices; if the service traffic of the first physical device exceeds a first preset threshold, the correspondence between the first virtual device and the first set of physical devices is adjusted so that the first virtual device corresponds to the second set of physical devices.

[0016] In the solution provided in this application, the server can flexibly adjust the correspondence between virtual devices and physical device sets according to the business traffic of each physical device set, and can divert business traffic to physical device sets with less business pressure, thereby achieving load balancing of multiple physical devices.

[0017] In conjunction with the first aspect, in one possible implementation of the first aspect, the first set of physical devices includes the first physical device and the second physical device; if the service traffic of the first physical device exceeds a second preset threshold, the server adjusts the direction of the service traffic so that the first set of physical devices distributes the service traffic through the second physical device.

[0018] In the solution provided in this application, the server can adjust the service traffic for physical devices in the same set of physical devices, so that when the service traffic exceeds the preset threshold of the primary device, the service traffic can be diverted to the backup device for processing, thereby achieving load balancing within the same set of physical devices.

[0019] In conjunction with the first aspect, in one possible implementation of the first aspect, for any one of the plurality of physical device sets, the server sets the priority of each backup device to become the primary device based on the affinity between the business application and each backup device in any one of the plurality of physical device sets.

[0020] In the solution provided in this application, the server can use the affinity between the business application and each backup device to set priorities, thereby ensuring that in the event of a failure of the primary device, the backup device with higher priority takes over the operation of the primary device and ensures business continuity.

[0021] In conjunction with the first aspect, in one possible implementation of the first aspect, the server sets the priority of each backup device becoming the master device based on the connection relationship between the processor corresponding to the business application and each backup device; or, the server sets the priority of each backup device becoming the master device based on the available resource size of each backup device; or, the server sets the priority of each backup device becoming the master device based on the resource size consumed by each backup device in upgrading to the master device.

[0022] In the solution provided in this application, the server can flexibly set the priority of each backup device according to different constraints, so that when the primary device fails, the qualified backup device can become the new primary device, thereby ensuring the continuity of business and the stability of the system.

[0023] In conjunction with the first aspect, in one possible implementation of the first aspect, the virtual device receives test information sent by the business application, the test information being used to test the processing latency of the virtual device corresponding to the plurality of physical device sets; the server determines the processing latency of the virtual device corresponding to the plurality of physical device sets, and selects the virtual device corresponding to the minimum processing latency to receive the data sent by the business application.

[0024] In the solution provided in this application, after the server creates virtual devices, it determines the processing latency of each virtual device to complete the screening of virtual devices, and matches the virtual device with the minimum processing latency with the business application, thereby shortening the business processing time and improving the business processing efficiency.

[0025] In conjunction with the first aspect, in one possible implementation of the first aspect, the server sets the priority of the one or more virtual devices corresponding to any one of the plurality of physical device sets, so that the one or more virtual devices corresponding to any one of the plurality of physical device sets use resources according to the set priority.

[0026] In the solution provided in this application, the server sets the priority of virtual devices, thereby ensuring that virtual devices can use resources according to priority when resources are limited, thus improving service quality.

[0027] Secondly, this application provides a computing device, comprising: a creation unit, configured to create multiple physical device sets based on multiple physical devices, wherein at least two of the multiple physical device sets include the same physical device; the creation unit is further configured to create one or more virtual devices corresponding to any one of the multiple physical device sets; and a processing unit, configured to receive data issued by a business application using the virtual devices.

[0028] In conjunction with the second aspect, in one possible implementation of the second aspect, the computing device further includes a receiving unit, which is configured to provide an input interface for prompting a user to input creation parameters for a set of physical devices; the creation unit is further configured to create multiple sets of physical devices based on the creation parameters.

[0029] In conjunction with the second aspect, in one possible implementation of the second aspect, the creation unit is specifically used to: create a first physical device set and a second physical device set based on the first physical device and the second physical device, wherein the first physical device set and the second physical device set each include a master device and at least one backup device, wherein the master device of the first physical device set is the first physical device, and the master device of the second physical device set is the second physical device.

[0030] In conjunction with the second aspect, in one possible implementation of the second aspect, the creation unit is further configured to create a first virtual device based on the first physical device set; the processing unit is further configured to adjust the correspondence between the first virtual device and the first physical device set when the service traffic of the first physical device exceeds a first preset threshold, so that the first virtual device corresponds to the second physical device set.

[0031] In conjunction with the second aspect, in one possible implementation of the second aspect, the first set of physical devices includes the first physical device and the second physical device, and the processing unit is further configured to adjust the direction of the service traffic when the service traffic of the first physical device exceeds a second preset threshold, so that the first set of physical devices distributes the service traffic through the second physical device.

[0032] In conjunction with the second aspect, in one possible implementation of the second aspect, the processing unit is further configured to set the priority of each backup device becoming the primary device based on the affinity between the business application and each backup device in any one of the multiple physical device sets.

[0033] In conjunction with the second aspect, in one possible implementation of the second aspect, the processing unit is specifically configured to: set the priority of each backup device becoming a master device based on the connection relationship between the processor corresponding to the business application and each backup device; or, set the priority of each backup device becoming a master device based on the available resource size of each backup device; or, set the priority of each backup device becoming a master device based on the resource size consumed by each backup device in upgrading to a master device.

[0034] In conjunction with the second aspect, in one possible implementation of the second aspect, the receiving unit is further configured to receive test information sent by the service application, the test information being used to test the processing latency of the virtual devices corresponding to the plurality of physical device sets; the processing unit is further configured to determine the processing latency of the virtual devices corresponding to the plurality of physical device sets, and select the virtual device corresponding to the minimum processing latency to receive the data sent by the service application.

[0035] In conjunction with the second aspect, in one possible implementation of the second aspect, the processing unit is further configured to set the priority of the one or more virtual devices corresponding to any one of the plurality of physical device sets, so that the one or more virtual devices corresponding to any one of the plurality of physical device sets use resources according to the set priority.

[0036] Thirdly, this application provides a computing device including a processor and a memory, the processor and the memory being connected via an internal bus, the memory storing instructions, and the processor calling the instructions in the memory to execute the methods provided in the first aspect and in combination with any implementation of the first aspect.

[0037] Fourthly, this application provides a computer storage medium storing a computer program that, when executed by a processor, can implement the methods provided in the first aspect and in combination with any of the implementations of the first aspect.

[0038] Fifthly, this application provides a computer program product, the computer program including instructions that, when executed by a computer, enable the computer to perform the methods provided in the first aspect and in combination with any implementation of the first aspect. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a schematic diagram illustrating a scenario where multi-physical device bonding technology is used to support business applications, as provided in an embodiment of this application.

[0041] Figure 2 This is a schematic diagram illustrating another scenario where multi-physical device bonding technology is used to support business applications, as provided in an embodiment of this application.

[0042] Figure 3 This is a schematic diagram of a system architecture provided in an embodiment of this application;

[0043] Figure 4 This is a schematic diagram of another system architecture provided in an embodiment of this application;

[0044] Figure 5This is a flowchart illustrating a method for binding multiple physical devices to a virtual device according to an embodiment of this application;

[0045] Figure 6 This is a schematic diagram of a configuration interface provided in an embodiment of this application;

[0046] Figure 7 This is a schematic diagram illustrating the setting of device priority according to an embodiment of this application;

[0047] Figure 8 This is a schematic diagram of a system structure provided in an embodiment of this application;

[0048] Figure 9 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0049] Figure 10 This is a schematic diagram of the structure of another computing device provided in the embodiments of this application. Detailed Implementation

[0050] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The described embodiments are only some embodiments of this application, and not all embodiments.

[0051] First, some of the terms and related technologies used in this application will be explained to facilitate understanding by those skilled in the art.

[0052] Physical devices are devices that provide services to applications, including but not limited to network interface card (NIC) or network ports on NICs, graphics processing unit (GPU) or embedded neural network processing unit (NPU), etc.

[0053] A physical device set is a collection of multiple physical devices bound together, which appear as a single device to the outside world. For example, in Linux systems, network interface card (NIC) binding can be achieved by modifying the network port driver so that multiple NICs appear as a single Ethernet interface device with the same IP address. Because a physical device set is a collection of multiple physical devices bound together, if a physical device or a port on a physical device fails and becomes unusable, services can continue to be improved through redundant physical devices or ports according to the configuration policy, thereby improving system performance and reliability.

[0054] In scenarios where multi-physical device binding technology supports business applications, multiple physical devices need to be bound together to form a physical device set. This physical device set is then mapped to create one or more virtual physical devices, which are ultimately used to support upper-layer business applications. For example... Figure 1 As shown, the network card NIC100 provides two physical network ports, namely Ethernet port ETH110 and Ethernet port 120. Binding ETH110 and ETH120 together creates a physical device set, namely BOND200. BOND200 is a master-slave mode BOND. When creating BOND200, ETH110 can be designated as the master device, and ETH120 as the slave device. Alternatively, ETH120 can be designated as the master device, and ETH120 as the slave device. After obtaining BOND200, multiple virtual network interfaces (NICs) are mapped using BOND200, such as VNIC310, VNIC320, and VNIC330. After the mapping is completed, upper-layer business applications can use any of the mapped virtual NICs or directly use BOND200 for communication. If ETH110 is the master device, then during normal communication, all data from upper-layer business applications will be gathered at ETH110 through the virtual NICs and BOND200, and finally processed and forwarded by ETH110. That is, all data from upper-layer business applications will only pass through ETH110 and will not be forwarded through ETH120. Specifically, when ETH110 fails or its corresponding external link fails and cannot complete data forwarding, the BOND mechanism will detect the ETH110 anomaly and trigger a master-slave switchover. For example, the Linux system monitors the link status of the network interface through the link listening parameter. The value can be set to 100, which means that the system monitors the link status every 100 milliseconds. If the ETH110 link connection is detected to be broken, it indicates that ETH110 is abnormal. Then the master device of BOND200 will switch to ETH120. All data from upper-layer business applications will be aggregated to ETH120 through the virtual network card and BOND200, and ETH120 will take over the data forwarding processing from ETH110.

[0055] It can be seen that, Figure 1 In the application scenario where the physical device shown contains multiple physical network ports, binding multiple network ports to a single BOND results in only one physical network port being active at any given time, while the other physical network ports remain idle. This leads to low resource utilization and a lack of load balancing capabilities.

[0056] For scenarios where physical devices contain only a single physical network port, a similar principle can be used to bind multiple physical devices into a single physical device set, thereby providing fault tolerance and improving availability. For example... Figure 2As shown, NIC210 provides an Ethernet port ETH2110, and NIC220 provides an Ethernet port ETH2210. NIC210 and NIC220 can be directly interconnected via a bus or indirectly interconnected via their connected central processing unit (CPU). Binding NIC210 and NIC220 creates the physical device set BOND230. During BOND230 creation, NIC210 can be designated as the primary device, and NIC220 as the secondary device. After creation, BOND230 can be used to map multiple virtual network interfaces, such as VNIC2410, VNIC2420, and VNIC2430. After mapping, data from all upper-layer applications can be aggregated to NIC210 through any of the mapped virtual network interfaces and BOND230, and finally forwarded via ETH2110 within NIC210. When NIC210 fails or the external link corresponding to NIC210 fails and cannot complete data forwarding, the BOND mechanism will detect the NIC210 abnormality, thereby triggering a master-slave switchover, switching NIC220 to the new master device BOND230. All data from upper-layer service applications will be aggregated to NIC220 through the virtual network card and BOND230, and NIC220 will complete the data forwarding process.

[0057] Understandable, Figure 2 In the application scenario shown, where the physical devices include a single network port, multiple physical devices are bound to a single BOND. At any given time, only one physical device is in working condition, resulting in low resource utilization. There is no load balancing capability between the physical devices. Furthermore, since all business application data is forwarded and processed through the same physical device, data may be forwarded across devices, leading to high latency. For example, when NIC210 is working normally, data from NIC220 also needs to be forwarded and processed through NIC210, increasing transmission latency.

[0058] To address the aforementioned issues, this application provides a method for binding virtual devices to multiple physical devices. This method involves creating multiple sets of physical devices based on multiple physical devices, such that at least two of these sets contain the same physical device. Then, one or more virtual devices are created for each physical device set, and the created virtual devices are used to support business applications, thereby improving resource utilization and the load balancing capability of multiple physical devices.

[0059] The technical solutions of this application can be applied to various physical device binding scenarios, including but not limited to multi-NIC device binding, multi-GPU binding, multi-NPU binding, etc. For ease of understanding, this application takes NIC devices as physical devices as an example for specific explanation.

[0060] Figure 3 This is a schematic diagram of a system architecture provided in an embodiment of this application. For example... Figure 3 As shown, network interface card 310 provides two physical network ports, ETH3110 and ETH3120. Based on ETH3110 and ETH3120, two physical device sets, BOND3210 and BOND3220, are created. ETH3110 is the master device of BOND3210, and ETH3120 is the backup device; conversely, ETH3120 is the master device of BOND3220, and ETH3110 is the backup device. After creating BOND3210 and BOND3220, virtual network interfaces VNIC3310 and VNIC3320 are mapped using BOND3210, and virtual network interfaces VNIC3330 and VNIC3340 are mapped using BOND3220. Upper-layer applications can choose either virtual network interface for data transmission. This ensures that ETH3110 and ETH3120 can participate in the communication process simultaneously, with traffic passing through both, improving resource utilization efficiency and achieving load balancing. When ETH3110 fails or its corresponding external link fails, preventing data forwarding, a master / slave switch will be triggered. In this case, the master device of BOND3210 will switch to ETH3120, and all data will be forwarded through ETH3120, ensuring continued normal data forwarding and maintaining system reliability. This is understandable. Figure 3 This explanation uses an example of a physical device containing multiple physical network ports. The implementation principle is similar for a physical device with only a single physical network port. Figure 4As shown, network interface card 410 provides ETH4110, and network interface card 420 provides ETH4210. Network interface cards 410 and 420 are directly interconnected via a bus or connected through their respective CPUs. BOND430 and BOND440 are created based on network interface cards 410 and 420. Network interface card 410 is the master device of BOND430, and network interface card 420 is the backup device of BOND430; network interface card 420 is the master device of BOND440, and network interface card 410 is the backup device of BOND440. Subsequently, VNIC4310 and VNIC4320 are created based on BOND430, and VNIC4410 and VNIC4420 are created based on BOND440. Upper-layer business applications can select one of multiple virtual devices (such as VNIC4310 and VNIC4320) for business processing as needed, avoiding multiple business applications using the same virtual device at the same time, thereby improving business processing efficiency. Upper-layer business applications using NIC410 use VNIC4310 and VNIC4320 for data transmission, and upper-layer business applications using NIC420 use VNIC4410 and VNIC4420 for data transmission. This avoids cross-device transmission of data between NIC410 and NIC420, reduces transmission latency, and improves transmission efficiency.

[0061] Combination Figure 3 and Figure 4 The diagram shows a system architecture. The following will describe the method for binding virtual devices to multiple physical devices provided in embodiments of this application. Figure 5 As shown, the method includes, but is not limited to, the following steps:

[0062] S501: The server creates multiple physical device sets based on multiple physical devices.

[0063] Specifically, the server can create a set of physical devices based on multiple physical devices (such as multi-port network cards or single-port network cards) deployed on the server. The kernel CPU runs the code stored in the memory to create a set of physical devices. Each set of physical devices includes a master device and at least one backup device. The multiple physical devices are in a master-backup relationship with each other in different physical sets, and the master device in each set of physical devices is different. For example, when the physical devices are network interface cards (ETH0 and ETH1), when the server creates the network interface configuration file for the physical device set (i.e., BOND0) in the file directory, it sets ETH0 as the master device of BOND0 by adding the master device parameter and sets ETH1 as a support device of BOND0 by adding the network interface card support parameter, that is, ETH1 is the backup device of BOND0. Similarly, when creating the network interface configuration file for the physical device set (BOND1) in the file directory, it sets ETH1 as the master device of BOND1 by adding the master device parameter and sets ETH0 as a support device of BOND1 by adding the network interface card support parameter, that is, ETH0 is the backup device of BOND1. After the network interface configuration file is created, the server restarts the system or restarts the network service. During the network initialization process, the server's operating system reads the configuration file one by one, thereby establishing the binding relationship between ETH0, ETH1 and BOND0, BOND1.

[0064] Optionally, the physical device can be a GPU device, an NPU device, a network interface card (NIC) device, or a network port within a multi-port NIC device, such as those mentioned above. Figure 3 The network cards 310 shown are ETH3110 and ETH3120, or Figure 4 The network cards 410 and 420 are shown in the diagram.

[0065] In one possible implementation, the server can provide an input interface to the user, prompting the user to input creation parameters for a set of physical devices, and then obtain the user-input creation parameters through the input interface and create multiple sets of physical devices based on the creation parameters.

[0066] Optionally, the input interface may include a configuration interface, an application programming interface (API), and input templates, etc. The user inputs creation parameters based on the configuration interface, API, or input template provided by the server so that the server can complete the creation of the physical device set according to the creation parameters.

[0067] For example, such as Figure 6As shown, in the configuration interface provided by the server, the user selects or enters the name of the physical device, the identifier of the physical device, the working mode of the physical device set (e.g., primary / standby mode), the number of physical device sets, the number of standby devices in each physical device set, and other creation parameters. After the user completes the configuration of all parameters, they click the confirmation button on the interface, and the server creates the corresponding physical device set according to the creation parameters entered by the user.

[0068] It should be understood that during the creation of a physical device set, the same physical device can belong to different physical device sets. For example, the server creates a first physical device set and a second physical device set based on the physical devices deployed in the set. The first physical device is the primary device in the first physical device set and simultaneously a backup device in the second physical device set, as described above. Figure 3 ETH3110 or Figure 4 The network card in it is 410.

[0069] In another possible implementation, the server creates a first physical device set and a second physical device set based on a first physical device and a second physical device set, where the master device of the first physical device set is the first physical device and the master device of the second physical device set is the second physical device.

[0070] Specifically, when the physical device is a single-network-port device, such as the one described above... Figure 4 The network interface cards 410 and 420 shown can be used by the server to create a set of physical devices of the same number as the number of physical devices, with each set of physical devices having a different master device.

[0071] It's easy to understand that when a server creates a set of physical devices, it designates different physical devices as the master devices for each set. This allows each physical device to participate in the communication process, improving resource utilization and avoiding cross-device data transmission between different physical devices, thus improving transmission efficiency.

[0072] In another possible implementation, the server sets the priority of each backup device to become the primary device for any one of the multiple sets of physical devices, based on the affinity between the business application and each backup device in that set of physical devices.

[0073] Specifically, when creating a physical device set, the server can specify the primary device and backup devices for the set. The backup device takes over the primary device and continues to provide services in the event of a primary device failure. When there are multiple backup devices in the physical device set, the server can set the priority of each backup device to become the primary device based on the affinity between the business application and each backup device, so that when the original primary device fails, the backup device with the higher priority will become the new primary device.

[0074] Optionally, the server can prioritize backup devices based on the connection relationship between the processor corresponding to the business application and the backup device. For example, the backup device directly connected to the processor corresponding to the business application can be set to the first priority, and the backup device adjacent to the processor corresponding to the business application can be set to the second priority. In the event of a primary device failure, the backup device with the first priority will become the new primary device. It can be understood that setting priorities in this way can effectively reduce link latency in the event of a primary device failure.

[0075] For example, such as Figure 7As shown, network interface card 710 provides ETH7110, network interface card 720 provides ETH7210, network interface card 730 provides ETH7310, and network interface card 740 provides ETH7410. They are interconnected via an internal bus. Based on these four network interface cards, four physical device sets are created: BOND750, BOND760, BOND770, and BOND780. Among them, the master device of BOND750 is network interface card 710, and the backup devices are network interface cards 720 and 730. The BOND760's primary device is NIC 720, and its backup devices are NICs 710, 730, and 740; the BOND770's primary device is NIC 730, and its backup devices are NICs 710, 720, and 740; the BOND780's primary device is NIC 740, and its backup devices are NICs 710, 720, and 730. Simultaneously, corresponding virtual devices (such as VNIC7510, VNIC7610, etc.) are created based on each physical device set. When creating a physical device set, the server sets the priority of backup devices within each set. For example, for the BOND750, NIC 720 is directly connected to NIC 710, resulting in the lowest forwarding overhead; therefore, NIC 720 is set as the first priority. NIC 730 is indirectly connected to NIC 710 via NIC 720, resulting in higher forwarding overhead; therefore, NIC 730 is set as the second priority. NIC 740 is connected to NIC 710 via both NIC 720 and NIC 730, resulting in even higher forwarding overhead and a lower priority. During normal operation, the BOND750 uses NIC 710 to support upper-layer applications. When NIC 710 fails, the BOND750 will prioritize NIC 720 as the new primary device, taking over the work of NIC 710. In this case, both the BOND750 and BOND760 will share NIC 720 to support upper-layer applications and complete data forwarding processing.

[0076] Alternatively, the server can prioritize each backup device based on its available resources. For example, the server can obtain the bandwidth of each backup device's network interface connected to the external network and set the backup device with the highest bandwidth as the first priority. In the event of a primary device failure, the first-priority backup device will become the new primary device. In this way, it can be ensured that the new primary device has sufficient bandwidth resources to support upper-layer business applications when the primary device fails.

[0077] Alternatively, the server can prioritize backup devices based on their upgrade costs. For example, the server calculates the resource overhead (bandwidth, CPU, and memory) required for each backup device to become the new primary device, and sets the backup device with the lowest resource overhead as the first priority. In the event of a primary device failure, the first-priority backup device will become the new primary device first. It can be seen that setting priorities in this way ensures that the newly selected primary device consumes the least amount of resources in the event of a primary device failure, thus improving system resource utilization.

[0078] It is worth noting that the server can choose any one of the above methods to set priority, or it can combine multiple methods to set priority; this application does not limit this. For example, the server assigns weights to the above three methods as 40%, 30%, and 30% respectively, then calculates the comprehensive score of each backup device, and sets the priority based on the comprehensive score. That is, the connection relationship between the CPU corresponding to the business application and the backup device accounts for 40% of the weight, the available resource size of the backup device accounts for 30% of the weight, and the upgrade cost of the backup device accounts for 30% of the weight. The comprehensive score of each backup device is calculated, and the backup device with the highest comprehensive score is set as the first priority. In the event of a failure of the primary device, the backup device with the first priority will become the new primary device.

[0079] S502: The server creates one or more virtual devices corresponding to any one of the multiple physical device sets.

[0080] Specifically, after creating the bound devices, the server maps one or more virtual devices based on each set of physical devices for use by upper-layer business applications, for example, as described above. Figure 3 The VNIC3310 and VNIC3320 shown are Figure 4 As shown in the VNIC4310 and VNIC4320 diagram, it should be understood that although the physical device set can map multiple virtual devices, the service traffic of all virtual devices is actually forwarded and processed through the master device of the physical device set. For example, Figure 3 The service traffic of VNIC3310 and VNIC3320 is actually forwarded and processed through ETH3110. Figure 4 The service traffic of VNIC4310 and VNIC4320 is actually forwarded through NIC410.

[0081] In another possible implementation, the server creates one or more virtual devices that match the business application for any one of the multiple sets of physical devices, and provides services to the business application through the virtual devices.

[0082] Specifically, the server creates virtual devices that match the business applications based on the various physical device sets, so that the business applications can send business traffic through the matching virtual devices. This enables multiple physical devices to participate in the communication process simultaneously, improves resource utilization, and achieves load balancing among multiple physical devices.

[0083] In another possible implementation, the server sets a priority for the virtual device so that the virtual device uses resources according to the set priority.

[0084] Specifically, when a server creates virtual devices based on a set of physical devices, it can set the priority of each virtual device when multiple virtual devices are created. For example, the priority can be set according to the matching degree between the business application and each virtual device. The virtual device with higher priority will use resources first, which can ensure that more urgent business is processed first and avoid traffic congestion.

[0085] S503: The server uses the virtual device to receive data sent by the business application.

[0086] Specifically, upper-layer business applications distribute business traffic through the created virtual devices, for example, by utilizing... Figure 3 The VNIC3310 and VNIC3320 shown are either Figure 4 The VNIC4310 and VNIC4320 shown in the diagram send out service traffic, so that the physical device corresponding to the virtual device (such as ETH3110 or NIC410) receives the service traffic sent by the service application and completes the forwarding process.

[0087] In another possible implementation, the server creates a first virtual device based on a first set of physical devices. If the service traffic of the first physical device exceeds a first preset threshold, the correspondence between the first virtual device and the first set of physical devices is adjusted so that the first virtual device corresponds to the second set of physical devices.

[0088] Specifically, after creating virtual devices corresponding to a set of physical devices, the server can dynamically adjust the mapping between virtual devices and the physical device set based on the status of the master device of the physical device set. When the service traffic of the master device of the physical device set exceeds a preset threshold, it indicates that the master device is currently congested and unsuitable for continuing to receive service traffic from upper-layer applications. At this time, the server can adjust the mapping between virtual devices and physical device sets, associating the virtual devices with other physical device sets (e.g., physical device sets where the master device is idle). This allows upper-layer service traffic to be forwarded through the master devices of other physical device sets, reducing the forwarding pressure on the master devices of those physical device sets and improving the overall system efficiency. The first preset threshold can be set according to actual conditions, and this application does not limit it.

[0089] For example, as described above Figure 4 In the application scenario shown, the master device of BOND430 is network interface card 410. Upper-layer business applications send service traffic to network interface card 410 through VNIC4310 and VNIC4320 created based on BOND430. When the service traffic of network interface card 410 exceeds a preset threshold, the correspondence between VNIC4310 and / or VNIC4320 and BOND430 is adjusted so that VNIC4310 and / or VNIC4320 correspond to BOND440. After the adjustment is completed, the forwarding pressure of network interface card 410 will be relieved, and the service traffic sent by upper-layer business applications will reach BOND440 through VNIC4310 and / or VNIC4320, and finally be forwarded through network interface card 420, thus realizing load balancing between network interface card 410 and network interface card 420.

[0090] In another possible implementation, the first set of physical devices includes a first physical device and a second physical device. If the service traffic of the first physical device exceeds a second preset threshold, the direction of the service traffic is adjusted so that the first set of physical devices distributes the service traffic through the second physical device.

[0091] Specifically, after the server creates a set of physical devices, it can dynamically adjust the direction of business traffic based on the status of each physical device in the set. When the business traffic of the first physical device exceeds the second preset threshold, the business traffic is adjusted through the set of the first physical devices so that the business traffic flows to the second physical device, thereby reducing the processing pressure on the first physical device and achieving load balancing of multiple physical devices.

[0092] For example, in the above Figure 4In the scenario shown, BOND430 includes network interface card 410 and network interface card 420. When the service traffic of network interface card 410 exceeds the preset threshold, BOND430 adjusts the direction of service traffic so that the service traffic flows to network interface card 420, thereby relieving the processing pressure of network interface card 410 and achieving load balancing between network interface card 410 and network interface card 420.

[0093] In another possible implementation, after creating a virtual device based on a set of physical devices, test information is received from a business application. The test information is used to test the processing latency of the virtual devices corresponding to the multiple sets of physical devices, determine the processing latency of the virtual devices corresponding to the multiple sets of physical devices, and select the virtual device with the minimum processing latency to support the business application.

[0094] Specifically, business applications rely on virtual devices to deliver services, but the performance of these virtual devices varies. Therefore, the application needs to determine the best-performing virtual device to complete the final service delivery. Before actually delivering services, the application needs to perform performance tests on all existing virtual devices. For example, the application can iterate through all virtual devices, send test information to each, determine the processing latency of each virtual device based on the feedback, and then select the virtual device with the lowest latency to deliver the service.

[0095] The following section uses four single-port devices as an example to further detail the method for binding virtual devices to multiple physical devices provided in this application.

[0096] like Figure 8As shown, the server deploys four network interface cards (NICs): NIC 810 provides ETH8110, NIC 820 provides ETH8210, NIC 830 provides ETH8310, and NIC 840 provides ETH8410. These NICs are interconnected via a bus. Server 800 creates BOND850 based on these four NICs, designating NIC 810 as the primary device, and NICs 820, 830, and 840 as secondary devices, with their priority decreasing sequentially when they become primary devices. VNIC8510 is created based on BOND850 for use by upper-layer business applications, with all actual traffic passing through NIC 810. BOND860 is also created, designating NIC 820 as the primary device, and NICs 830, 840, and 810 as secondary devices, all of which become primary devices. The priority of the backup devices decreases sequentially. A VNIC 8610 is created based on BOND860 for use by upper-layer business applications, with all actual traffic passing through NIC 820. A BOND870 is created, with NIC 830 designated as the primary device. NICs 840, 820, and 810 are backup devices, with their priority decreasing sequentially. A VNIC 8710 is created based on BOND870 for use by upper-layer business applications, with all actual traffic passing through NIC 830. A BOND880 is created, with NIC 840 designated as the primary device. NICs 830, 820, and 810 are backup devices, with their priority decreasing sequentially. A VNIC 8810 is created based on BOND880 for use by upper-layer business applications, with all actual traffic passing through NIC 840.

[0097] As can be seen, each physical device is a master device and will participate in the communication process, improving resource utilization and achieving cross-device network interface resource redundancy backup, thus improving system reliability. Each physical device uses its own Ethernet port for forwarding, avoiding cross-device data forwarding. In addition, by setting the priority of backup devices to become master devices, it is ensured that in the event of a master device failure, the highest priority backup device can be selected as the new master device, thereby reducing link latency.

[0098] It should be noted that, Figure 8 The method of binding virtual devices to multiple physical devices shown is similar to Figure 5 The principle is the same, and you can refer to it. Figure 5 For the sake of brevity, the relevant descriptions of steps S501 to S503 will not be repeated here.

[0099] The methods of the embodiments of this application have been described in detail above. In order to facilitate better implementation of the above solutions of the embodiments of this application, correspondingly, related devices for cooperating in implementing the above solutions are also provided below.

[0100] See Figure 9 , Figure 9 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. The computing device may be as described above. Figure 5 The server in the method embodiment can execute Figure 5 The method embodiments for binding multiple physical devices to virtual devices describe methods and steps performed by a server. For example... Figure 9 As shown, the computing device 900 includes a creation unit 910 and a processing unit 920.

[0101] in,

[0102] The creation unit 910 is used to create multiple physical device sets based on multiple physical devices, wherein at least two of the multiple physical device sets include the same physical device;

[0103] The creation unit 910 is further configured to create one or more virtual devices corresponding to any one of the multiple physical device sets;

[0104] The processing unit 920 is used to receive data sent by the business application using the virtual device.

[0105] Specifically, the creation unit 910 is used to execute the aforementioned steps S501 and S502, and optionally executes the methods selected in the aforementioned steps. The processing unit 920 is used to execute the aforementioned step S503, and optionally executes the methods selected in the aforementioned steps. The two units can transmit data to each other through a communication path. It should be understood that the units included in the computing device 900 can be software units, hardware units, or a combination of both.

[0106] As an example, the computing device 900 further includes a receiving unit 930, which is used to provide an input interface; the creation unit 910 is also used to create a plurality of physical device sets according to the creation parameters.

[0107] As an example, the creation unit 910 is specifically used to: create a first physical device set and a second physical device set based on a first physical device and a second physical device, wherein the first physical device set and the second physical device set include a master device and at least one backup device, wherein the master device of the first physical device set is the first physical device, and the master device of the second physical device set is the second physical device.

[0108] As an example, the creation unit 910 is further configured to create a first virtual device based on the first physical device set; the processing unit 920 is further configured to adjust the correspondence between the first virtual device and the first physical device set when the service traffic of the first physical device exceeds a first preset threshold, so that the first virtual device corresponds to the second physical device set.

[0109] As an example, the first set of physical devices includes the first physical device and the second physical device. The processing unit 920 is further configured to adjust the direction of the service traffic when the service traffic of the first physical device exceeds a second preset threshold, so that the first set of physical devices can distribute the service traffic through the second physical device.

[0110] As an example, the processing unit 920 is further configured to set the priority of each backup device becoming the primary device based on the affinity between the business application and each backup device in any one of the plurality of physical device sets.

[0111] As one embodiment, the processing unit 920 is specifically configured to: set the priority of each backup device becoming a master device according to the connection relationship between the processor corresponding to the business application and each backup device; or, set the priority of each backup device becoming a master device according to the available resource size of each backup device; or, set the priority of each backup device becoming a master device according to the resource size consumed by each backup device in upgrading to a master device.

[0112] As an example, the receiving unit 930 is further configured to receive test information sent by the service application, the test information being used to test the processing latency of the virtual devices corresponding to the plurality of physical device sets; the processing unit 920 is further configured to determine the processing latency of the virtual devices corresponding to the plurality of physical device sets, and select the virtual device corresponding to the minimum processing latency to receive the data sent by the service application.

[0113] As an example, the processing unit 920 is further configured to set the priority of the one or more virtual devices corresponding to any one of the plurality of physical device sets, so that the one or more virtual devices corresponding to any one of the plurality of physical device sets use resources according to the set priority.

[0114] It should be understood that the structure of the computing device described above is merely an example and should not constitute a specific limitation. The various units of the computing device can be added, removed, or combined as needed. Furthermore, the operation and / or function of each unit in the computing device are respectively designed to achieve the above-described... Figure 5 For the sake of brevity, the corresponding process of the described method will not be elaborated here.

[0115] See Figure 10 , Figure 10 This is a schematic diagram of the structure of another computing device provided in an embodiment of this application. For example... Figure 10 As shown, the computing device 10 includes a processor 11, a communication interface 12, and a memory 13, which are interconnected via an internal bus 14.

[0116] The computing device 10 may be Figure 5 The server in the method embodiment. Figure 5 The functions performed by the server in the method embodiment are actually executed by the server's processor 11.

[0117] The processor 11 may consist of one or more general-purpose processors, such as a central processing unit (CPU), or a combination of a CPU and hardware chips. The hardware chips may be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The PLDs may be complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), generic array logic (GALs), or any combination thereof.

[0118] Bus 14 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Bus 14 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 The symbol is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0119] Memory 13 may include volatile memory, such as random access memory (RAM); memory 13 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); memory 13 may also include combinations of the above types. The program code may be used to implement the functional units shown in the computing device 900, or to implement... Figure 5 The method steps shown in the embodiment are performed by a server.

[0120] This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program can implement some or all of the steps described in the above method embodiments, and implement the above... Figure 9 The function of any one of the described functional units.

[0121] This application also provides a computer program product that, when run on a computer or processor, causes the computer or processor to perform one or more steps of any of the methods described above. If the constituent units of the aforementioned devices are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0122] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0123] It should also be understood that, in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0124] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0125] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0126] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for binding virtual devices to multiple physical devices, characterized in that, include: Multiple physical device sets are created based on multiple physical devices, wherein each physical device belongs to at least two physical device sets in the multiple physical device sets, each physical device is a master device in a different physical device set, and the multiple physical devices have a master-backup relationship with each other in different physical device sets. For any one of the multiple sets of physical devices, create one or more virtual devices corresponding to the physical device set; The virtual device receives data from the service application using the master device in the set of physical devices corresponding to it.

2. The method as described in claim 1, characterized in that, Before creating multiple physical device sets based on multiple physical devices, the method further includes: An input interface is provided to prompt the user to input creation parameters for the physical device set; The creation parameters are obtained through the input interface; The creation of multiple physical device sets based on multiple physical devices includes: Multiple physical device sets are created based on the creation parameters.

3. The method as described in claim 1, characterized in that, The creation of multiple physical device sets based on the multiple physical devices includes: A first physical device set and a second physical device set are created based on a first physical device and a second physical device set. The first physical device set and the second physical device set each include a master device and at least one backup device. The master device of the first physical device set is the first physical device, and the master device of the second physical device set is the second physical device.

4. The method as described in claim 3, characterized in that, Creating one or more virtual devices corresponding to any one of the multiple sets of physical devices includes: A first virtual device is created based on a first set of physical devices; After creating the first virtual device, the method further includes: If the service traffic of the first physical device exceeds the first preset threshold, the correspondence between the first virtual device and the first set of physical devices is adjusted so that the first virtual device corresponds to the second set of physical devices.

5. The method as described in claim 3, characterized in that, The method further includes: The first set of physical devices includes the first physical device and the second physical device; If the service traffic of the first physical device exceeds the second preset threshold, the direction of the service traffic is adjusted so that the first physical device set sends the service traffic through the second physical device.

6. The method as described in claim 4 or 5, characterized in that, After creating multiple physical device sets based on multiple physical devices, the method further includes: For any one of the multiple physical device sets, the priority of each backup device becoming the primary device is set according to the affinity between the business application and each backup device in any one of the multiple physical device sets.

7. The method as described in claim 6, characterized in that, The priority of a backup device becoming a primary device is set based on the affinity between the business application and the backup devices in any one of the multiple physical device sets, including: The priority of each backup device as the primary device is set according to the connection relationship between the processor corresponding to the business application and each backup device; or... The priority of each backup device as the primary device is set according to the available resource size of each backup device; or... The priority of each backup device becoming the master device is set according to the amount of resources consumed by each backup device in upgrading to the master device.

8. The method according to any one of claims 1-5, characterized in that, Before receiving data from business applications using virtual devices, the method further includes: Receive test information sent by the business application, the test information being used to test the processing latency of the virtual devices corresponding to the multiple sets of physical devices; Determine the processing latency of the virtual device corresponding to the multiple physical device sets, and select the virtual device with the minimum processing latency to receive the data sent by the service application.

9. The method according to any one of claims 1-5, characterized in that, After creating one or more virtual devices corresponding to any one of the plurality of physical device sets, the method further includes: The priority of the virtual device corresponding to one or more of the multiple physical device sets is set so that the virtual device corresponding to one or more of the multiple physical device sets uses resources according to the set priority.

10. A computing device, characterized in that, include: A creation unit is used to create multiple physical device sets based on multiple physical devices, wherein each physical device belongs to at least two physical device sets in the multiple physical device sets, each physical device is a master device in a different physical device set, and the multiple physical devices have a master-slave relationship in different physical device sets; The creation unit is further configured to create one or more virtual devices corresponding to any one of the multiple physical device sets; The processing unit is used to receive data sent by the service application using the master device in the set of physical devices corresponding to the virtual device.

11. The computing device as claimed in claim 10, characterized in that, The computing device also includes a receiving unit. The receiving unit is used to provide an input interface, which is used to prompt the user to input the creation parameters of the physical device set; The creation unit is also used to create multiple sets of physical devices according to the creation parameters.

12. The computing device as claimed in claim 10, characterized in that, The creation unit is specifically used for: A first physical device set and a second physical device set are created based on a first physical device and a second physical device set. The first physical device set and the second physical device set each include a master device and at least one backup device. The master device of the first physical device set is the first physical device, and the master device of the second physical device set is the second physical device.

13. The computing device as claimed in claim 12, characterized in that, The creation unit is also used to create a first virtual device based on the first set of physical devices; The processing unit is further configured to adjust the correspondence between the first virtual device and the first physical device set when the service traffic of the first physical device exceeds a first preset threshold, so that the first virtual device corresponds to the second physical device set.

14. The computing device as claimed in claim 12, characterized in that, The first set of physical devices includes the first physical device and the second physical device. The processing unit is further configured to adjust the direction of the service traffic when the service traffic of the first physical device exceeds a second preset threshold, so that the first physical device set sends the service traffic through the second physical device.

15. The computing device according to any one of claims 10-14, characterized in that, The processing unit is further configured to set the priority of each backup device becoming the primary device based on the affinity between the business application and each backup device in any one of the multiple physical device sets.

16. The computing device as claimed in claim 15, characterized in that, The processing unit is specifically used for: The priority of each backup device as the primary device is set according to the connection relationship between the processor corresponding to the business application and each backup device; or... The priority of each backup device as the primary device is set according to the available resource size of each backup device; or... The priority of each backup device becoming the master device is set according to the amount of resources consumed by each backup device in upgrading to the master device.

17. The computing device as claimed in claim 11, characterized in that, The receiving unit is further configured to receive test information sent by the business application, the test information being used to test the processing latency of the virtual device corresponding to the multiple sets of physical devices; The processing unit is further configured to determine the processing latency of the virtual device corresponding to the plurality of physical device sets, and select the virtual device with the minimum processing latency to receive the data sent by the service application.

18. The computing device according to any one of claims 10-14, characterized in that, The processing unit is further configured to set the priority of the one or more virtual devices corresponding to any one of the plurality of physical device sets, so that the one or more virtual devices corresponding to any one of the plurality of physical device sets use resources according to the set priority.

19. A computing device, characterized in that, The computing device includes a memory and a processor, the processor executing computer instructions stored in the memory, causing the computing device to perform the method according to any one of claims 1-9.

20. A computer-readable storage medium storing a computer program that, when executed by a processor, performs the function of the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Distributed storage system and path switching method thereof

    CN111431980A