WO2024067525A1 - 负载均衡方法、服务器、数据中心网络系统及电子设备 - Google Patents

负载均衡方法、服务器、数据中心网络系统及电子设备 Download PDF

Info

Publication number
WO2024067525A1
WO2024067525A1 PCT/CN2023/121262 CN2023121262W WO2024067525A1 WO 2024067525 A1 WO2024067525 A1 WO 2024067525A1 CN 2023121262 W CN2023121262 W CN 2023121262W WO 2024067525 A1 WO2024067525 A1 WO 2024067525A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
queue
processor
load
processors
Prior art date
Application number
PCT/CN2023/121262
Other languages
English (en)
French (fr)
Inventor
杨博文
Original Assignee
杭州阿里云飞天信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州阿里云飞天信息技术有限公司 filed Critical 杭州阿里云飞天信息技术有限公司
Publication of WO2024067525A1 publication Critical patent/WO2024067525A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/70Virtual switches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/508Monitor

Definitions

  • the present application relates to the field of computer technology, and in particular to a load balancing method, a server, a data center network system, and an electronic device.
  • Virtualization technology can be used to virtualize multiple virtual machines on physical devices to virtualize the network.
  • the virtual switch is a key component for realizing network virtualization in physical devices. It can connect the physical network and virtual machines and carry out data forwarding and processing of virtual machines.
  • a virtual machine connects to a virtual switch through its own internal virtual network card.
  • the virtual switch often uses multiple processors to process the network data of the virtual machine.
  • different virtual machines are configured with different numbers of virtual network cards, and when the virtual network card supports multiple data queues, the number of data queues maintained in different virtual network cards will also be different, and the amount of data sent and received corresponding to different data queues may also be different.
  • uneven traffic load may cause a single processor to be overloaded, which can easily cause network packet loss, delay, jitter and other problems.
  • the present application provides a load balancing method, a server, a data center network system and an electronic device that solve the above problems or at least partially solve the above problems.
  • a load balancing method is provided.
  • the load balancing method is applicable to a server having multiple processors, wherein a virtual switch and multiple virtual machines are running on the server, and the virtual switch processes data forwarding between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors; wherein the method comprises:
  • a server in another embodiment, includes multiple processors, and a virtual switch and multiple virtual machines are running on the server;
  • the virtual switch processes the forwarding of data between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors, and is used to determine the data queues associated with the multiple processors respectively; wherein the data queues are used to store data to be forwarded, and the processors process the data to be forwarded in the data queues associated with them; the data to be forwarded in the multiple data queues are monitored respectively to determine the load information of the multiple processors; when it is determined that there is an uneven load based on the load information of the multiple processors, the data queues associated with some of the multiple processors are adjusted.
  • a data center network system in another embodiment, includes a plurality of servers connected to a network; wherein:
  • the server includes multiple processors, and a virtual switch and multiple virtual machines are running on the server;
  • the virtual switch processes the forwarding of data between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors, and is used to determine the data queues associated with the multiple processors respectively; wherein the data queues are used to store data to be forwarded, and the processors process the data to be forwarded in the data queues associated with them; the data to be forwarded in the multiple data queues are monitored respectively to determine the load information of the multiple processors; when it is determined that there is an uneven load based on the load information of the multiple processors, the data queues associated with some of the multiple processors are adjusted.
  • an electronic device in another embodiment, includes a memory and a plurality of processors; wherein:
  • the memory stores one or more computer instructions
  • Multiple processors are respectively coupled to the memory and are used to call the one or more computer instructions to virtualize a virtual switch and multiple virtual machines.
  • the virtual switch processes the forwarding of data between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors, and is also used to balance the loads of the multiple processors through the steps of the load balancing method provided in the above-mentioned embodiment of the present application.
  • the technical solutions provided in the embodiments of the present application respectively monitor the to-be-forwarded processed data in multiple data queues to determine the load information of multiple processors.
  • the data queues associated with some of the multiple processors are adjusted, thereby dynamically ensuring the load balancing of the processors in the virtual switch.
  • the entire solution provided by the present application is simple to implement and has a small amount of calculation, which helps to improve the adjustment efficiency of the data queues associated with some of the multiple processors when there is an uneven load between the processors.
  • the technical solutions provided in the embodiments of the present application based on determining the multiple data queues corresponding to the virtual network card in the virtual machine, first configure associated data queues for multiple processors respectively, so that the number of data queues associated with the multiple processors is balanced, and the multiple data queues of the same virtual network card are associated with different processors.
  • static load balancing can be provided for each processor in the initial stage.
  • FIG. 1a shows a schematic diagram of a principle of communication connection between a virtual switch and a virtual machine in a virtual network
  • FIG1b shows a schematic diagram showing a principle of communication connection between a virtual switch and a virtual machine in another virtual network
  • FIG2 shows the software architecture of the virtual switch provided by the present application
  • FIG3 shows a schematic diagram of a flow chart of a load balancing method provided in an embodiment of the present application
  • FIG4 is a schematic diagram showing a principle of configuring associated data queues for multiple processors according to an embodiment of the present application
  • FIG5 is a schematic diagram showing a flow chart of configuring associated data queues for multiple processors according to an embodiment of the present application
  • FIG6a shows a schematic diagram of a principle of adjusting data queues associated with some processors according to an embodiment of the present application
  • FIG6b is a schematic diagram showing a flow chart of adjusting data queues associated with some processors according to an embodiment of the present application
  • FIG7a shows a schematic diagram of a scenario of a queue swapping solution provided in an embodiment of the present application
  • FIG7b is a schematic diagram showing a scenario corresponding to a queue migration solution provided in an embodiment of the present application.
  • FIG8 shows a schematic structural diagram of a load balancing device provided in another embodiment of the present application.
  • VM virtual machines
  • a virtual machine refers to a complete computer system with complete hardware system functions that runs in a completely isolated environment and simulated by software. All the work that can be done in a physical computer can be done in a virtual machine.
  • part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine.
  • Each virtual machine can operate the virtual machine like a physical machine. Communication between virtual machines and between virtual machines and external networks relies on virtual switches.
  • a virtual machine has one or more virtual network cards.
  • the virtual network cards are usually bridged to the virtual bridge or virtual switch on the physical server, so they can communicate with each other directly through the virtual network layer 2 device without going through the physical network card.
  • the interaction between the virtual machine and the outside world must go through the physical network card.
  • computing resources are divided, and virtual machines run on the server.
  • Virtual machines also need network cards to achieve interconnection, but the network cards of virtual machines are not physical. They are connected to virtual switches through virtual network cards. The virtual switches forward traffic between virtual machines on the same server. If the virtual switch is connected to the server's hardware network card, the virtual machines can communicate with the outside of the server.
  • the virtual network card is simulated by the CPU.
  • the virtual network card has one or more data queues (or send and receive queues).
  • the data queue is also simulated, which is a piece of memory on the server.
  • the virtual switch is a key component for implementing network virtualization in physical devices. It can provide data forwarding and processing (such as error checking and address mapping maintenance) for virtual network cards and physical network cards, so that each virtual machine in the virtual network or the virtual machine outside the virtual network can communicate with each other.
  • a communication connection can be established between external devices (such as an external PC (Personal Computer) to achieve data transmission.
  • external devices such as an external PC (Personal Computer) to achieve data transmission.
  • Each virtual machine has its own virtual network card, and the external device has its own physical network card.
  • the virtual machine and the external device are connected to the virtual switch through their respective virtual network cards and physical network cards.
  • the virtual switch uses virtual switch technology to combine two physically connected switches together, presenting a logical, virtualized switch to the outside world.
  • virtual machines VM1, VM2 and VW3 and external devices are connected to the virtual switch VS through their respective virtual network cards and communicate with external devices through physical network cards.
  • one or more virtual network cards can be configured on the virtual machine.
  • a virtual network card has a data queue for caching data, that is, all data received by the virtual network card enters from this data queue, and then the virtual switch uses a processor (such as CPU (Central Processing Unit, central processing unit) to fetch data from this data queue for processing. If the data is not fetched in time, packet loss will occur.
  • a virtual switch uses a processor to process the data of a data queue in a timely manner is called an interruption.
  • the virtual network card uses a data queue to cache data, which is easy to cause data blocking, and the processor will also have a very high load, resulting in a performance bottleneck.
  • a network card (such as a virtual network card) has developed a multi-queue function.
  • a network card with multiple queues means that a network card can have multiple data queues.
  • the virtual switch After receiving the data, it can be hashed according to the five-tuple information carried by the data to cache it into one of the multiple data queues, and each data queue in the multiple data queues in the network card is bound to a different processor through an interrupt to solve the processing bottleneck of a single CPU when the network data flow increases, and improve the network PPS (Packet Per Second, the number of packets transmitted per second) and bandwidth performance.
  • PPS Packet Per Second, the number of packets transmitted per second
  • the virtual switch can use multiple processors to process data forwarding between multiple virtual machines and between virtual machines and external devices.
  • each embodiment of the present application provides a load balancing technical solution.
  • the technical solution in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application.
  • the virtual switch required to implement the method provided by the present application is a virtual switch (VS) 200 as shown in FIG. 1b.
  • VS is a switch based on software implementation.
  • VS can be a traditional open source software switch (Open VSwitch, OVS), or it can also be an OVS that supports DPDK (Data Plane Development Kit, data plane development kit), that is, OVS-DPDK, etc., and the present application embodiment does not limit this.
  • a plurality of virtual machines (Virtual Machine, VM) 100 can be connected to VS, and it has a plurality of processors (such as processor 1 to processor n).
  • VM is an emulator of a computer system simulated by software on a physical device, has a complete hardware system function, and runs in a completely isolated environment, and can provide the function of a physical computer.
  • the VM connected to VS in the embodiment of the present application has at least one virtual network card, and the virtual network card can support a multi-queue function, that is, the virtual network card corresponds to at least one data queue for placing data to be forwarded.
  • FIG. 1b does not show the multiple data queues corresponding to the virtual network card.
  • the specific form of the software architecture of the VS may be implemented by using a software architecture in which the control plane 10 and the forwarding plane 20 are separated as shown in FIG. 2 , that is, the VS mainly includes two functional modules, the control plane 10 and the forwarding plane 20; wherein,
  • the forwarding plane 20 is used to process the data to be forwarded in multiple data queues through multiple processors, wherein one processor processes the data to be forwarded in at least one data queue associated with it, and the processor can be but is not limited to a CPU, a GPU, etc.
  • the control plane 10 is provided with a load balancing module 110 for determining a plurality of data queues and configuring associated data queues for the plurality of processors respectively, so that the number of data queues associated with the plurality of processors is balanced and the plurality of data queues corresponding to the same virtual network card are associated with different processors.
  • q11 is the associated data queue configured for CPU0.
  • the forwarding plane 20 is used to monitor the data to be forwarded in each of the multiple data queues, and feed back the monitoring result to the control plane 10.
  • the control plane 10 is also used to determine the load information of the multiple processors based on the monitoring results fed back by the forwarding plane 20; and when it is determined that there is an uneven load based on the load information of the multiple processors, adjust the data queues associated with some of the multiple processors.
  • the control plane 10 may also be provided with a configuration management module 120 and a data acquisition module 130. After determining multiple data queues, the load balancing module 110 on the control plane 10 may configure the associated data queues for multiple processors respectively through the configuration management module 120.
  • the control plane 10 receives the monitoring results fed back by the forwarding plane 20 for the data to be forwarded in each of the multiple data queues, it may be completed through the data acquisition module 120, thereby realizing the forwarding plane 10-based
  • the feedback monitoring results determine the load information of the multiple processors.
  • the adjustment results can also be sent to the configuration management module 110, so that the configuration management module 110 updates the association information between the processors and the data queues stored in itself, so as to facilitate the management of the association between the processors and the data queues according to the updated association information between the processors and the data queues, etc.
  • each module and/or each unit in the virtual switch software architecture shown in FIG. 2 please refer to the relevant content below, which will not be described in detail here.
  • FIG3 shows a flow chart of a load balancing method provided in an embodiment of the present application.
  • the load balancing method is applicable to a server (or multi-core server) having multiple processors as shown in FIG1b.
  • a virtual switch and multiple virtual machines are running on the server, and the virtual switch processes the forwarding of data between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors.
  • a virtual switch (VS) is a switch based on software implementation.
  • the VS can be implemented using a software architecture in which the control plane 10 and the forwarding plane 20 are separated as shown in FIG2.
  • a load balancing module 110 is provided on the control plane 10.
  • the load balancing method provided in an embodiment of the present application is a method implemented by the software program corresponding to the control plane 10 in the virtual switch. Referring to FIG3, the load balancing method comprises the following steps:
  • the data queue refers to a queue in a virtual network card in a virtual machine for storing data to be forwarded.
  • a virtual machine has at least one virtual network card, and each virtual network card can support a multi-queue function.
  • the number of data queues that can be in each virtual network card is greater than or equal to 1.
  • the number of data queues that a virtual network card has is determined by the parameters provided by the virtual network card driver for specifying the number of hardware queues of the virtual network card.
  • the number of data queues that can be in a virtual network card specified by the parameter can be 2, 4, 8, etc., which are not limited here.
  • the above parameters determine the maximum number of data queues that can be in a virtual network card, and do not indicate the number of data queues currently activated in a virtual network card.
  • the number of data queues currently activated in a virtual network card is obtained by the virtual network card driver corresponding to the virtual network card when it is loaded.
  • the model of the virtual network card is obtained to obtain the maximum number of data queues of the virtual network card, and the number of processors of the virtual switch connected to the virtual network card is combined.
  • multiple virtual machines (such as VM1, VM2, and VM3) are connected to corresponding virtual ports (not shown in the figure) provided on a virtual switch (i.e., VS) through at least one virtual network card in the virtual network, thereby connecting to the virtual switch.
  • the virtual switch has four processors (i.e., CPU0 to CPU4).
  • CPU0 to CPU4 the maximum number of data queues supported by the virtual network card 1 is 2, which is less than the number of processors of the virtual switch (i.e., 4)
  • the virtual network card driver corresponding to VM1 when the virtual network card driver corresponding to VM1 is loaded, two data queues on the virtual network card 1 will be activated (not shown in FIG. 1b, see FIG. 4 for details), so that the virtual network card 1 uses the two activated data queues to store the data to be forwarded.
  • the number of data queues activated by the virtual network cards in other virtual machines such as VM2 and VM3 can also be obtained.
  • the data queue determined in the above 101 specifically refers to an activated queue in a virtual network card in a virtual machine for placing data to be forwarded. Further, when determining multiple data queues, the determination is made for all virtual machines connected to the virtual switch, that is, multiple data queues may come from the same virtual network card or different virtual network cards in the same virtual machine, or may also come from different virtual network cards in different virtual machines, etc., which is not limited here.
  • the multiple data queues determined include q11 ⁇ q12, q21 ⁇ q24, q31 ⁇ q32, q41 ⁇ q44, which come from different virtual network cards in different virtual machines.
  • q11 and q12 are from virtual network card 1 of VM1;
  • q21 ⁇ q24, q31 and q32 are from the virtual network card in VM2, among which q21 ⁇ q24 are from virtual network card 2 in VM2,
  • q31 and q32 are from virtual network card 3 in VM2;
  • q41 ⁇ q144 are from virtual network card 4 in VM3.
  • the associated data queues can be configured for multiple processors according to the pre-configured load balancing mechanism.
  • this embodiment will fully consider the number of queues of the data queues of each virtual network card when configuring the associated data queues for each processor, so as to configure the same number of data queues for each processor and at the same time ensure that the multiple data queues of the same virtual network card are associated with different processors.
  • step 101 "determining the data queues associated with multiple processors" in the method provided in this embodiment may include the following steps:
  • the above 1012 “respectively configure associated data queues for the multiple processors so that the number of data queues associated with the multiple processors is balanced, and multiple data queues of the same virtual network card are associated with different processors” may specifically include:
  • incremented number M is greater than the number of queues of the virtual network card with number N, increment the number N; if the incremented number N is greater than the number of network cards, end; if the incremented number N is not greater than the number of network cards, update the virtual network card number N to the incremented number N;
  • incremented number M is not greater than the number of queues of the virtual network card numbered N, then according to the incremented number M and the updated number X, trigger the step of associating the data queue numbered M of the virtual network card numbered N with the processor numbered X.
  • each virtual network card in the multiple virtual network cards, each data queue in the multiple data queues corresponding to each virtual network card, and each processor in the multiple processors all have corresponding numbers, and the network card numbers between each virtual network card in the multiple virtual network cards, the data queue numbers of each data queue in the multiple data queues corresponding to each virtual network card, and the processor numbers of each processor in the multiple processors can all be numbered in a natural number incrementing manner, but not limited to.
  • the numbers corresponding to the 4 processors can be 0, 1, 2, and 3, respectively, so that it is convenient to perform the above steps 10122 to 10127 according to the virtual network card number, the data queue number and the processor number, so as to configure the associated data queue for each processor.
  • a feasible technical solution for step 10124 "updating the number X based on the number of processors" is:
  • the process described in the above steps 10121 to 10127 is the pre-configured load balancing mechanism set in the present embodiment described above.
  • the pre-configured load balancing mechanism can be pre-set in the configuration management module set in the control plane as shown in Figure 2, so that the control plane can control the configuration management module in the initialization stage according to the preset pre-configured load balancing mechanism to associate the data queue of each virtual network card with each processor, and make the number of data queues associated with each processor balanced, while ensuring that multiple data queues in the same virtual network card are associated with different processors.
  • FIG5 shows a schematic diagram of a process of configuring associated data queues for each processor corresponding to the above steps 10121 to 10127.
  • the following is a specific description of the process of configuring associated data queues for each processor by taking an example in conjunction with FIG5 and FIG4. Specifically,
  • VS refers to the CPU, and the number of CPUs is 4
  • X represents the CPU number corresponding to the CPU, and the value of X can be 0, 1, 2, and 3.
  • the VS is connected to three virtual machines, VM1, VM2, and VM3. Specifically, VM1, VM2, and VM3 are connected to the VS through virtual network card 1, virtual network card 2, virtual network card 3, and virtual network card 4, respectively. That is to say, the VS is connected to 4 virtual network cards. Assume that N represents the virtual network card number corresponding to the virtual network card, and the value of N can be 1, 2, 3, and 4. Further, let M represent the data queue number corresponding to the data queue.
  • the value of M can be 1 and 2; four data queues (i.e., q21 to q24) are activated in the virtual network card 3 of the virtual network card number 2, then correspondingly, the value of M can be 1, 2, 3, and 4; two data queues (i.e., q31 and q32) are activated in the virtual network card 3 of the virtual network card number 3, then correspondingly, the value of M can be 1 and 2; four data queues (i.e., q41 to q44) are activated in the virtual network card 4 of the virtual network card number 4, then correspondingly, the value of M can be 1, 2, 3, and 4.
  • the processor number X can be incremented so that X is incremented from 0 to 1, and the value 1 can be obtained by taking the modulus of the number of processors (i.e., mod(1,4)) using the incremented number X.
  • the number X can be updated from 0 to 1 according to the value 1.
  • the number M is also incremented so that the number M is incremented from 1 to 2.
  • the incremented number M is 2, which is not greater than the number of queues of the virtual network card number 1 (i.e., 2). Therefore, in combination with FIG5 and FIG4, that is, according to the incremented number M (i.e., 2) and the updated number X (i.e., 1), the execution of associating the data queue q12 of the virtual network card number 2 of the virtual network card number 1 with the processor number 1 (i.e., CPU1) is triggered.
  • the update number X and the increment number M will be executed again.
  • the number X will be updated from 1 to 2
  • the number M will be incremented from 2 to 3.
  • the incremented number M is 3, which is greater than the number of queues of the virtual network card numbered 1 (i.e., 2), indicating that the data queue in the virtual network card numbered 1 has been associated with the corresponding CPU.
  • the number M can be reset to the initial value (such as 1), and the number N can be incremented so that the number N increases from 1 to 2.
  • the incremented number N is 2, which is not greater than the number of virtual network cards (i.e., 4), indicating that there are still data queues in the virtual network card.
  • the column has not been associated with the corresponding CPU, so the virtual network card number N will be updated to the incremented number N, that is, the virtual network card number N will be updated from 1 to 2, and then according to the updated virtual network card number N, according to the above-described method of associating the data queue in the virtual network card 1 numbered 1 with the corresponding CPU, the data queues in the virtual network card 2 numbered 2 will be associated with the corresponding CPU, for example, as shown in Figure 4, the data queue q21, data queue q22, data queue q23 and data queue q24 in the virtual network card numbered 2 are associated with CPU2, CPU3, CPU0 and CPU1 respectively.
  • the two data queues in the virtual network card No. 3 will continue to be associated with the corresponding CPU in the above manner, such as the data queue q31 and the data queue q32 in the virtual network card No. 3 shown in FIG4, which are associated with CPU2 and CPU3 respectively.
  • the number N will be incremented so that the number N is incremented from 3 to 4 (not greater than the number of virtual network cards), and the four data queues in the virtual network card No. 4 shown in FIG4 will continue to be associated with the corresponding CPU in the above manner.
  • the number N is incremented so that the number N is incremented from 4 to 5.
  • the incremented number M is 5, which is greater than the number of networks (i.e., 4), indicating that all the data queues in the four virtual network cards have been associated with the corresponding CPUs, and the end operation can be performed for this reason.
  • the virtual network card in the virtual machine will use a hash algorithm to calculate the five-element information composed of the source IP address, destination IP address, source port, destination disconnection, application protocol, etc. carried in the data header to calculate a hash value.
  • the data is placed into one of the multiple data queues therein according to the hash value; then, one of the multiple data queues can inform the processor associated with it through, but not limited to, a hardware interrupt (IRQ) method that it has new data that needs to be forwarded and processed, so that the processor associated with it fetches data from itself for processing.
  • IRQ hardware interrupt
  • the processor can monitor the data to be forwarded in the data queue associated with it according to the received hardware interrupt. Since the processor is located at the forwarding plane of the virtual switch shown in Figure 2, that is to say, the forwarding plane can monitor the data to be forwarded in each of the multiple data queues.
  • the control plane can determine the data to be forwarded in the multiple data queues according to the monitoring results, thereby obtaining the processing information of the data to be forwarded in each data queue. Since the data to be forwarded and processed in a data queue needs to be forwarded and processed by the processor associated with it, based on the processing information of the data to be forwarded in each data queue, the processor information of each data queue associated with any one of the multiple processors can be obtained, so as to calculate the load information of any one of the multiple processors, and thus the load information of multiple processors can be obtained. Based on the above content, in a specific achievable technical solution, the above 102 "respectively monitor the processor data to be forwarded in the multiple data queues to determine the load information of the multiple processors" can specifically include:
  • the forwarding plane in the virtual switch can be used to indirectly monitor the data to be forwarded in multiple data queues, so as to obtain processing information of the data to be forwarded in each data queue.
  • the processing information of the data to be forwarded in each data queue obtained may include but is not limited to: the number of data, data type, data size, data fragment size, etc.
  • the processing information of the data to be forwarded in each data queue in the multiple data queues associated with any processor among the multiple processors i.e., the third processor
  • the load corresponding to each data queue in the multiple data queues associated with the third processor can be calculated respectively, so as to obtain the load information of the third processor;
  • the load information of the third processor may include but is not limited to: the load corresponding to each data queue in the multiple data queues associated with the third processor, and the total load of the third processor calculated according to the load corresponding to each data queue in the multiple data queues associated with the third processor.
  • the processing information of the data to be forwarded in each of the three data queues q11, q23 and q41 associated with CPU0 can be obtained.
  • the processing information of the data to be forwarded in q11, q23 and q41 can be used to calculate the loads corresponding to q11, q23 and q41 respectively.
  • the load information of CPU0 can be obtained as follows: Load_q11+Load_q23+Load_q41, Load_q11, Load_q23, Load_q41; wherein, Load_q11+Load_q23+Load_q41 is the total load corresponding to CPU0, and Load_q11, Load_q23 and Load_q41 can carry the identifier of the corresponding data queue (i.e., q11, q23, q41), which can be but not limited to the number of the data queue.
  • the load information of CPU1 to CPU2 can also be calculated in the same way. It should be noted that, regarding calculating the load corresponding to a data queue according to the processing information of the data to be forwarded in the data queue, please refer to the relevant content below.
  • the load of each processor in the multiple processors can be analyzed to determine whether there is uneven load on each processor at present.
  • the extreme difference value can reflect the discrete degree of a set of data and can best reflect the size of the fluctuation range of a set of data
  • the extreme difference value method can be used to determine whether the current storage load of each processor is uneven; wherein the extreme difference value refers to the difference between the maximum data and the minimum data in a set of data. And only when it is determined by the extreme difference value method that there is uneven load on each processor among the multiple processors, the data queues associated with some of the multiple processors are adjusted, which can effectively avoid the occurrence of problems such as invalid adjustment and waste of computing resources.
  • the above 103 when it is determined based on the load information of the multiple processors that there is uneven load, the data queues associated with some of the multiple processors are adjusted", can specifically include:
  • the above threshold can be flexibly set according to actual conditions, for example, the threshold can be 3%, 5%, 10%, etc., which is not limited here. If the load difference between the first processor with the smallest load and the second processor with the largest load among the multiple processors is calculated to be greater than the threshold (such as 5%) based on the load information of multiple processors, it means that the load fluctuation range between the processors is small, and there is a small load difference between the processors.
  • the processors are in a load balancing state, and there is no need to adjust the data queues associated with the processors; on the contrary, if the load difference is greater than the threshold (such as 5%), it means that the load fluctuation range between the processors is large, and there is a large load difference between the processors. At this time, it can be considered that there is uneven load between the processors. For this reason, it is necessary to adjust the data queue associated with the first processor and the data queue associated with the second processor to reduce the load fluctuation range between the processors so that the processors can achieve load balancing.
  • the threshold such as 5%
  • the first processor and the second processor are each associated with multiple data queues.
  • an adaptive queue adjustment scheme can be determined, and the data queues associated with the first processor and the data queues associated with the second processor can be adjusted according to the queue adjustment scheme. That is, the "adjusting the data queues associated with the first processor and the data queues associated with the second processor" in the above 1033 can be specifically implemented by the following steps:
  • the queue adjustment plan adjust the data queue associated with the first processor and the data queue associated with the second processor.
  • the step of “obtaining a first load of each of the multiple data queues associated with the first processor” in the above 10331 can be implemented by the following specific steps:
  • A11. Obtain processing information of the first processor processing the data to be forwarded in the data queue; wherein the processing information includes: the amount of processed data within a preset time, the receiving time and sending time of the data within the preset time, and the number of processor execution cycles within the preset time;
  • A12. Determine a first load corresponding to the data queue according to the processing information.
  • the preset time can be flexibly set according to actual conditions, for example, the preset time can be but not limited to 30 seconds, 1 minute, 2 minutes, etc.
  • the preset time included is T
  • the number of data processed within the preset time is S (S is greater than 1)
  • the receiving time of the wth data in the number of S data is tw1 and the sending time is tw2
  • the number of processor execution cycles within the preset time T is ncycle
  • the load determination method corresponding to the data queue described above is to directly quantify it through the processor execution cycle indicator, thereby replacing the conventional PPS, bandwidth and other measurement methods. This method will have higher accuracy in measuring processor resource consumption.
  • this embodiment selects a data queue from the multiple data queues associated with the first processor as a target queue by analyzing the first load corresponding to each data queue in the multiple data queues associated with the first processor and the load difference between the first processor and the second processor calculated by the above step 1042, and selects a data queue from the multiple data queues associated with the first processor as another target queue by analyzing the first load information corresponding to each data queue in the multiple data queues associated with the second processor, the second load information corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference, A data queue is selected from the multiple data queues associated with the second processor as another target queue.
  • the queue adjustment scheme is determined based on the loads corresponding to the three target queues determined above. That is, the above 10432 "determines the queue adjustment scheme based on the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference", can be implemented in the following steps:
  • A21 Based on the first load corresponding to each data queue in the multiple data queues associated with the first processor and the load difference, select a data queue from the multiple data queues associated with the first processor as the first target queue;
  • A22 based on the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference, select one data queue from the multiple data queues associated with the first processor as the second target queue, and select one data queue from the multiple data queues associated with the second processor as the third target queue;
  • A23 Determine a queue adjustment plan based on the load corresponding to the first target queue, the load corresponding to the second target queue, and the load corresponding to the third target queue.
  • a difference analysis method can be used to select a data queue from the multiple data queues associated with the first processor as the first target queue.
  • a specific implementation scheme of the above A21 "based on the first load and the load difference corresponding to each data queue in the multiple data queues associated with the first processor, a data queue is selected from the multiple data queues associated with the first processor as the first target queue" is:
  • A211 Calculate a first value of a first load corresponding to each data queue in a plurality of data queues associated with the first processor relative to the load difference;
  • A212 Use the data queue with the smallest first value among the multiple data queues associated with the first processor as the first target queue.
  • the first value refers to the absolute difference between the first load corresponding to each data queue in the multiple data queues associated with the first processor and the load difference. Specifically, assuming that the first load corresponding to the j-th data queue in the multiple data queues associated with the first processor is recorded as Load_q 1_j , and the load difference is recorded as ⁇ , then the first value abs_1 corresponding to the j-th data queue in the multiple data queues associated with the first processor can be calculated using the following formula 1:
  • the first processor is CPU1
  • CPU1 is associated with three data queues q12, q24 and q42
  • q12 is the first data queue among the three data queues q12, q24 and q42 associated with CPU1
  • the first value abs_1 corresponding to the first data queue among the three data queues q12, q24 and q42 associated with CPU1 is:
  • the data queue among the multiple data queues associated with the first processor that has the smallest first value is the first target queue.
  • queue combinations can be first performed for the multiple data queues associated with the first processor and the multiple data queues associated with the second processor to obtain multiple queue combinations containing two data queues (one of which is the data queue associated with the first processor, and the other is the data queue associated with the second processor); by adopting the difference analysis method, on the basis of calculating the absolute difference between the loads corresponding to the two data queues in each queue combination of the multiple queue combinations, the second value of the absolute difference corresponding to each queue combination in the multiple queue combinations relative to the load difference is further calculated, so as to select the queue combination with the smallest second value as the target combination, thereby determining the second target queue and the third target queue based on the two data queues in the target combination.
  • A221. Calculate, according to a first load corresponding to each data queue in the multiple data queues associated with the first processor and a second load corresponding to each data queue in the multiple data queues associated with the second processor, an absolute difference between loads corresponding to two data queues in each queue combination of the multiple queue combinations; wherein any data queue in the multiple data queues associated with the first processor and any data queue in the multiple data queues associated with the second processor constitute a queue combination;
  • A222 Calculate a second value of the absolute difference corresponding to each queue combination in the multiple queue combinations relative to the load difference
  • A224 Use the data queue associated with the first processor in the target combination as the second target queue, and use the data queue associated with the second processor as the third target queue.
  • the second value refers to the absolute difference of the absolute difference corresponding to each queue combination in the multiple queue combinations relative to the absolute difference of the load difference.
  • the queue combination with the smallest second value in the multiple queue combinations is considered to be the target combination.
  • the data queue associated with the first processor in the target combination is used as the second target queue, and the data queue associated with the second processor is used as the third target queue.
  • the above A23 "determining a queue adjustment plan based on the load corresponding to the first target queue, the load corresponding to the second target queue and the load of the third target queue" can be implemented by the following steps:
  • A232 Obtain a second value of an absolute difference between the load corresponding to the second target queue and the load corresponding to the third target queue relative to the load difference;
  • a queue swap scheme is adopted to adjust the second target queue to be associated with the second processor and to adjust the third target queue to be associated with the first processor.
  • the above queue migration scheme and queue exchange scheme can be pre-set in the load balancing module set on the control plane as shown in FIG2, so that the load balancing module determines a queue adjustment scheme from the queue migration scheme and the queue exchange scheme by comparing and analyzing the first value of the load corresponding to the first target queue relative to the load difference, and the absolute difference between the load corresponding to the second target queue and the load corresponding to the third target queue relative to the second value of the load difference, and then calls out the corresponding queue adjustment scheme from itself so as to subsequently adjust the data queue associated with the first processor and the data queue associated with the second processor according to the queue adjustment scheme.
  • the queue adjustment scheme when it is determined that the first value is less than the second value, it is determined to adopt the queue migration scheme to adjust the first target queue to be associated with the second processor; conversely, if it is determined that the first value is greater than or equal to the second value, it is determined to adopt the queue exchange scheme to adjust the second target queue to be associated with the second processor and the third target queue to be associated with the first processor.
  • the determined queue adjustment scheme is a queue migration scheme
  • the data queue corresponding to the first target queue among the multiple data queues associated with the first processor is adjusted to be associated with the second processor
  • the determined queue adjustment scheme is a queue exchange scheme
  • the data queue corresponding to the second target queue among the multiple data queues associated with the first processor is adjusted to be associated with the second processor
  • the data queue corresponding to the third target queue among the multiple data queues associated with the second processor is adjusted to be associated with the first processor.
  • the technical solution provided by this embodiment on the basis of determining the multiple data queues corresponding to the virtual network card in the virtual machine, will first configure the associated data queues for multiple processors respectively, so that the number of data queues associated with the multiple processors is balanced, and the multiple data queues of the same virtual network card are associated with different processors.
  • This configuration association method is adopted, so that a better load balancing guarantee is provided for each processor in the initialization stage.
  • the data to be forwarded in the multiple data queues will be monitored separately to determine the load information of the multiple processors, so that when it is determined that there is an uneven load based on the load information of the multiple data processors, by adjusting the data queues associated with some of the multiple processors, the load balancing of each processor in the virtual switch can be effectively guaranteed, and the entire solution provided by this embodiment is simple to implement and has a small amount of calculation, which helps to improve the adjustment efficiency of the data queues associated with some of the multiple processors when there is an uneven load between the processors.
  • the entire implementation process described in 102 and 103 (i.e., the above steps 1031 to 1033) of determining the load information of multiple processors by monitoring the to-be-forwarded processing data in multiple data queues, and adjusting the data queues associated with some processors in the multiple processors when it is determined that there is a load imbalance based on the load information of the multiple processors, can be simplified as shown in the flow chart of FIG.
  • the control plane will evaluate the load balance of each processor in the multiple processors based on the monitoring result, and when it is determined that there is a load imbalance, based on the policy
  • the corresponding queue adjustment scheme is roughly determined; then, the data queues associated with some processors in the multiple processors are adjusted by executing the determined queue adjustment scheme, so that the load between the processors is balanced.
  • the forwarding plane and the control plane are set in the virtual switch; the strategy refers to the content related to the above description and the determination of the queue adjustment scheme.
  • FIG. 6b shows a flow chart corresponding to the above 103 (that is, the above steps 1031 to 1033) for adjusting the data queues associated with some of the multiple processors when it is determined based on the load information of the multiple processors that there is an uneven load between the multiple processors.
  • FIG. 6b shows a flow chart corresponding to the above 103 (that is, the above steps 1031 to 1033) for adjusting the data queues associated with some of the multiple processors when it is determined based on the load information of the multiple processors that there is an uneven load between the multiple processors.
  • the following is an example to specifically describe the process of adjusting the data queues associated with some of the multiple processors in combination with FIG. 6b and FIG. 4. Specifically,
  • the multiple data queues associated with each of the four CPUs CPU0 to CPU3 shown in FIG. 4 are: the multiple data queues associated with CPU0 include q11, q23 and q41, the multiple data queues associated with CPU1 include q12, q24 and q42, the multiple data queues associated with CPU2 include q21, q31 and q43, and the multiple data queues associated with CPU3 include q22, q32 and q44.
  • the queue adjustment scheme determined is a queue exchange scheme.
  • the queue adjustment scheme determined is the queue migration scheme.
  • An embodiment of the present application provides a server.
  • the server includes multiple processors, and a virtual switch 200 and multiple virtual machines 100 are running on the server.
  • the virtual switch 200 processes the forwarding of data between the multiple virtual machines 100 and between the multiple virtual machines 100 and external devices connected to the server through the multiple processors, and is used to determine the data queues associated with the multiple processors respectively; wherein the data queues are used to store data to be forwarded, and the processors process the data to be forwarded in the data queues associated with them; the data to be forwarded in the multiple data queues are respectively monitored to determine the load information of the multiple processors; when it is determined that there is an uneven load based on the load information of the multiple processors, the data queues associated with some of the multiple processors are adjusted.
  • An embodiment of the present application provides a data center network system.
  • the data center network system includes multiple servers connected to a network. For example, multiple servers shown in FIG1b.
  • the server in the data center network system includes multiple processors, and a virtual switch and multiple virtual machines are running on the server;
  • the virtual switch processes the forwarding of data between the multiple virtual machines and between the multiple virtual machines and external devices connected to the server through the multiple processors, and is used to determine the data queues associated with the multiple processors respectively; wherein the data queues are used to store data to be forwarded, and the processors process the data to be forwarded in the data queues associated with them; the data to be forwarded in the multiple data queues are monitored respectively to determine the load information of the multiple processors; when it is determined that there is an uneven load based on the load information of the multiple processors, the data queues associated with some of the multiple processors are adjusted.
  • the above-mentioned virtual switch 200 is a switch based on software implementation.
  • the virtual switch 200 can be a traditional open source software switch (Open VSwitch, OVS), or it can also be an OVS that supports DPDK (Data Plane Development Kit), namely OVS-DPDK, etc., and this embodiment does not limit this.
  • Open VSwitch Open VSwitch
  • OVS Open VSwitch
  • DPDK Data Plane Development Kit
  • the virtual switch 200 can be implemented by a software architecture in which the control plane 10 and the forwarding plane 20 are separated as shown in Figure 2, wherein the control plane 10 is mainly responsible for the configuration management and data collection functions of the forwarding plane 10, and a load balancing module 110 can be provided on the control plane 10, and the load balancing module 110 is mainly responsible for the load balancing of each processor in the forwarding plane; and the forwarding plane 10 includes multiple processors, which are mainly responsible for data forwarding, processing, etc.
  • the virtual switch 200 provided in this embodiment may include:
  • the forwarding plane 20 is used to monitor the data to be forwarded in each of the multiple data queues and feed back the monitoring result to the control plane;
  • the control plane is also used to determine the load information of the multiple processors based on the monitoring results fed back by the forwarding plane; when it is determined that there is an uneven load based on the load information of the multiple processors, adjust the data queues associated with some of the multiple processors.
  • the virtual switch 200 may include and the functions of each module, please refer to the relevant content in the above embodiments, and no further details will be given here.
  • FIG8 shows a schematic diagram of the structure of a load balancing device provided by an embodiment of the present application.
  • the load balancing device includes: a determination module 31, a monitoring module 33 and an adjustment module 34; wherein,
  • a determination module 31 is used to determine data queues associated with the plurality of processors respectively; wherein the data queues are used to store data to be forwarded, and the processors process the data to be forwarded in the data queues associated with them;
  • a monitoring module 33 configured to monitor the to-be-forwarded processing data in the plurality of data queues respectively, so as to determine the load information of the plurality of processors;
  • the adjustment module 34 is configured to adjust data queues associated with some of the processors when it is determined that there is an uneven load based on the load information of the multiple processors.
  • an association module 32 may be included, which is used to obtain multiple data queues, wherein a virtual machine has at least one virtual network card, and one virtual network card corresponds to at least one data queue; and associated data queues are configured for the multiple processors respectively, so that the number of data queues associated with the multiple processors is balanced, and multiple data queues of the same virtual network card are associated with different processors.
  • the above-mentioned adjustment module 34 when used to adjust the data queues associated with some of the multiple processors when it is determined that there is an uneven load based on the load information of the multiple processors, is specifically used to: determine the first processor and the second processor among the multiple processors according to the load information of the multiple processors; wherein the load of the first processor is the largest and the load of the second processor is the smallest; calculate the load difference between the first processor and the second processor; and when the load difference is greater than a threshold, adjust the data queue associated with the first processor and the data queue associated with the second processor.
  • the first processor is associated with multiple data queues
  • the second processor is associated with multiple data queues
  • the adjustment module 34 when used to adjust the data queues associated with the first processor and the data queues associated with the second processor, is specifically used to: obtain a first load corresponding to each data queue in the multiple data queues associated with the first processor, and a second load corresponding to each data queue in the multiple data queues associated with the second processor; determine a queue adjustment plan based on the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference; and adjust the data queues associated with the first processor and the data queues associated with the second processor according to the queue adjustment plan.
  • the adjustment module 34 when used to determine the queue adjustment scheme according to the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference, is specifically used to: According to the first load corresponding to each data queue in the queue and the load difference, select a data queue from the multiple data queues associated with the first processor as the first target queue; based on the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor, and the load difference, select a data queue from the multiple data queues associated with the first processor as the second target queue, and select a data queue from the multiple data queues associated with the second processor as the third target queue; based on the load corresponding to the first target queue, the load corresponding to the second target queue, and the load corresponding to the third target queue, determine the queue adjustment plan.
  • the above-mentioned adjustment module 34 when used to select a data queue from the multiple data queues associated with the first processor as the first target queue based on the first loads corresponding to each data queue in the multiple data queues associated with the first processor and the load difference, is specifically used to: calculate a first numerical value of the first load corresponding to each data queue in the multiple data queues associated with the first processor relative to the load difference; and select the data queue with the smallest first numerical value among the multiple data queues associated with the first processor as the first target queue.
  • the above-mentioned adjustment module 34 when used to select a data queue from the multiple data queues associated with the first processor as the second target queue and a data queue from the multiple data queues associated with the second processor as the third target queue according to the first load corresponding to each data queue in the multiple data queues associated with the first processor, the second load corresponding to each data queue in the multiple data queues associated with the second processor and the load difference, is specifically used to: calculate the absolute difference between the loads corresponding to two data queues in each queue combination of the multiple queue combinations according to the first load corresponding to each data queue in the multiple data queues associated with the first processor and the second load corresponding to each data queue in the multiple data queues associated with the second processor; wherein any data queue in the multiple data queues associated with the first processor and any data queue in the multiple data queues associated with the second processor constitute a queue combination; calculate a second value of the absolute difference corresponding to each queue combination in the multiple queue combinations relative to the load difference; select the queue combination with the smallest second value as the target combination
  • the above-mentioned adjustment module 34 when used to determine the queue adjustment plan based on the load corresponding to the first target queue, the load corresponding to the second target queue and the load corresponding to the third target queue, is specifically used to: obtain a first numerical value of the load corresponding to the first target queue relative to the load difference; obtain a second numerical value of the absolute difference between the load corresponding to the second target queue and the load corresponding to the third target queue relative to the load difference; compare the first numerical value and the second numerical value; if the first numerical value is less than the second numerical value, adopt a queue migration plan to adjust the first target queue to be associated with the second processor; if the first data is not less than the second numerical value, adopt a queue exchange plan to adjust the second target queue to be associated with the second processor, and adjust the third target queue to be associated with the first processor.
  • the above-mentioned adjustment module 34 when used to obtain the first load corresponding to a data queue among multiple data queues associated with the first processor, is specifically used to: obtain processing information of the first processor processing the data to be forwarded in the data queue; wherein the processing information includes: the number of processed data within a preset time, the receiving time and sending time of the data within the preset time, and the number of processor execution cycles within the preset time; determine the first load corresponding to the data queue based on the processing information.
  • the monitoring module 33 when used to monitor the to-be-forwarded processing data in the plurality of data queues respectively to determine the load information of the plurality of processors, is specifically used to: monitor the to-be-forwarded processing data in the plurality of data queues respectively; Process data to obtain processing information of the processed data to be forwarded in each data queue; based on the processing information of the processed data to be forwarded in each data queue, obtain the processing information of the processed data to be forwarded in each data queue of the multiple data queues associated with the third processor; calculate the load information of the third processor according to the processing information of the processed data to be forwarded in each data queue of the multiple data queues associated with the third processor; wherein the third processor is any processor among the multiple processors.
  • the above-mentioned association module 32 when used to configure associated data queues for the multiple processors respectively, is specifically used to: obtain the number of network cards of multiple virtual network cards, the number of queues of multiple data queues corresponding to each virtual network card, and the number of processors of the multiple processors; determine the virtual network card number N, the data queue number M and the processor number X; associate the data queue number M of the virtual network numbered N with the processor numbered X; update the number X based on the number of processors; increment the number M; if the incremented number M is greater than the number of queues of the virtual network card numbered N, increment the number N; if the incremented number N is greater than the number of network cards, end; if the incremented number N is not greater than the number of network cards, update the virtual network card number N to the incremented number N; if the incremented number M is not greater than the number of queues of the virtual network card numbered N, trigger the execution of the step of associating the data
  • association module 32 when used to update the number X based on the number of processors, it is specifically used to: increment the number X; take the modulus of the incremented number X and the number of processors; and update the number X according to the value obtained by taking the modulus.
  • load balancing device provided in this embodiment can implement the technical solution described in the data load balancing method embodiment shown in Figure 3 above.
  • the specific implementation principles of the above modules or units can refer to the corresponding contents in the data encryption processing method embodiment shown in Figure 3 above, which will not be repeated here.
  • the electronic device includes a memory and a plurality of processors.
  • the memory stores one or more computer instructions.
  • the plurality of processors are respectively coupled to the memory, and are used to call the one or more computer instructions to virtualize a virtual switch and a plurality of virtual machines, and the virtual switch processes the forwarding of data between the plurality of virtual machines and between the plurality of virtual machines and external devices connected to the server through the plurality of processors, and is also used to balance the load of the plurality of processors through the steps in the method provided in the above embodiment.
  • the memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic storage flash memory
  • flash memory magnetic disk or optical disk.
  • the computer program product includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the processor is enabled to implement the steps in the above-mentioned method embodiments.
  • an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a computer, the method steps or functions provided in the above embodiments can be implemented.
  • each implementation method can be implemented by means of software plus a necessary general hardware platform, or of course by hardware.
  • the above technical solution in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, a disk, an optical disk, etc., including several The instructions are used to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请实施例提供一种负载均衡方法、服务器、数据中心网络系统及电子设备。本方案适于具有多个处理器的服务器,服务器上运行有虚拟交换机及多个虚拟机,虚拟交换机通过多个处理器来处理多个虚拟机间及多个虚拟机与服务器连接的外部设备间数据的转发;负载均衡方法包括:确定多个处理器分别关联的数据队列,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测多个数据队列中的待转发数据,以确定多个处理器的负载信息;基于多个处理器的负载信息确定存在负载不均时,对多个处理器中部分处理器关联的数据队列进行调整。本方案可动态的保证虚拟交换机内各处理器的负载均衡,且方案整体实现简单、计算量小。

Description

负载均衡方法、服务器、数据中心网络系统及电子设备
本申请要求于2022年09月27日提交中国专利局、申请号为202211185779.X、申请名称为“负载均衡方法、服务器、数据中心网络系统及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种负载均衡方法、服务器、数据中心网络系统及电子设备。
背景技术
目前,虚拟化技术在各领域都具有广泛应用。利用虚拟化技术可在物理设备上虚拟化出多台虚拟机以使网络虚拟化,而虚拟交换机是在物理设备中实现网络虚拟化的关键组件,可起到连接物理网络和虚拟机的作用,承载了虚拟机的数据转发、处理等工作。
在虚拟化网络中,虚拟机通过自身内在的虚拟网卡与虚拟交换机实现连接,虚拟交换机常会使用多个处理器来处理虚拟机的网络数据。一般地,不同虚拟机配置有不同数量的虚拟网卡,且在虚拟网卡支持多数据队列的情况下,不同虚拟网卡内维护的数据队列数量也将不同,不同的数据队列对应的收发数据量也可能不同。现有技术下,会因流量负载不均导致单个处理器负载过大的情况,这样极易造成网络丢包、延时、抖动等问题。
发明内容
鉴于上述问题,本申请提供一种解决上述问题或至少部分地解决上述问题的负载均衡方法、服务器、数据中心网络系统及电子设备。
在本申请的一个实施例中,提供了一种负载均衡方法。该负载均衡方法适用于具有多个处理器的服务器,所述服务器上运行有虚拟交换机及多个虚拟机,所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发;其中,所述方法包括:
确定所述多个处理器分别关联的数据队列;其中,数据队列中存放有待转发的数据,处理器处理与其关联的数据队列中的待转发数据;
分别监测所述多个数据队列中的待转发处理数据,以确定所述多个处理器的负载信息;
基于所述多个数据处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
在本申请的另一实施例中,提供了一种服务器。所述服务器包括多个处理器,所述服务器上运行有虚拟交换机及多个虚拟机;
所述虚拟交换机,通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
在本申请的又一实施例中,提供了一种数据中心网络系统。该系统包括网络连接的多个服务器;其中,
所述服务器包括多个处理器,所述服务器上运行有虚拟交换机及多个虚拟机;
所述虚拟交换机,通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
在本申请的又一个实施例中,提供了一种电子设备。所述电子设备包括存储器及多个处理器;其中,
所述存储器,存储一条或多条计算机指令;
多个处理器,分别与所述存储器耦合,用于调用所述一条或多条计算机指令,以虚拟出虚拟交换机及多个虚拟机,且所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,还用于通过上述本申请一实施例提供的负载均衡方法中的步骤均衡所述多个处理器的负载。
本申请各实施例提供的技术方案,分别监测多个数据队列中的待转发处理数据以确定多个处理器的负载信息,基于多个数据处理器的负载信息确定存在负载不均时,通过对多个处理器中部分处理器关联的数据队列进行调整,即动态的保证虚拟交换机内各处理器的负载均衡,且本申请提供的整个方案实现简单、计算量较少,这有助于在各处理器间存在负载不均时,提高对多个处理器中部分处理器关联的数据队列的调整效率。
进一步的,本申请各实施例提供的技术方案,在确定出虚拟机中虚拟网卡对应的多个数据队列的基础上,先分别为多个处理器配置关联的数据队列,使得多个处理器关联的数据队列数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联,采用这种关联配置方式,可在初始阶段便为各处理器提供了静态上的负载均衡。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要利用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1a示出了一种虚拟网络中虚拟交换机和虚拟机通信连接的原理性示意图;
图1b示出了另一种虚拟网络中虚拟交换机和虚拟机通信连接的原理性示意图;
图2示出了本申请提供的虚拟交换机的软件架构;
图3示出了一种本申请一实施例提供的负载均衡方法的流程示意图;
图4示出了本申请一实施例提供为多个处理器配置关联的数据队列的原理性示意图;
图5示出了本申请一实施例提供为多个处理器配置关联的数据队列的流程示意图;
图6a示出了本申请一实施例提供调整部分处理器关联的数据队列的原理性示意图;
图6b示出了本申请一实施例提供调整部分处理器关联的数据队列的流程示意图;
图7a示出了本申请一实施例提供的队列互换方案的场景示意图;
图7b示出了本申请一实施例提供的队列迁移方案对应的场景示意图;
图8示出了本申请另一实施例提供的负载均衡装置的结构示意图。
具体实施方式
随着云计算数据中心技术的发展,作为云计算中的一项重要技术的虚拟化技术得到广泛应用。利用虚拟化技术可在物理设备上虚拟化出多个虚拟机(Virtual Machine,VM)以使网络虚拟化,使得物理设备上的计算资源得到充分利用。虚拟机(VM)指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。在实体计算机中能够完成的工作在虚拟机中都能够实现。在计算机中创建虚拟机时,需要将实体机的部分硬盘和内存容量作为虚拟机的硬盘和内存容量。每个虚拟机可以像使用实体机一样对虚拟机进行操作。虚拟机之间,虚拟机与外部网络间通信依靠虚拟交换机。
通常一个虚拟机有一个或多个虚拟网卡。对于物理服务器内部的虚拟机来说,虚拟网卡一般都会桥接在物理服务器上的虚拟网桥或虚拟交换机之上,所以他们之间的互相通信可以不经过物理网卡直接通过虚拟的网络二层设备进行通信。但是虚拟机同外界的交互则必须要经过物理网卡。
在云计算环境下,对计算资源进行了切分,服务器上运行的是一个个虚拟机,虚拟机也要有网卡实现互连互通,但虚拟机的网卡不是物理的,它通过虚拟网卡连接到虚拟交换机上,虚拟交换机对同一个服务器上的虚拟机之间流量进行转发,如果虚拟交换机再连接到服务器的硬件网卡,那么虚拟机就可以和服务器外面通信了。
虚拟网卡是CPU模拟出来的,虚拟网卡具有一个或多个数据队列(或收发队列),数据队列也是模拟出来的,就是服务器上的一块内存。
在网络虚拟化场景中,虚拟交换机(Virural Switch,VS)是在物理设备中实现网络虚拟化的关键组件,其可以为虚拟网卡和物理网卡提供数据转发、处理(如差错校验、地址映射维护)等服务,使得虚拟网络内的各虚拟机或虚拟机与虚拟网络外的 外部设备(如外部PC(Personal Computer,个人计算机)间可建立通信连接,实现数据传输。其中,每个虚拟机均具有自己的虚拟网卡,外部设备具有自己的物理网卡,虚拟机和外部设备分别通过各自相应的虚拟网卡、物理网卡连接于虚拟交换机。虚拟交换机是利用虚拟交换机技术把两个物理上连接在一起的交换机结合在一起,对外呈现出的是一个逻辑上的,虚拟出的交换机。具体地,如图1a所示,虚拟机VM1、VM2和VW3和外部设备(图中未示出)是通过各自相应的虚拟网卡连接到虚拟交换机VS通过物理网卡与外部设备通信。根据实际使用需求,虚拟机上可配置有一个或两个以上的虚拟网卡。通常情况下,一个虚拟网卡有一个数据队列以用于缓存数据,也就是说,虚拟网卡收到的所有数据都是从此一个数据队列进入的,然后虚拟交换机使用一个处理器(如CPU(Central Processing Unit,中央处理器)来从这个数据队列中取数据进行处理,如果取数据不及时,则会存在丢包情况。虚拟交换机使用一个处理器处理一个数据队列的数据不及时的情况称为中断,一旦数据流量特别大,虚拟网卡使用一个数据队列缓存数据易造成数据阻塞,且对于处理器来说也将具有很高的负载,存在性能瓶颈。针对上述虚拟网卡具有单数据队列存在的问题,网卡(如虚拟网卡)开发了多队列功能,网卡多队列即指的是一个网卡可具有多个数据队列,收到数据后可根据数据携带的五元组信息进行哈希(hash)以缓存入多个数据队列中的一个数据队列,且网卡内的多个数据队列中各数据队列通过中断绑定到不同的处理器,以解决网络数据流量升高时单CPU的处理瓶颈,提升网络PPS(Packet Per Second,每秒传输的数据包数量)和带宽性能。基于此,在上述如图1a示出的虚拟网卡支持多队列功能的情况下,相应地,虚拟交换机可使用多个处理器来处理多个虚拟机之间以及虚拟机与外部设备间的数据转发。不过,考虑到不同虚拟网卡因性能存有差异各自内维持的数据队列数量也将不同,进一步地不同的数据队列对应的数据量也可能不同,这可能会导致虚拟交换机的多个处理器间出现数据处理负载不均,造成如图1b示出的某一个或两个处理器负载过大(如处理器n,负载90%),这样会引发网络丢包、延时、抖动等的问题。为了提高虚拟交换机的工作稳定性及数据处理质量,如何将虚拟机的虚拟网卡的数据分配至虚拟交换机的多个处理器进行处理以保证各处理器的负载均衡,是一项急需解决的技术问题。
为了保证虚拟交换机中的各处理器的负载均衡,本申请各实施例提供了一种负载均衡技术方案。为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
在本申请的说明书、权利要求书及上述附图中描述的一些流程中,包含了按照特定顺序出现的多个操作,这些操作可以不按照其在本文中出现的顺序来执行或并行执行。操作的序号如101、102等,仅仅是用于区分各个不同的操作,序号本身不代表任何的执行顺序。另外,这些流程可以包括更多或更少的操作,并且这些操作可以按顺序执行或并行执行。需要说明的是,本文中的“第一”、“第二”等描述,是用于区分不同的消息、设备、模块等,不代表先后顺序,也不限定“第一”和“第二”是不同的类型。而本申请中术语“或/和”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如:A或/和B,表示可以单独存在A,同时存在A和B,单独存在B这三种情况;本申请中字符“/”,一般表示前后关联对象是一种“或”关系。 还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。此外,下述的各实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
在介绍本申请各实施例提供的负载均衡方法实施例之前,先对为实现本申请提供的方法所需要结合的虚拟交换机进行简要说明。
实现本申请提供的方法所需结合的虚拟交换机为如图1b示出的虚拟交换机(VS)200,VS是基于软件实现的一种交换机。具体地,VS可以是传统的开源软件交换机(Open VSwitch,OVS),或者也可以是支持DPDK(Data Plane Development Kit,数据平面开发套件)的一种OVS,即OVS-DPDK,等等,本申请实施例对此不作限定。具体实施时,如图1b所示,VS上可连接有多个虚拟机(Virtual Machine,VM)100,且具有多个处理器(如处理器1~处理器n)。其中,VM是通过软件在物理设备上模拟出的计算机系统的仿真器,具有完整硬件系统功能、且运行在一个完全隔离环境中,能够提供物理计算机的功能。需说明的是,本申请实施例中VS上所连接的VM是具有至少一个虚拟网卡的,且虚拟网卡可支持多队列功能,即虚拟网卡对应有至少一个数据队列用于放入待转发数据。图1b中并未示出虚拟网卡所对应有的多个数据队列。
上述图1b中,VS的软件架构具体形式可以是如图2示出的采用控制面10和转发面20分离的软件架构实现,即VS主要包括控制面10和转发面20两大功能模块;其中,
转发面20,用于通过多个处理器处理多个数据队列中的待转发数据,其中,一个处理器处理与其关联的至少一个数据队列中的待转发数据,处理器可以为但不限于CPU、GPU等。
控制面10,其上设置有负载均衡模块110,用于确定多个数据队列,并分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列数量均衡、且同一虚拟网卡对应的多个数据队列与不同的处理器关联。比如,q11即为CPU0所配置的关联的数据队列。
进一步地,所述转发面20,用于监测所述多个数据队列的各数据队列中的的待转发处理数据,并向所述控制面10反馈监测结果。
所述控制面10,还用于基于所述转发面20反馈的监测结果,确定所述多个处理器的负载信息;并基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
具体实施时,上述控制面10上除了设置有负载均衡模块110外,还可设置有配置管理模块120和数据采集模块130,控制面10上的负载均衡模块110在确定多个数据队列后,可以是通过配置管理模块120来分别为多个处理器配置关联的数据队列的。而控制面10在接收转发面20针对多个数据队列中的各数据队列中的待转发处理数据所反馈的监测结果时,则可以通过数据采集模块120来完成,从而实现基于转发面10 反馈的监测结果确定多个处理器的负载信息。此外,控制面10在基于多个处理器的负载信息确定存在负载不均时,在对多个处理器中部分处理器关联的数据队列进行调整后,还可以将调整结果发送至配置管理模块110,以使配置管理模块110更新自身内存储的处理器与数据队列之间的关联信息,从而便于按照更新后的处理器与数据队列的关联信息,对处理器与数据队列之间的关联进行管理,等等。
有关上述图2示出的虚拟交换机软件架构中各模块和/或各单元功能的具体实现,可参见下文相关内容,此处不作具体赘述。
图3示出了本申请一实施例提供的负载均衡方法的流程示意图。该负载均衡方法适用于如图1b示出的具有多个处理器的服务器(或称为多核服务器)。所述服务器上运行有虚拟交换机及多个虚拟机,所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发。虚拟交换机(VS)是基于软件实现的一种交换机,例如,VS可采用如图2示出的控制面10和转发面20分离的软件架构实现。其中,控制面10上设置有负载均衡模块110。有关VS的具体软件架构描述可参见上文相关内容。即本申请实施例提供的负载均衡方法为虚拟交换机内的控制面10对应软件程序实现的方法。参见图3所示,所述负载均衡方法包括如下步骤:
101、所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;
102、分别监测所述多个数据队列中的待转发处理数据,以确定所述多个处理器的负载信息;
103、基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
上述101中,数据队列指的是虚拟机中的虚拟网卡内用于存放待转发数据的队列。在本实施例中,一个虚拟机内具有至少一个虚拟网卡,且每个虚拟网卡可支持多队列功能。也就是说,每个虚拟网卡内可具有的数据队列的数量大于或等于1。具体实施时,虚拟网卡具有的数据队列的数量是由虚拟网卡驱动提供的用于指定虚拟网卡的硬件队列个数的参数决定的,比如,该参数指定的虚拟网卡内可具有的数据队列数量可以为2个、4个、8个等,此处不作限定。需说明的是:上述参数决定的是一个虚拟网卡内可具有的数据队列的最大数量,并非表明一个虚拟网卡内当前所激活的数据队列的数量。一个虚拟网卡内当前所激活的数据队列的数量,是与此虚拟网卡相对应的虚拟网卡驱动在加载时,通过获取该虚拟网卡的型号以得到该虚拟网卡具有的数据队列的最大数量,并结合该虚拟网卡所连接的虚拟交换机的处理器的数量,最终通过如下公式:Sum=Min(虚拟网卡具有的数据队列的最大数量,虚拟交换机内的处理器的数量),来得出所要激活的该虚拟网卡的数据队列数量(Sum),从而按照所得出的所要激活的数据队列数量来对虚拟网卡内的数据队列进行激活,实现利用所激活的数据队列来放入待转发数据。
例如,参见图1b所示的虚拟网络,多个虚拟机(如VM1、VM2、VM3)通过自身内的至少一个虚拟网卡与虚拟交换机(即VS)上提供的相应虚拟端口(图中未示出)连接,以此实现连接于虚拟交换机上。该虚拟交换机具有4个处理器(即CPU0~CPU4), 假设VM1具有一个虚拟网卡1,且该虚拟网卡1支持的数据队列的最大数量为2,小于虚拟交换机具有的处理器数量(即4)),则在VM1对应的虚拟网卡驱动加载时,则便会激活虚拟网卡1上的2个数据队列(图1b中未示出,具体可参见图4),以使得虚拟网卡1利用该激活的2个数据队列进行存放的待转发处理数据。同理,也可以得到如VM2和VM3等其他虚拟机内的虚拟网卡各自激活的数据队列的数量。
基于上述内容,上述101中所确定出的数据队列,具体指的是虚拟机中的虚拟网卡内用于放入待转发数据的处于激活状态的队列。进一步地,在确定多个数据队列时,是针对虚拟交换机上所连接的所有虚拟机进行确定的,也就是说,多个数据队列可来自于同一虚拟机内的同一虚拟网卡或不同虚拟网卡,或者也可来自于不同虚拟机内的不同虚拟网卡,等等,此处不作限定。例如,参见图4所示,针对虚拟交换机VS上连接的所有虚拟机(即VM1、VM2、VM3),确定出的多个数据队列包括q11~q12、q21~q24、q31~q32、q41~q44,便来自于不同虚拟机内的不同虚拟网卡,具体地:q11和q12均来自于VM1的虚拟网卡1;q21~q24、q31及q32均来自于VM2内的虚拟网卡,其中,q21~q24来自于VM2内的虚拟网卡2、q31和q32来自于VM2内的虚拟网卡3;q41~q144均来自于VM3的虚拟网卡4。
进一步的,在针对虚拟交换机上连接的多个虚拟机对应的多个虚拟网卡,确定出多个数据队列后,可根据设置的预配置负载均衡机制,分别为多个处理器配置关联的数据队列。为了保证在初始化阶段各处理器间具有相对较好的负载均衡性,本实施例在为各处理器配置关联的数据队列时,会充分考虑各虚拟网卡的数据队列的队列数量,以为各处理器配置相同数量的数据队列、且同时保证同一虚拟网卡的多个数据队列是与不同的处理器关联的。具体配置时,可在获取到多个虚拟网卡的网卡数量、各虚拟网卡对应的多个数据队列的队列数量及多个处理器的处理器数量的基础上,按照各虚拟网卡的编号、各虚拟网卡内的各数据队列的数据队列编号以及各处理器的编号,顺序性的依次将各虚拟网卡内的各数据队列配置给不同的处理器。基于此,在一具体可实现技术方案中,本实施例提供的所述方法中步骤101“确定多个处理器分别关联的数据队列”,可包括如下步骤:
1011、获取多个数据队列,其中,一个虚拟机具有至少一个虚拟网卡,一个虚拟网卡对应有至少一个数据队列;
1012、分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联。
上述1012“分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列的数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联”,可具体包括:
10121、获取多个虚拟网卡的网卡数量、各虚拟网卡对应的多个数据队列的队列数量及所述多个处理器的处理器数量;
10122、确定虚拟网卡编号N、数据队列编号M及处理器编号X;
10123、将编号N的虚拟网卡的的编号M的数据队列与编号X的处理器关联;
10124、基于所述处理器数量,更新所述编号X;
10125、递增编号M;
10126、若递增后的编号M大于编号N的虚拟网卡的队列数量,则递增编号N;若递增后的编号N大于所述网卡数量,则结束;若递增后的编号N不大于所述网卡数量,则将所述虚拟网卡编号N更新为递增后的编号N;
10127、若递增后的编号M不大于编号N的虚拟网卡的队列数量,则按照递增后的编号M及更新后的编号X,触发执行将编号N的虚拟网卡的编号M的数据队列与编号X的处理器关联的步骤。
上述步骤10121中,为了便于区分不同的虚拟网卡、数据队列及处理器,多个虚拟网卡中各虚拟网卡、各虚拟网卡对应的多个数据队列中各数据队列以及多个处理器中各处理器是均具有相应的编号的,且多个虚拟网卡中各虚拟网卡间的网卡编号、各虚拟网卡对应的多个数据队列中各数据队列的数据队列编号、以及多个处理器中各处理器的处理器编号,均可采用但不限于以自然数递增方式进行编号的,比如,多个处理器的处理器数量为4,则该4个处理器对应的编号可分别为0、1、2、3,这样便于后续根据虚拟网卡编号、数据队列编号及处理器编号,执行上述步骤10122~10127,从而实现为各处理器配置关联的数据队列。其中,在执行上述步骤1022~1027过程中,对于步骤10124“基于所述处理器数量,更新所述编号X”的一种可实现技术方案为:
S1、递增所述编号X;
S2、递增后的所述编号X与所述处理器数量取余;
S3、根据取余得到的数值,更新所述编号X。
有关上述S1~S3的具体实现,可参见下文相关示例,此处就不再作具体赘述。
上述步骤10121~10127所描述的过程,即为上述所述的本实施例设置的预配置负载均衡机制,该预配置负载均衡机制可事先预置于如图2示出的控制面内设置的配置管理模块中,以便控制面在初始化阶段可控制配置管理模块按照该预置的预配置负载均衡机制,将各虚拟网卡的数据队列关联至各处理器,且使得各处理器关联的数据队列的数量均衡、同时保证同一虚拟网卡内的多个数据队列关联至不同的处理器。
图5示出了与上述步骤10121~10127相对应的为各处理器配置关联的数据队列的流程示意图。下面结合图5和图4,举一示例来具体描述一下为各处理器配置关联的数据队列的过程。具体地,
参见图4及图5所示,假设VS内具有的处理器指的是CPU,且CPU的数量为4个,用X表示CPU对应的CPU编号,则X的取值可以为0、1、2、3。VS上连接VM1、VM2和VM3这三个虚拟机,具体地,VM1、VM2和VM3分别是通过虚拟网卡1、虚拟网卡2和虚拟网卡3、以及虚拟网卡4连接于VS上的,也就是说,VS上连接有4个虚拟网卡,设用N表示虚拟网卡对应的虚拟网卡编号,则N的取值可以为1、2、3、4。进一步地,设用M表示数据队列对应的数据队列编号,假设虚拟网卡编号1的虚拟网卡1内激活有2个数据队列(即q11和q12),则相对应地,M的取值可以为1和2;虚拟网卡编号2的虚拟网卡3内激活有4个数据队列(即q21~q24),则相对应地,M的取值可以为1、2、3、4;虚拟网卡编号3的虚拟网卡3内激活有2个数据队列(即q31和q32),则相对应地,M的取值可以为1和2;虚拟网卡编号4的虚拟网卡4内激活有4个数据队列(即q41~q44),则相对应地,M的取值可以为1、2、3、4。
假设,当前确定出的虚拟网卡编号N的取值为1、数据队列编号M为1及处理器编号X为0,则结合5及图4所示,是从虚拟网卡1~虚拟网卡4这4个虚拟网卡中取出虚拟网卡编号为1的虚拟网卡1内的数据队列编号为1的数据队列q11,来与CPU编号0的CPU0关联。之后,可递增处理器编号X以使X由0递增为1,并利用递增后的编号X对处理器数量取余(即mod(1,4))可得到数值1,此时根据该数值1也就可将编号X由0更新为1。进一步地,还会递增编号M以使编号M由1递增为2,此时递增后的编号M为2是不大于编号1的虚拟网卡的队列数量(即2)的,为此结合图5及图4也就是按照递增后的编号M(即2)及更新后的编号X(即1),触发执行将编号1的虚拟网卡的编号2的数据队列q12与编号1的处理器(即CPU1)关联。
再进一步地,将数据队列q12与CPU1关联后,按照上述所描述的更新方式,会再次执行更新编号X及递增编号M,此时编号X会由1更新为2,编号M会由2递增为3,递增后的编号M为3大于编号1的虚拟网卡的队列数量(即2),说明已完成了将编号1的虚拟网卡内的数据队列关联至相应的CPU上,此时可将编号M重置为初始值(如1),同时递增编号N以使编号N由1递增为2,此时递增后的编号N为2不大于虚拟网卡数量(即4),说明还存有虚拟网卡内的数据队列还未被进行关联至相应的CPU上,故会执行将虚拟网卡编号N更新为递增后的编号N,即虚拟网卡编号N由1被更新为2,然后再按照该更新后的虚拟网卡编号N,按照上述描述的将编号1的虚拟网卡1内的数据队列关联至相应CPU上的方式,将编号2的虚拟网卡2内的各数据队列进行与相应CPU关联,比如图4中示出的将编号2的虚拟网卡内的数据队列q21、数据队列q22、数据队列q23及数据队列q24,分别与CPU2、CPU3、CPU0、CPU1关联。
再进一步地,完成将编号2的虚拟网卡内的各数据队列进行与相应CPU关联后,会继续按照上述方式将编号3的虚拟网卡3内的二个数据队列进行与相应CPU关联,比如图4中示出的将编号3的虚拟网卡内的数据队列q31和数据队列q32,分别与CPU2、CPU3关联。之后,会递增编号N以使得编号N由3递增为4(不大于虚拟网卡数量),继续按照上述方式将如图4中示出的编号4的虚拟网卡4内的4个数据队列进行与相应CPU关联。再之后,递增编号N以使得编号N由4递增为5,此时递增后的编号M为5大于网络数量(即4),说明已将4个虚拟网卡内的数据队列全部关联至相应CPU上,为此也就便可执行结束操作。
最终,按照上述步骤10121~10127或图5示出的与上述步骤10121~10127相对应的流程示意图,将图4中示出的与VS连接的4个虚拟网卡内的各数据队列关联至相应VS的CPU上的结果,可参见图4中示出的用“箭头”指示出的CPU与数据队列的关联关系。由图4可看出,VS内的各处理器关联的数据队列的数量均相同、且每个虚拟网卡内的不同数据队列分别与不同的处理器关联,这可使得在初始化阶段即能够为虚拟交换机内的各处理器提供较好的负载均衡保障。
基于上文内容,在分别为虚拟交换机内的各处理器配置关联好相应的数据队列后,在由虚拟交换机及虚拟机组成的虚拟网络运行过程中,一个数据进入虚拟机后,该虚拟机内的虚拟网卡会利用诸如哈希算法,对数据头部中携带的源IP地址、目的IP地址、源端口、目的断后、应用协议等组成的五元信息进行计算,以计算出一个散列值, 从而依据该散列值将此数据放入其内的多个数据队列中的一个数据队列;然后,该多个数据队列中的一个数据队列,可通过但不限于如硬件中断(IRQ)方式告知与其关联的处理器其具有到来的新数据需要进行转发、处理,以此使得与其关联的处理器从自身内取数据进行处理。由此可见,处理器是可以根据接收到的硬件中断来实现对其关联的数据队列中的待转发处理数据进行监测的,由于处理器是位于如图2示出的虚拟交换机的转发面的,为此也就是说,转发面能够实现对多个数据队列中的各数据队列中的待转发处理数据的监测,转发面在将监测结果反馈给如图2示出的虚拟交换机的控制面后,控制面也就可根据监测结果确定出多个数据队列中的待转发处理数据,从而获取到各数据队列中的待转发处理数据的处理信息。由于一个数据队列中的待转发处理数据是需交由其所关联的处理器进行转发、处理的,为此,进一步地基于获取到的各数据队列中的待转发处理数据的处理信息,也就能够获取到多个处理器中的任一个处理器关联的多个数据队列中的各数据队列的处理器信息,从而实现计算出多个处理器中的任一个处理器的负载信息,以此也就能够得到多个处理器的负载信息。基于上述内容,在一具体可实现技术方案中,上述102“分别监测所述多个数据队列中的待转发处理器数据,以确定所述多个处理器的负载信息”,可具体包括:
1021、分别监测所述多个数据队列中的待转发处理数据,以获得各数据队列中的待转发处理数据的处理信息;
1022、基于所述各数据队列中的待转发处理数据的处理信息,获取第三处理器关联的多个数据队列中各数据队列中的的待转发处理数据的处理信息;其中,所述第三处理器为所述多个处理器中的任一处理器;
1023、根据所述第三处理器关联的多个数据队列中各数据队列的的待转发处理数据的处理信息,计算所述第三处理器的负载信息。
上述1021中,可以是利用虚拟交换机内的转发面来实现对多个数据队列中的待转发处理数据的间接监测,以此获得各数据队列中的待转发处理数据的处理信息。有关如何利用转发面来检测多个数据队列中的待转发处理数据,可参见上文相关内容。上述中,所获得的各数据队列中的待转发处理数据的处理信息可包括但不限于:数据的数量、数据类型、数据大小、数据的分片大小等等。
上述1022~1023中,在获得各数据队列中的待转发处理数据的处理信息后,由于多个处理器中各处理器是事先配置关联有相关的数据队列的,为此基于各数据队列中的待转发处理数据的处理信息,也就能够获取到多个处理器中的任一处理器(即第三处理器)关联的多个数据队列中各数据队列中的的待转发处理数据的处理信息;进一步地,可根据第三处理器关联的多个数据队列中各数据队列的的待转发处理数据的处理信息,分别计算出第三处理器关联的多个数据队列中各数据队列对应的负载,以此来得到第三处理器的负载信息;其中;第三处理器的负载信息可包含但不限于:第三处理器关联的多个数据队列中各数据队列对应的负载、以及根据第三处理器关联的多个数据队列中各数据队列对应的负载计算出的第三处理器的总负载。
比如,参见图4所示,基于获得的q11~q12、q21~q24、q31~q32以及q41~q44各自中的待转发处理数据的处理信息,也即可获取到CPU0关联的q11、q23和q41这三个数据队列中各数据队列的的待转发处理数据的处理信息。进一步地,基于q11、q23 和q41各自中的的待转发处理数据的处理信息,可分别计算出q11、q23和q41各自对应的负载,如设q11对应的负载为Load_q11、q23对应的负载为Load_q23以及q41对应的负载为Load_q41,则可所得到的CPU0的负载信息可包含:Load_q11+Load_q23+Load_q41、Load_q11、Load_q23、Load_q41;其中,Load_q11+Load_q23+Load_q41为CPU0对应的总负载,Load_q11、Load_q23和Load_q41中可分别携带有各自对应的数据队列(即q11、q23、q41)的标识,此标识可以为但不限于数据队列的编号。按照上述CPU0的负载信息的计算获得方式,同理,也能够计算得到CPU1~CPU2的负载信息。需说明的是,有关根据一个数据队列中的的待转发处理数据的处理信息,计算此数据队列对应的负载,可参见下文相关内容。
基于确定出的多个处理器的负载信息,可分析多个处理器中各处理器的负载情况以确定当前各处理器是否存在负载不均。具体实施时,由于极差值能够反映出一组数据的离散程度,且最能体现出一组数据波动范围的大小,为此可利用极差值法来确定当前各处理器是否存储负载不均;其中,极差值是指一组数据中最大数据与最小数据的差值。并只有在利用极差值法确定出多个处理器中各处理器存在负载不均时,才对多个处理器中部分处理器关联的数据队列进行调整,这样可有效避免无效调整、浪费计算资源等问题的发生。上述中,可在根据多个处理器的负载信息,计算出多个处理器中的具有最小负载的处理器与具有最大负载的处理器间的负载差值大于一设定阈值(如5%)的情况下,认为各处理器间出现负载不均。基于此,在一种可实现技术方案中,上述103“基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整”,可具体包括:
1031、根据所述多个处理器的负载信息,确定所述多个处理器中的第一处理器和第二处理器;其中,所述第一处理器的负载最大,所述第二处理器的负载最小;
1032、计算所述第一处理器和所述第二处理器的负载差值;
1033、在所述负载差值大于阈值的情况时,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
具体实施时,上述阈值可根据实际情况灵活设置,比如,阈值可以为3%、5%、10%等,此处不作限定。若根据多个处理器的负载信息,计算出多个处理器中的具有最小负载的第一处理器与具有最大负载的第二处理器间的负载差值大于阈值(如5%),说明各处理器间的负载波动范围较小,各处理器间具有较小的负载差异,此时可认为各处理器间处于负载均衡状态,无需对个处理器关联的数据队列进行调整;反之,若负载差值大于阈值(如5%),说明各处理器间的负载波动范围较大,各处理器间具有较大的负载差值,此时可认为各处理器间存在负载不均,为此需要对第一处理器关联的数据队列及第二处理器关联的数据队列进行调整,以缩小各处理器间负载的波动范围,使得各处理器间达到负载均衡。
上述中,第一处理器和第二处理器是各自均关联有多个数据队列的,在对第一处理器关联的数据队列及第二处理器关联的数据队列进行调整时,可在获取到第一处理器关联的各数据队列对应的第一负载以及第二处理器关联的各数据队列对应的第二负载的基础上,结合负载差值,确定出适配的队列调整方案,按队列调整方案来调整对第一处理器关联的数据队列及第二处理器关联的数据队列。即,上述1033中的“对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整”,可具体采用如下步骤来实现:
10331、获取所述第一处理器关联的多个数据队列中各数据队列对应的第一负载,以及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载;
10332、根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案;
10333、按照所述队列调整方案,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
在一具体可实现技术方案中,上述10331中的“获取第一处理器关联的多个数据队列中各数据队列的第一负载”,可采用如下具体步骤来实现:
A11、获取所述第一处理器处理所述数据队列中的待转发处理数据的处理信息;其中,所述处理信息包括:预设时间内处理数据的数量、预设时间内数据的接收时间及发送时间、以及预设时间内处理器执行周期的数量;
A12、根据所述处理信息,确定所述数据队列对应的第一负载。
具体实施时,上述预设时间可根据实际情况灵活设置,比如,预设时间可以为但不限于30秒、1分钟、2分钟等。基于上述A11~A12步骤中的内容,设获取到的第一处理器处理数据队列中的待转发处理数据的处理信息包含的预设时间为T、在预设时间内处理数据的数量为S(S大于1)、数量S个的数据中第w个数据的接收时间为tw1及发送时间为tw2、以及预设时间T内处理器执行周期的数量为ncycle,则根据处理信息,可采用如下表达式来计算此数据队列对应的第一负载Load:
同理,在本实施例中,对于上述10431中的“获取第二处理器关联的多个数据队列中各数据队列对应的第二负载”的具体实现,可参见上述所描述的“获取第一处理器关联的多个数据队列中各数据队列的第一负载”的具体实现方式,此处不再作具体赘述。
上述所描述的数据队列对应的负载确定方式,是直接通过处理器的执行周期这个指标来进行量化,以此替代常规的PPS、带宽等衡量方式,这种方式在衡量处理器资源消耗上,会具有更高的精确性。
上述10332中,为了实现能够以较小的计算量,来分别从第一处理器关联的多个数据队列以及第二处理器关联的多个数据队列中选择出相应的目标队列,以基于目标队列来对第一处理器关联的数据队列和第二处理器关联的数据队列进行调整,实现使各处理器间达到负载均衡,本实施例是通过分析第一处理器关联的多个数据队列中各数据队列对应的第一负载及经由上述步骤1042计算得到的第一处理器和第二处理器的负载差值,来从第一处理器关联的多个数据队列中选择一个数据队列作为一个目标队列,以及通过分析第处理器关联的多个数据队列中各数据队列对应的第一负载信息、第二处理器关联的多个数据队列中各数据队列对应的第二负载信息以及负载差值,来分别从第一处理器关联的多个数据队列中选定一个数据队列作为另一个目标队列,从 第二处理器关联的多个数据队列中选定一个数据队列作为又一个目标队列。从而基于上述确定出的三个目标队列对应的负载来确定队列调整方案的。即,上述10432“根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案”,具体可采用如下步骤来实现:
A21、基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列;
A22、基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列;
A23、基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列对应的负载,确定队列调整方案。
上述A21中,可基于第一处理器关联的多个数据队列中各数据队列对应的第一负载及负载差值,采用差值分析法来从第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列。具体地,上述A21“基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列”的一具体可实现方案为:
A211、计算所述第一处理器关联的多个数据队列中各数据队列对应的第一负载相对于所述负载差值的第一数值;
A212、将所述第一处理器关联的多个数据队列中第一数值最小的数据队列,作为所述第一目标队列。
具体实施时,上述第一数值指的是第一处理器关联的多个数据队列中各数据队列对应的第一负载与负载差值间的绝对差值。具体地,设第一处理器关联的多个数据队列中的第j个数据队列对应的第一负载记为Load_q1_j,负载差值记为Δ,则该第一处理器关联的多个数据队列中的第j个数据队列对应的第一数值abs_1,可采用如下公式一计算得到:
公式一:abs_1=|Load_q1_j-Δ/2|
例如,参见图4所示,设第一处理器为CPU1,CPU1关联有q12、q24及q42这三个数据队列,令q12是CPU1关联的q12、q24及q42这三个数据队列中的第1个数据队列,则CPU1关联的q12、q24及q42这三个数据队列中的第1个数据队列对应的第一数值abs_1为:
abs_1==|Load_q1_1-Δ/2|;其中,Load_q1_1指的是q12这个数据队列对应的负载(即Load_q12)。
在计算得到第一处理器关联的多个数据队列中各数据队列对应的第一数值后,第一处理器关联的多个数据队列中对应第一数值最小的数据队列,即为第一目标队列。
上述A22中,可先针对第一处理器关联的多个数据队列及第二处理器关联的多个数据队列进行队列组合,得到包含有两个数据队列(其中一个是关联第一处理器的数据队列,另一个是关联第二处理器的数据队列)的多个队列组合;通过采用差值分析法,在计算出多个队列组合的各队列组合中两个数据队列对应负载的绝对差值基础上,进一步地计算出多个队列组合中各队列组合对应的绝对差值相对于负载差值的第二数值,以此选择第二数值最小的队列组合作为目标组合,从而依据目标组合中的两个数据队列来确定出第二目标队列和第三目标队列。即,上述A22“基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列”的一种具体实现方案为:
A221、根据所述第一处理器关联的多个数据队列中各数据队列对应的的第一负载及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载,计算多个队列组合的各队列组合中两个数据队列对应负载的绝对差值;其中,所述第一处理器关联的多个数据队列中的任一数据队列与所述第二处理器关联的多个数据队列中的任一数据队列构成一个队列组合;
A222、计算所述多个队列组合中各队列组合对应的绝对差值相对于所述负载差值的第二数值;
A223、选取所述第二数值最小的队列组合作为目标组合;
A224、将所述目标组合中的关联所述第一处理器的数据队列作为所述第二目标队列,关联所述第二处理器的数据队列作为所述第三目标队列。
具体实施时,同第一数值,上述第二数值指的是多个队列组合中各队列组合对应的绝对差值相对于负载差值的绝对差值。基于上述步骤A221~A222中的描述内容,设一个队列组合是由第一处理器关联的多个数据队列中的第j个数据队列q1_j与第二处理器关联的多个数据队列中的第y个数据队列q1_y构成的,则该队列组合对应的第二数值abs_2可采用如下示出的公式二计算得到:
公式二:abs_2=||Load_q1_j-Load_q1_y|-Δ/2|
在基于上述公式二,计算得到多个队列组合中各队列组合对应的绝对差值相对于负载差值的第二数值后,多个队列组合中对应第二数值最小的队列组合即认为是目标组合,此时该目标组合中的关联第一处理器的数据队列便作为第二目标队列,而关联第二处理器的数据队列便作为第三目标队列。
在确定出第一目标队列、第二目标队列及所述第二目标队列后,在一种可实现的技术方案中,上述A23“基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列的负载,确定队列调整方案”,具体可采用如下步骤来实现:
A231、获取所述第一目标队列对应负载相对于所述负载差值的第一数值;
A232、获取所述第二目标队列对应负载与所述第三目标队列对应负载的绝对差值相对于所述负载差值的第二数值;
A233、比较所述第一数值和所述第二数值;
A234、若所述第一数值小于所述第二数值,则采用队列迁移方案,以将所述第一目标队列调整为与所述第二处理器关联;
A235、若所述第一数据不小于所述第二数值,则采用队列互换方案,以将所述第二目标队列调整为与所述第二处理器关联,将所述第三目标队列调整为与所述第一处理器关联。
有关上述步骤A231~A232的具体实现,可参见上文相关内容。
上述步骤A233~A235中,上述队列迁移方案和队列互换方案,可事先预置于如图2示出的控制面上所设置的负载均衡模块内,以便负载均衡模块在通过比较分析第一目标队列对应负载相对于负载差值的第一数值,与第二目标队列对应负载与第三目标队列对应负载的绝对差值相对于负载差值的第二数值间的大小关系,从队列迁移方案和队列互换方案中确定出一个队列调整方案后,从自身内调用出相应的队列调整方案以便后续按照队列调整方案调整第一处理器关联的数据队列及第二处理器关联的数据队列。具体在确定队列调整方案时,可在确定第一数值小于第二数值的情况时,确定采用队列迁移方案以将第一目标队列调整为与第二处理器关联;反之,若在确定第一数值大于等于第二数值的情况时,确定采用队列交换方案以将第二目标队列调整为与第二处理器关联,将第三目标队列调整为与第一处理器关联。
上述10333中,针对经由步骤10332确定出的不同队列调整方案,将采用不同方式来对第一处理器关联的数据队列及第二处理器关联的数据队列进行调整。具体地,若确定出的队列调整方案为队列迁移方案,则是将第一处理器关联的多个数据队列中的与第一目标队列相对应的数据队列调整为与第二处理器关联;而若确定出的队列调整方案为队列交换方案,则是将第一处理器关联的多个数据队列中的与第二目标队列相对应的数据队列调整为与第二处理器关联,并将第二处理器关联的多个数据队列中的与第三目标队列相对应的数据队列调整为与第一处理器关联。
综上内容,本实施例提供的技术方案,在确定出虚拟机中虚拟网卡对应的多个数据队列的基础上,会先分别为多个处理器配置关联的数据队列,使得多个处理器关联的数据队列数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联,采用这种配置关联方式,使得在初始化阶段便为各处理器提供了较好的负载均衡保障。进一步地,还会分别监测多个数据队列中的待转发处理数据以确定多个处理器的负载信息,从而在基于多个数据处理器的负载信息确定存在负载不均时,通过对多个处理器中部分处理器关联的数据队列进行调整,能够有效保证虚拟交换机内各处理器的负载均衡,且本实施例提供的整个方案实现简单、计算量较少,这有助于在各处理器间存在负载不均时,提高对多个处理器中部分处理器关联的数据队列的调整效率。
上述102及103(也即上述步骤1031~1033)所描述的通过监测多个数据队列中的待转发处理数据以确定多个处理器的负载信息,从而在基于多个处理器负载信息确定存在负载不均时,对多个处理器中部分处理器关联的数据队列进行调整的整个实现过程,可简化如为图6a示出的流程示意图,即:控制面在接收到转发面经监测多个数据队列的各数据队列中的的待转发处理器数据所反馈的监测结果后,会基于监测结果来对多个处理器中各处理器的负载均衡进行评估,并在确定存在负载不均衡时,基于策 略确定出相应的队列调整方案;之后,通过执行确定出的队列调整方案来实现对多个处理器中部分处理器关联的数据队列进行调整,以此使得各处理器间负载达到均衡。需说明的是:上述转发面和控制面是设置于虚拟交换机内的;所述的策略即指的是与上文描述与确定队列调整方案相关的内容。
进一步地,上述图6a中示出的各流程步骤的具体实现可参见图6b,即也就是说,图6b示出了与上述103(也即上述步骤1031~1033)相对应的在基于多个处理器的负载信息确定处多个处理器中各处理器间存在负载不均时,对多个处理器中部分处理器关联的数据队列进行调整的流程示意图。下面结合图6b及图4,列举一示例来具体描述一下对多个处理器中部分处理器关联的数据队列进行调整的过程。具体地,
承接上文结合图5及图4列举的一示例,假设图4中示出的CPU0~CPU3这四个CPU各自关联的多个数据队列为:CPU0关联的多个数据队列包含q11、q23和q41、CPU1关联的多个数据队列包含q12、q24和q42、CPU2关联的多个数据队列包含q21、q31和q43以及CPU3关联的多个数据队列包含q22、q32和q44。在经监测q11~q12、q21~q24、q31~q32以及q41~q44各数据队列中的待转发处理数据确定出CPU0~CPU4中各CPU的负载信息后,确定出CPU1的负载最大、CPU2的负载最小,且CPU1和CPU2间的负载差值Δ大于阈值。
参见图7a所示,假设CPU1关联的q12、q24和q42这三个数据队列各自对应的负载分别为:13%、20%、7%,以及CPU2关联的q21、q31和q43这三个数据队列各自对应的负载分别为2%、5%、3%,结合图6b,设基于图7a示出的CPU1关联的q12、q24和q42各自对应的负载、CPU2关联的q21、q31和q43各自对应的负载以及负载差值Δ(即30%),确定出的队列调整方案为队列互换方案,其中,在确定队列互换方案过程中,基于CPU1关联的q12、q24和q42各自对应的负载、CPU2关联的q21、q31和q43各自对应的负载及负载差值Δ,分别从CPU1关联的q12、q24和q42中选定出q24作为第二目标队列、从CPU2关联的q21、q31和q43中选定出q31作为第三目标队列。为此,在对CPU1关联的数据队列和CPU2关联的数据队列进行调整时,是按照队列交换方案,将CPU1关联q24调整为与CPU2关联,将CPU2关联的q31调整为与CPU1关联。
而参见图7b所述,假设CPU1关联的q12、q24和q42这三个数据队列各自对应的负载分别为:5%、10%、15%,以及CPU2关联的q21、q31和q43这三个数据队列各自对应的负载分别为3%、8%、9%,结合图6b,设基于图7b示出的CPU1关联的q12、q24和q42各自对应的负载、CPU2关联的q21、q31和q43各自对应的负载以及负载差值Δ(即10%),确定出的队列调整方案为队列迁移方案,其中,在确定队列调整方案过程中,基于CPU1关联的q12、q24和q42各自对应的负载、CPU2关联的21、q31和q43各自对应的负载及负载差值Δ,从CPU1关联的q12、q24和q42中选定出的是q12作为第一目标队列为q12。为此,在对CPU1关联的数据队列和CPU2关联的数据队列进行调整时,是按照队列迁移方案,将CPU1关联的q12调整为与CPU2关联。
上文主要是从软件角度来描述本申请提供的技术方案的,下面结合设备从硬件角度来描述一下本申请提供的技术方案。具体地,
本申请一实施例提供了一种服务器。参见图1b所示,所述服务器包括多个处理器,所述服务器上运行有虚拟交换机200及多个虚拟机100。所述虚拟交换机200,通过所述多个处理器来处理所述多个虚拟机100间及所述多个虚拟机100与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
本申请一实施例提供了一种数据中心网络系统。该数据中心网络系统包括网络连接的多个服务器。例如图1b所示的多个服务器。该数据中心网络系统中的服务器所述服务器包括多个处理器,所述服务器上运行有虚拟交换机及多个虚拟机;
所述虚拟交换机,通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
有关虚拟机、虚拟机内的虚拟网卡以及虚拟网卡对应的多个数据队列等具体描述,可参见上文各实施例相关内容。
上述虚拟交换机200,是基于软件实现的一种交换机,具体地,虚拟交换机200可以是传统的开源软件交换机(Open VSwitch,OVS),或者也可以是支持DPDK(Data Plane Development Kit,数据平面开发套件)的一种OVS,即OVS-DPDK,等等,本实施例对此不作限定。具体实施时,虚拟交换机200可采用的是如图2示出的控制面10和转发面20分离的软件架构实现的,其中,控制面10主要负责转发面10的配置管理和数据采集等功能,控制面10上可设置有负载均衡模块110,负载均衡模块110主要负责转发面内各处理器的负载均衡;而转发面10则包括多个处理器,主要负责数据的转发、处理等工作。基于此,本实施例提供的虚拟交换机200可包括:
控制面10,其上设置有负载均衡模块110,用于确定多个数据队列,并分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列数量均衡、且同一虚拟网卡对应的多个数据队列与不同的处理器关联;
转发面20,用于监测所述多个数据队列的各数据队列中的的待转发处理数据,并向所述控制面反馈监测结果;
所述控制面,还用于基于所述转发面反馈的监测结果,确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
有关对虚拟交换机200可包括的具体功能模块以及各模块功能的具体介绍,可参见上文各实施例中相关的内容,此处不再作具体赘述。
综上,本申请实施例提供的技术方案具有以下几点有益效果:
1、为多个处理器配置关联的数据队列时,充分考虑了每个处理器所处理的数据队列 的数量、以及常态情况下同一个虚拟网卡内的不同数据队列对应的数据流量大小等因素,使得在初始化阶段即能够保障各处理器间具有较好的负载均衡性。
2,在完成处理器关联的数据队列配置后,在运行阶段,考虑了既使在每个处理器对应处理的数据队列的数量相等情况下,由于数据队列对应的实时数量流量大小、数量流量类型等存在差异,也会导致各处理器间出现负载不均,为此采用了一种通过监测各数据队列中的待转发处理数据来评估各处理器间的负载均衡性、从而确定出相应的队列调整方案,通过执行队列调整方案来保证各处理器间的负载均衡;其中,在确定队列调整方案过程中,在选择需调整的目标队列时,采用的是一种轻量级方式,计算量较小。
3、在计算数据队列的负载时,是直接通过处理器的执行周期这个指标来进行量化,以此替代常规的PPS、带宽等衡量方式,这种方式在衡量处理器资源消耗上,精确性更高。
图8示出了本申请一实施例提供的负载均衡装置的结构示意图。如图8所示,该负载均衡装置包括:确定模块31、监测模块33以及调整模块34;其中,
确定模块31,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;
监测模块33,用于分别监测所述多个数据队列中的待转发处理数据,以确定所述多个处理器的负载信息;
调整模块34,用于基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
进一步的,如图8所示,还可包括关联模块32,该关联模块32用于获取多个数据队列,其中,一个虚拟机具有至少一个虚拟网卡,一个虚拟网卡对应有至少一个数据队列;分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联。
进一步地,上述调整模块34,在用于基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整时,具体用于:根据所述多个处理器的负载信息,确定所述多个处理器中的第一处理器和第二处理器;其中,所述第一处理器的负载最大,所述第二处理器的负载最小;计算所述第一处理器和所述第二处理器的负载差值;在所述负载差值大于阈值的情况时,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
进一步地,上述第一处理器关联有多个数据队列,上述第二处理器关联有多个数据队列;以及,上述调整模块34,在用于对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整时,具体用于:获取所述第一处理器关联的多个数据队列中各数据队列对应的第一负载,以及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载;根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案;按照所述队列调整方案,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
进一步地,上述调整模块34,在用于根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案时,具体用于:基于所述第一处理器关联的多个数 据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列;基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列;基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列对应的负载,确定队列调整方案。
进一步地,上述调整模块34,在用于根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列时,具体用于:计算所述第一处理器关联的多个数据队列中各数据队列对应的第一负载相对于所述负载差值的第一数值;将所述第一处理器关联的多个数据队列中第一数值最小的数据队列,作为所述第一目标队列。
进一步地,上述调整模块34,在用于根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列时,具体用于:根据所述第一处理器关联的多个数据队列中各数据队列对应的的第一负载及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载,计算多个队列组合的各队列组合中两个数据队列对应负载的绝对差值;其中,所述第一处理器关联的多个数据队列中的任一数据队列与所述第二处理器关联的多个数据队列中的任一数据队列构成一个队列组合;计算所述多个队列组合中各队列组合对应的绝对差值相对于所述负载差值的第二数值;选取所述第二数值最小的队列组合作为目标组合;将所述目标组合中的关联所述第一处理器的数据队列作为所述第二目标队列,关联所述第二处理器的数据队列作为所述第三目标队列。
进一步地,上述调整模块34,在用于基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列对应的负载,确定队列调整方案时,具体用于:获取所述第一目标队列对应负载相对于所述负载差值的第一数值;获取所述第二目标队列对应负载与所述第三目标队列对应负载的绝对差值相对于所述负载差值的第二数值;比较所述第一数值和所述第二数值;若所述第一数值小于所述第二数值,则采用队列迁移方案,以将所述第一目标队列调整为与所述第二处理器关联;若所述第一数据不小于所述第二数值,则采用队列互换方案,以将所述第二目标队列调整为与所述第二处理器关联,将所述第三目标队列调整为与所述第一处理器关联。
进一步地,进一步地,上述调整模块34,在用于获取所述第一处理器关联的多个数据队列中一个数据队列对应的第一负载时,具体用于:获取所述第一处理器处理所述数据队列中的待转发处理数据的处理信息;其中,所述处理信息包括:预设时间内处理数据的数量、预设时间内数据的接收时间及发送时间、以及预设时间内处理器执行周期的数量;根据所述处理信息,确定所述数据队列对应的第一负载。
进一步地,上述监测模块33,在用于分别监测所述多个数据队列中的待转发处理数据,以确定所述多个处理器的负载信息时,具体用于:分别监测所述多个数据队列中的待转发 处理数据,以获得各数据队列中的待转发处理数据的处理信息;基于所述各数据队列中的待转发处理数据的处理信息,获取第三处理器关联的多个数据队列中各数据队列中的的待转发处理数据的处理信息;根据所述第三处理器关联的多个数据队列中各数据队列的的待转发处理数据的处理信息,计算所述第三处理器的负载信息;其中,所述第三处理器为所述多个处理器中的任一处理器。
进一步地,上述关联模块32,在用于分别为所述多个处理器配置关联的数据队列时,具体用于:获取多个虚拟网卡的网卡数量、各虚拟网卡对应的多个数据队列的队列数量及所述多个处理器的处理器数量;确定虚拟网卡编号N、数据队列编号M及处理器编号X;将编号N的虚拟网络的编号M的数据队列与编号X的处理器关联;基于所述处理器数量,更新所述编号X;递增编号M;若递增后的编号M大于编号N的虚拟网卡的队列数量,则递增编号N;若递增后的编号N大于所述网卡数量,则结束;若递增后的编号N不大于所述网卡数量,则将所述虚拟网卡编号N更新为递增后的编号N;若递增后的编号M不大于编号N的虚拟网卡的队列数量,则按照递增后的编号M及更新后的编号X,触发执行将编号N的虚拟网卡的编号M的数据队列与编号X的处理器关联的步骤。
进一步地,上述关联模块32,在用于基于所述处理器数量,更新所述编号X时,具体用于:递增所述编号X;递增后的所述编号X与所述处理器数量取余;根据取余得到的数值,更新所述编号X。
这里需要说明的是:本实施例提供的负载均衡装置可实现上述图3示出的数负载均衡方法实施例中描述的技术方案,上述各模块或单元具体实现的原理可参见上述图3示出的数据加密处理方法实施例中的相应内容,此处不再赘述。
本申请一实施例提供的电子设备的原理性结构示意图。该原理性结构示意图类似于图1b所示。具体地,所述电子设备包括存储器和多个处理器。所述存储器存储一条或多条计算机指令。所述多个处理器,分别与所述存储器耦合,用于调用所述一条或多条计算机指令,以虚拟出虚拟交换机及多个虚拟机,且所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,还用于通过上述实施例提供的所述方法中的步骤均衡所述多个处理器的负载。
上述中,存储器可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
本申请还有一实施例提供一种计算机程序产品(说明书附图中无相应附图示出)。该计算机程序产品包括计算机程序或指令,当所述计算机程序或指令被处理器执行时,致使所述处理器能够实现上述各方法实施例中的步骤。
相应地,本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,所述计算机程序被计算机执行时能够实现上述各实施例提供的方法步骤或功能。
通过以上实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干 指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (13)

  1. 一种负载均衡方法,其特征在于,适用于具有多个处理器的服务器,所述服务器上运行有虚拟交换机及多个虚拟机,所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发;其中,所述方法包括:
    确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;
    分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;
    基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
  2. 根据权利要求1所述的方法,其特征在于,确定多个处理器分别关联的数据队列,包括:
    获取多个数据队列,其中,一个虚拟机具有至少一个虚拟网卡,一个虚拟网卡对应有至少一个数据队列;
    分别为所述多个处理器配置关联的数据队列,使得所述多个处理器关联的数据队列数量均衡、且同一虚拟网卡的多个数据队列与不同的处理器关联。
  3. 根据权利要求1所述的方法,其特征在于,基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整,包括:
    根据所述多个处理器的负载信息,确定所述多个处理器中的第一处理器和第二处理器;其中,所述第一处理器的负载符合预设第一要求,所述第二处理器的负载符合预设第二要求;
    计算所述第一处理器和所述第二处理器的负载差值;
    所述负载差值大于阈值时,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
  4. 根据权利要求3所述的方法,其特征在于,所述第一处理器关联有多个数据队列,所述第二处理器关联有多个数据队列;以及
    对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整,包括:
    获取所述第一处理器关联的多个数据队列中各数据队列对应的第一负载,以及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载;
    根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案;
    按照所述队列调整方案,对所述第一处理器关联的数据队列及所述第二处理器关联的数据队列进行调整。
  5. 根据权利要求4所述的方法,其特征在于,根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,确定队列调整方案,包括:
    基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列;
    基于所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列;
    基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列对应的负载,确定队列调整方案。
  6. 根据权利要求5所述的方法,其特征在于,根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述负载差值,从所述第一处理器关联的多个数据队列中选定一个数据队列作为第一目标队列,包括:
    计算所述第一处理器关联的多个数据队列中各数据队列对应的第一负载相对于所述负载差值的第一数值;
    将所述第一处理器关联的多个数据队列中第一数值最小的数据队列,作为所述第一目标队列。
  7. 根据权利要求5所述的方法,其特征在于,根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载、所述第二处理器关联的多个数据队列中各数据队列对应的第二负载及所述负载差值,分别从所述第一处理器关联的多个数据队列中选定一个数据队列作为第二目标队列,从所述第二处理器关联的多个数据队列中选定一个数据队列作为第三目标队列,包括:
    根据所述第一处理器关联的多个数据队列中各数据队列对应的第一负载及所述第二处理器关联的多个数据队列中各数据队列对应的第二负载,计算多个队列组合的各队列组合中两个数据队列对应负载的绝对差值;其中,所述第一处理器关联的多个数据队列中的任一数据队列与所述第二处理器关联的多个数据队列中的任一数据队列构成一个队列组合;
    计算所述多个队列组合中各队列组合对应的绝对差值相对于所述负载差值的第二数值;
    选取所述第二数值最小的队列组合作为目标组合;
    将所述目标组合中的关联所述第一处理器的数据队列作为所述第二目标队列,关联所述第二处理器的数据队列作为所述第三目标队列。
  8. 根据权利要求5所述的方法,其特征在于,基于所述第一目标队列对应的负载、所述第二目标队列对应的负载及所述第三目标队列对应的负载,确定队列调整方案,包括:
    获取所述第一目标队列对应负载相对于所述负载差值的第一数值;
    获取所述第二目标队列对应负载与所述第三目标队列对应负载的绝对差值相对于所述负载差值的第二数值;
    比较所述第一数值和所述第二数值;
    若所述第一数值小于所述第二数值,则采用队列迁移方案,以将所述第一目标队 列调整为与所述第二处理器关联;
    若所述第一数据不小于所述第二数值,则采用队列互换方案,以将所述第二目标队列调整为与所述第二处理器关联,将所述第三目标队列调整为与所述第一处理器关联。
  9. 根据权利要求2至8中任一项所述的方法,其特征在于,分别为所述多个处理器配置关联的数据队列,包括:
    获取多个虚拟网卡的网卡数量、各虚拟网卡对应的多个数据队列的队列数量及所述多个处理器的处理器数量;
    确定虚拟网卡编号N、数据队列编号M及处理器编号X;
    将编号N的虚拟网络的编号M的数据队列与编号X的处理器关联;
    基于所述处理器数量,更新所述编号X;
    递增编号M;
    若递增后的编号M大于编号N的虚拟网卡的队列数量,则递增编号N;若递增后的编号N大于所述网卡数量,则结束;若递增后的编号N不大于所述网卡数量,则将所述虚拟网卡编号N更新为递增后的编号N;
    若递增后的编号M不大于编号N的虚拟网卡的队列数量,则按照递增后的编号M及更新后的编号X,触发执行将编号N的虚拟网卡的编号M的数据队列与编号X的处理器关联的步骤。
  10. 根据权利要求9所述的方法,其特征在于,基于所述处理器数量,更新所述编号X,包括:
    递增所述编号X;
    递增后的所述编号X与所述处理器数量取余;
    根据取余得到的数值,更新所述编号X。
  11. 一种服务器,其特征在于,所述服务器包括多个处理器,所述服务器上运行有虚拟交换机及多个虚拟机;
    所述虚拟交换机,通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处理器中部分处理器关联的数据队列进行调整。
  12. 一种数据中心网络系统,其特征在于,包括网络连接的多个服务器;其中,
    所述服务器包括多个处理器,所述服务器上运行有虚拟交换机及多个虚拟机;
    所述虚拟交换机,通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,用于确定所述多个处理器分别关联的数据队列;其中,数据队列用于存放待转发的数据,处理器处理与其关联的数据队列中的待转发数据;分别监测所述多个数据队列中的待转发数据,以确定所述多个处理器的负载信息;基于所述多个处理器的负载信息确定存在负载不均时,对所述多个处 理器中部分处理器关联的数据队列进行调整。
  13. 一种电子设备,其特征在于,包括:存储器及多个处理器,其中,
    所述存储器,存储一条或多条计算机指令;
    多个处理器,分别与所述存储器耦合,用于调用所述一条或多条计算机指令,以虚拟出虚拟交换机及多个虚拟机,且所述虚拟交换机通过所述多个处理器来处理所述多个虚拟机间及所述多个虚拟机与所述服务器连接的外部设备间数据的转发,还用于通过上述权利要求1至10中任一项所述方法中的步骤均衡所述多个处理器的负载。
PCT/CN2023/121262 2022-09-27 2023-09-25 负载均衡方法、服务器、数据中心网络系统及电子设备 WO2024067525A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211185779.X 2022-09-27
CN202211185779.XA CN115509748A (zh) 2022-09-27 2022-09-27 负载均衡方法、服务器、数据中心网络系统及电子设备

Publications (1)

Publication Number Publication Date
WO2024067525A1 true WO2024067525A1 (zh) 2024-04-04

Family

ID=84505984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/121262 WO2024067525A1 (zh) 2022-09-27 2023-09-25 负载均衡方法、服务器、数据中心网络系统及电子设备

Country Status (2)

Country Link
CN (1) CN115509748A (zh)
WO (1) WO2024067525A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115509748A (zh) * 2022-09-27 2022-12-23 阿里云计算有限公司 负载均衡方法、服务器、数据中心网络系统及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170185435A1 (en) * 2015-12-24 2017-06-29 Prashant Dewan Fast switching between virtual machines without interrupt virtualization for high-performance, secure trusted-execution enviornment
CN108984271A (zh) * 2018-07-20 2018-12-11 浪潮电子信息产业股份有限公司 一种均衡负载的方法以及相关设备
CN114020417A (zh) * 2021-11-17 2022-02-08 山东乾云启创信息科技股份有限公司 一种虚拟负载均衡系统及其工作方法
CN114553780A (zh) * 2020-11-11 2022-05-27 北京华为数字技术有限公司 负载均衡的方法、装置以及网卡
CN115509748A (zh) * 2022-09-27 2022-12-23 阿里云计算有限公司 负载均衡方法、服务器、数据中心网络系统及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170185435A1 (en) * 2015-12-24 2017-06-29 Prashant Dewan Fast switching between virtual machines without interrupt virtualization for high-performance, secure trusted-execution enviornment
CN108984271A (zh) * 2018-07-20 2018-12-11 浪潮电子信息产业股份有限公司 一种均衡负载的方法以及相关设备
CN114553780A (zh) * 2020-11-11 2022-05-27 北京华为数字技术有限公司 负载均衡的方法、装置以及网卡
CN114020417A (zh) * 2021-11-17 2022-02-08 山东乾云启创信息科技股份有限公司 一种虚拟负载均衡系统及其工作方法
CN115509748A (zh) * 2022-09-27 2022-12-23 阿里云计算有限公司 负载均衡方法、服务器、数据中心网络系统及电子设备

Also Published As

Publication number Publication date
CN115509748A (zh) 2022-12-23

Similar Documents

Publication Publication Date Title
US11593138B2 (en) Server offload card with SoC and FPGA
Zhuo et al. Slim:{OS} Kernel Support for a {Low-Overhead} Container Overlay Network
US9712538B1 (en) Secure packet management for bare metal access
CN111817961B (zh) Overlay网络中基于Open vSwitch内核态流表的分布式路由方法及装置
US8335237B1 (en) Streamlined guest networking in a virtualized environment
US8566822B2 (en) Method and system for distributing hypervisor functionality over multiple physical devices in a network and configuring sub-hypervisor to control the virtual machines
US9686078B1 (en) Firmware validation from an external channel
JP2023530064A (ja) スイッチ管理したリソース割り当ておよびソフトウェア実行
WO2024067525A1 (zh) 负载均衡方法、服务器、数据中心网络系统及电子设备
WO2009068461A1 (en) Virtualised receive side scaling
US20220166666A1 (en) Data plane operation in a packet processing device
CA3167334C (en) Zero packet loss upgrade of an io device
US20150156057A1 (en) Executable-Based Platform Selection
US20120198542A1 (en) Shared Security Device
WO2022060490A1 (en) Mechanism to automatically prioritize i/o for nfv workloads at platform overload
Fukai et al. Live migration in bare-metal clouds
WO2023121768A1 (en) Switch for managing service meshes
Bansal et al. Disaggregating stateful network functions
CN114008979B (zh) 具有隔离虚拟网络集成的无服务器分组处理服务
US20220166718A1 (en) Systems and methods to prevent packet reordering when establishing a flow entry
Bolla et al. OpenFlow in the small: A flexible and efficient network acceleration framework for multi-core systems
Das et al. Memory management in activermt: Towards runtime-programmable switches
Cha et al. Analysis of Linux Kernel packet processing on manycore systems
Yang et al. Isolation guarantee for efficient virtualized network i/o on cloud platform
US20240119020A1 (en) Driver to provide configurable accesses to a device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23870754

Country of ref document: EP

Kind code of ref document: A1