Virtual machine scheduling method, device, equipment and storage medium
By determining the target host and storage in the host cluster and storage cluster of multiple data centers, the problem of cross-data center virtual machine scheduling is solved, resource utilization and load balancing are improved, and the user experience is improved.
Patent Information
- Application Number
- CN202111345073.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2041-11-12
AI Technical Summary
Existing virtual machine scheduling methods only support scheduling within the same data center and cannot schedule virtual machines across data centers, resulting in poor user experience, low resource utilization and unbalanced load.
By obtaining the performance tags and performance parameters of the virtual machine, the target host and target storage are determined in the host cluster and storage cluster of multiple data centers respectively, thus realizing cross-data center virtual machine scheduling.
It improves user experience, enhances resource utilization and load balancing across multiple data centers, and provides more efficient and high-quality services.
Smart Images

Figure CN114185643B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of virtualization technology, and more specifically, to a virtual machine scheduling method, apparatus, device, and storage medium. Background Art
[0002] With the rapid development of virtualization technology, virtualization technology has been widely used in data centers. Using virtualization technology, one or more virtual machines can be created on the physical hosts in the host cluster included in the data center. These virtual machines can be used to access the actual hardware resources. In other words, virtualization technology is used to virtualize the hardware resources of the data center to form a huge virtual resource pool, which is then provided to users in a dynamic service manner. Currently, many public cloud services and private cloud technologies support batch creation of virtual machines and self-scheduling, such as Alibaba Cloud and OpenStack.
[0003] However, since the current virtual machine scheduling only supports the scheduling of virtual machines in the same data center and cannot schedule virtual machines across data centers, in an enterprise environment with multiple data centers, users are required to specify a data center when applying to create virtual machines in batches, and virtual machine scheduling is only performed in the specified data center. However, in general, users only set the central processing unit (CPU), memory, and disk, and do not care about the deployment details of the virtual machine, and cannot accurately specify the data center. Therefore, in the current virtual machine scheduling solution, on the one hand, the user experience is poor because users are required to specify data centers that they do not care about. On the other hand, the inability to accurately specify data centers may not only cause low resource utilization in multiple data centers, but also affect load balancing.
[0004] Based on this, there is an urgent need in this field for a virtual machine scheduling method to solve how to automatically schedule virtual machines in multiple data centers, thereby facilitating improving resource utilization and achieving load balancing. Summary of the Invention
[0005] The embodiments of the present application provide a virtual machine scheduling method, apparatus, device, and storage medium that can schedule virtual machines across data centers, which not only improves the user experience but also helps to improve resource utilization and achieve load balancing in multiple data centers.
[0006] In a first aspect, an embodiment of the present application provides a virtual machine scheduling method, comprising:
[0007] Obtain a scheduling request, where the scheduling request is used to request that the i-th virtual machine among N virtual machines be scheduled to a target host corresponding to the i-th virtual machine and that the disk capacity of the i-th virtual machine be scheduled to a target storage associated with the target host. The scheduling request includes a performance tag and performance parameters of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N.
[0008] Based on the performance tag of the i-th virtual machine, determining a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multiple data centers;
[0009] Based on the performance parameters of the i-th virtual machine, the target host and the target storage are determined in the second host cluster and the second storage cluster respectively.
[0010] In a second aspect, a virtual machine scheduling device is provided, comprising:
[0011] an acquiring unit, configured to acquire a scheduling request, the scheduling request being used to request that an i-th virtual machine among N virtual machines be scheduled to a target host corresponding to the i-th virtual machine and that a disk capacity of the i-th virtual machine be scheduled to a target storage associated with the target host, the scheduling request including a performance tag of the i-th virtual machine and a performance parameter of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N;
[0012] A first determining unit is configured to determine, based on the performance tag of the i-th virtual machine, a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center;
[0013] The second determining unit is configured to determine, based on the performance parameters of the i-th virtual machine, a target host corresponding to the i-th virtual machine and a target storage corresponding to the i-th virtual machine in the second host cluster and the second storage cluster respectively.
[0014] According to a third aspect, an electronic device is provided, including:
[0015] a processor adapted to execute a computer program;
[0016] A computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method of the first aspect is implemented.
[0017] In a fourth aspect, a computer-readable storage medium is provided, characterized in that it is used to store a computer program, which enables a computer to execute the method of the first aspect.
[0018] In a fifth aspect, a computer program product is provided, comprising a computer program / instruction, characterized in that the computer program / instruction implements the method of the first aspect when executed by a processor.
[0019] Based on the above technical solution, based on the performance tag of the i-th virtual machine, the second host cluster and the second storage cluster are respectively determined in the first host cluster and the first storage cluster included in the multiple data centers. This is equivalent to using the performance tag of the i-th virtual machine to preliminarily determine the second host cluster and the second storage cluster that meet the performance tag in the multiple data centers. On the one hand, it avoids the user specifying the data center when creating the virtual machine, thereby improving the user experience; on the other hand, it avoids screening only the host clusters and storage clusters that meet the conditions in the user-specified data center. By using the performance tag, the first host cluster and the first storage cluster across data centers are preliminarily screened, paving the way for subsequent cross-data center scheduling of virtual machines. Then, based on the performance parameters of the i-th virtual machine, the target host and target storage are determined in the second host cluster and the second storage cluster respectively. This is equivalent to using the performance parameters of the i-th virtual machine to further determine the target host and target storage that meet the performance parameters in the second host cluster and the second storage cluster, thereby screening out the target host and target storage that meet both the performance label and the performance parameters for the i-th virtual machine from multiple data centers. In addition, since cross-data center scheduling of virtual machines is supported, when batches of virtual machines are created, the batches of virtual machines are scheduled to the target hosts and target storage across data centers, which is not only beneficial to improving resource utilization in multiple data centers, but also beneficial to ensuring load balancing in multiple data centers.
[0020] In addition, scheduling virtual machines in multiple data centers allows multiple data centers to collaborate with each other and share the load of user applications. Compared with deploying virtual machines in isolated data centers, scheduling virtual machines in multiple data centers can provide users with more efficient and high-quality services.
[0021] In short, by using the performance label and performance parameters of the i-th virtual machine, the target host corresponding to the i-th virtual machine and the target storage associated with the target host are determined layer by layer in the first host cluster and the first storage cluster included in the multi-data center. On the one hand, there is no need for the user to specify the data center, which improves the user experience; on the other hand, cross-data center scheduling of virtual machines in multiple data centers is realized, which is not only conducive to improving the resource utilization of multiple data centers, but also conducive to achieving load balancing in multiple data centers. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a schematic flowchart of the virtual machine scheduling method provided in an embodiment of the present application.
[0023] Figure 2 This is another schematic flowchart of the virtual machine scheduling method provided in an embodiment of the present application.
[0024] Figure 3 It is a schematic block diagram of a virtual machine scheduling device provided in an embodiment of the present application.
[0025] Figure 4 It is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0027] For example, the virtual machine scheduling solution provided in this application may involve artificial intelligence technology.
[0028] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0029] It should be understood that artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0030] The virtual machine scheduling solution provided in this application may involve cloud computing, distributed storage, etc. in artificial intelligence technologies.
[0031] Cloud computing refers to the delivery and usage model of IT infrastructure, which means obtaining required resources through the network in an on-demand, scalable manner. In a broader sense, cloud computing refers to the delivery and usage model of services, which means obtaining required services through the network in an on-demand, scalable manner. These services can be IT-related, software-related, internet-related, or other services. Cloud computing is the product of the integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing. Virtualization is the technical cornerstone of building a cloud computing environment, and virtual machine scheduling technology, in particular, is the fundamental means to ensure the implementation of cloud computing technology at the infrastructure level.
[0032] It's important to note that virtualization is a broad term. In computing, it generally refers to computing components running on a virtual rather than real basis. Virtualization technology can expand hardware capacity and simplify software reconfiguration. CPU virtualization technology can simulate multiple CPUs in parallel on a single CPU, allowing a single platform to run multiple operating systems simultaneously. Applications can run in independent spaces without interfering with each other, significantly improving computer efficiency.
[0033] The following is an introduction to the data center and distributed storage involved in this application.
[0034] A data center is a specialized network of multiple devices used to transmit, accelerate, display, compute, and store data on a network infrastructure. In other words, a data center utilizes existing internet communication lines and bandwidth resources to create a standardized, professional-grade computer room environment, offering businesses and governments a full range of services including server hosting, leasing, and related value-added services. Data centers provide the infrastructure for data operations and maintenance, and offer services related to the centralized collection, storage, processing, and transmission of data.
[0035] With the continuous development of the Internet and communication technologies, enterprises' data processing and storage tend to be large-scale, flexible and energy-efficient. Data centers have also expanded from basic hosting, bandwidth leasing and other businesses to new technologies (cloud computing, edge computing, etc.) to network security services, maintenance services, virtual data storage and computing and other comprehensive businesses. With the advent of the 5G era, the division of labor in the industry has become clearer. At this stage, large-scale, modular ultra-large data centers and small-scale edge data centers will be deployed simultaneously to form multi-data centers, which will be used to provide enterprises with more efficient data processing and storage. It should be understood that a multi-data center is a collection of multiple data centers, and these multiple data centers can be connected through a content delivery network (CDN).
[0036] As more and more data is generated in the information interconnection, the demand for data storage and data processing will also increase. Distributed storage architecture has come into being. Distributed storage architecture and data center complement each other, that is, multiple low-cost servers are used to solve the problem of Web access in large-scale, high-concurrency scenarios. It adopts a scalable system structure, uses multiple storage servers to share the storage load, and uses location servers to locate storage information. This not only improves the reliability, availability and access efficiency of the system, but also facilitates the subsequent server expansion. In addition, as servers are continuously added, distributed storage under multiple data centers can achieve automatic load balancing at the software level, so that the system's processing capacity can be linearly expanded. It should be understood that the multiple computer devices in the multiple data centers constitute a host cluster, and the multiple storage servers in the distributed storage architecture constitute a storage cluster.
[0037] The virtual machine scheduling method provided in the embodiment of the present application will be described in detail below.
[0038] Figure 1 It is a schematic flow chart of the virtual machine scheduling method 100 provided in an embodiment of the present application.
[0039] It should be noted that the solution provided in the embodiment of the present application can be executed by a scheduling system, and the scheduling tasks in the scheduling system can be executed by any electronic device with data processing capabilities. For example, the electronic device can be implemented as a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms. The server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here. For ease of explanation, the virtual machine scheduling method provided in this application is described in detail below, taking the scheduling system as an example.
[0040] It should be noted that the scheduling system can schedule multiple virtual machines to one host, that is, one host can run multiple virtual machines; it can also schedule multiple virtual machines to different hosts.
[0041] like Figure 1 As shown, the method 100 may include some or all of the following:
[0042] S101: Obtain a scheduling request, where the scheduling request is used to request that an i-th virtual machine among N virtual machines be scheduled to a target host corresponding to the i-th virtual machine and that the disk capacity of the i-th virtual machine be scheduled to a target storage associated with the target host. The scheduling request includes a performance tag of the i-th virtual machine and performance parameters of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N.
[0043] It should be understood that the disk capacity of the i-th virtual machine is the size of the disk mounted to the i-th virtual machine.
[0044] It should be noted that the performance tag of the i-th virtual machine is used to represent the computing power and storage capacity of the i-th virtual machine. The performance parameters of the i-th virtual machine are parameters configured to support the computing power and storage capacity of the i-th virtual machine. It should be noted that the performance tag and performance parameters of the i-th virtual machine are configured by the scheduling system before receiving the scheduling request.
[0045] S102, based on the performance tag of the i-th virtual machine, determining a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center;
[0046] It should be noted that the second host cluster includes the target host, the second storage cluster includes the target storage, and the target storage is the storage in the storage cluster associated with the target host.
[0047] It should be noted that the storage in the first storage cluster may be local storage on a host in the first host cluster, or may be distributed storage, and this application does not impose any specific restrictions on this.
[0048] S103 : Based on the performance parameters of the i th virtual machine, determine a target host corresponding to the i th virtual machine and a target storage corresponding to the i th virtual machine in the second host cluster and the second storage cluster respectively.
[0049] Exemplarily, the scheduling system can be integrated in an independent server. After obtaining the scheduling request, the server determines the second host cluster and the second storage cluster in the first host cluster and the first storage cluster included in the multiple data centers based on the performance tag of the i-th virtual machine in the scheduling request. Then, based on the performance parameters of the i-th virtual machine, the server determines the target host corresponding to the i-th virtual machine and the target storage associated with the target host in the second host cluster and the second storage cluster, respectively, to pave the way for scheduling the i-th virtual machine to the target host corresponding to the i-th virtual machine and scheduling the disk capacity of the i-th virtual machine to the target storage.
[0050] Based on the above technical solution, based on the performance tag of the i-th virtual machine, the second host cluster and the second storage cluster are respectively determined in the first host cluster and the first storage cluster included in the multiple data centers. This is equivalent to using the performance tag of the i-th virtual machine to preliminarily determine the second host cluster and the second storage cluster that meet the performance tag in the multiple data centers. On the one hand, it avoids the user specifying the data center when creating the virtual machine, thereby improving the user experience; on the other hand, it avoids screening only the host clusters and storage clusters that meet the conditions in the user-specified data center. By using the performance tag, the first host cluster and the first storage cluster across data centers are preliminarily screened, paving the way for subsequent cross-data center scheduling of virtual machines. Then, based on the performance parameters of the i-th virtual machine, the target host and target storage are determined in the second host cluster and the second storage cluster respectively. This is equivalent to using the performance parameters of the i-th virtual machine to further determine the target host and target storage that meet the performance parameters in the second host cluster and the second storage cluster, thereby screening out the target host and target storage that meet both the performance label and the performance parameters for the i-th virtual machine from multiple data centers. In addition, since cross-data center scheduling of virtual machines is supported, when batches of virtual machines are created, the batches of virtual machines are scheduled to the target hosts and target storage across data centers, which is not only beneficial to improving resource utilization in multiple data centers, but also beneficial to ensuring load balancing in multiple data centers.
[0051] In addition, scheduling virtual machines in multiple data centers allows multiple data centers to collaborate with each other and share the load of user applications. Compared with deploying virtual machines in isolated data centers, scheduling virtual machines in multiple data centers can provide users with more efficient and high-quality services.
[0052] In short, by using the performance label and performance parameters of the i-th virtual machine, the target host corresponding to the i-th virtual machine and the target storage associated with the target host are determined layer by layer in the first host cluster and the first storage cluster included in the multi-data center. On the one hand, there is no need for the user to specify the data center, which improves the user experience; on the other hand, cross-data center scheduling of virtual machines in multiple data centers is realized, which is not only conducive to improving the resource utilization of multiple data centers, but also conducive to achieving load balancing in multiple data centers.
[0053] In some embodiments of the present application, S102 may include:
[0054] Based on the performance tag of the i-th virtual machine, determining a third host cluster and a third storage cluster in the first host cluster and the first storage cluster respectively;
[0055] The second host cluster and the second storage cluster are determined based on association relationships between hosts in the third host cluster and storage in the third storage cluster.
[0056] In other words, in the first host cluster and the first storage cluster, based on the performance tag of the i-th virtual machine, a third host cluster and a third storage cluster that meet the performance tag of the i-th virtual machine are determined. Since the hosts in the third host cluster and the storage in the third storage cluster may be unrelated, the second host cluster and the second storage cluster are further determined based on the association relationship between the hosts in the third host cluster and the storage in the third storage cluster.
[0057] Through the association relationship between the performance tag of the i-th virtual machine and the hosts in the third host cluster and the storage in the third storage cluster, not only can it be guaranteed that the hosts in the second host cluster and the storage in the second storage cluster meet the host and storage requirements of the performance tag of the i-th virtual machine, but it can also be guaranteed that the hosts in the second host cluster and the storage in the second storage cluster are not isolated hosts or isolated storage, and any host in the second host cluster has associated storage in the second storage cluster.
[0058] In some embodiments of the present application, the third host cluster and the third storage cluster may be determined in the following manner:
[0059] Determine a host in the first host cluster having the same CPU performance label as the CPU performance label of the i-th virtual machine as a host in the third host cluster;
[0060] The storage in the first storage cluster having the same storage performance label as the storage performance label of the i-th virtual machine is determined as the storage in the third storage cluster.
[0061] It should be understood that the third host cluster is a subset of the first host cluster, and the third storage cluster is a subset of the first storage cluster.
[0062] It should be noted that the CPU performance may include high CPU performance, low CPU performance, etc.; the storage performance may include high-performance storage, shared storage, local storage, etc.;
[0063] In some embodiments of the present application, the second host cluster and the second storage cluster may be determined in the following manner:
[0064] Determine a first host in the third host cluster that has an association relationship with storage in the third storage cluster as a host in the second host cluster;
[0065] The storage associated with the first host in the third storage cluster is determined as the storage in the second storage cluster.
[0066] In other words, the hosts and storages associated with each other in the third host cluster and the third storage cluster are respectively determined to be the hosts in the second host cluster and the storages in the second storage cluster.
[0067] It should be understood that the second host cluster is a subset of the third host cluster, and the second storage cluster is a subset of the third storage cluster.
[0068] Through the association relationship between the hosts in the third host cluster and the storage in the third storage cluster, the hosts and storage that are isolated from each other in the third host cluster and the third storage cluster are filtered out, ensuring that any host in the remaining second host cluster is associated with at least one storage segment in the second storage cluster.
[0069] In some embodiments of the present application, S103 may include:
[0070] Based on the performance parameters of the i-th virtual machine, determining a fourth host cluster and a fourth storage cluster in the second host cluster and the second storage cluster respectively;
[0071] Determining a candidate host cluster and a candidate storage cluster based on associations between hosts in the fourth host cluster and storages in the fourth storage cluster;
[0072] Based on the scoring algorithm, the target host and the target storage are determined in the candidate host cluster and the candidate storage cluster, respectively.
[0073] In other words, first, based on the performance parameters of the i-th virtual machine, a fourth host cluster and a fourth storage cluster that meet the performance parameters are screened out from the second host cluster and the second storage cluster; secondly, based on the association relationship between the hosts in the fourth host cluster and the storage in the fourth storage cluster, the isolated hosts and storage in the fourth host cluster and the fourth storage cluster are filtered out, and associated candidate host clusters and candidate storage clusters are screened out, that is, for any candidate host in the candidate host cluster, there is at least one candidate storage in the candidate storage cluster that is associated with the any candidate host; finally, based on the scoring algorithm, the target host and the target storage are determined in the candidate host cluster and the candidate storage cluster, respectively.
[0074] It should be understood that the fourth host cluster is a subset of the second host cluster, and the fourth storage cluster is a subset of the second storage cluster; the candidate host cluster is a subset of the fourth host cluster, and the candidate storage cluster is a subset of the fourth storage cluster; the candidate host cluster includes the target host, and the candidate storage cluster includes the target storage.
[0075] In some embodiments of the present application, the performance parameters include the number of CPU cores, memory capacity, and disk capacity;
[0076] Based on this, the fourth host cluster and the fourth storage cluster can be determined as follows:
[0077] Based on the number of CPU cores and memory capacity of the i-th virtual machine, determine a host in the second host cluster that meets a target condition as a host in the fourth host cluster, where the target condition is that the remaining number of CPU cores and the remaining memory capacity are respectively greater than or equal to the number of CPU cores and the memory capacity of the i-th virtual machine, where the remaining number of CPU cores includes the number of CPU cores remaining in any host in the second host cluster after the CPU cores are allocated to the i-1-th virtual machine, and the remaining memory capacity includes the memory capacity remaining in any host in the second host cluster after the memory capacity is allocated to the i-1-th virtual machine;
[0078] Based on the disk capacity of the i-th virtual machine, the storage in the second storage cluster whose remaining storage capacity is greater than or equal to the disk capacity is determined as the storage in the fourth storage cluster, where the remaining storage capacity includes the storage capacity remaining in any storage in the second storage cluster after allocating storage capacity to the i-1-th virtual machine.
[0079] In other words, in the second host cluster, the hosts that satisfy the requirement that the remaining number of CPU cores and the remaining memory capacity are respectively greater than or equal to the number of CPU cores and the memory capacity of the i-th virtual machine are determined as hosts in the fourth host cluster, which is equivalent to further screening the hosts in the second host cluster through the number of CPU cores and memory capacity of the i-th virtual machine; in the second storage set cluster, the storage that satisfies the requirement that the remaining storage capacity is greater than or equal to the disk capacity is determined as storage in the fourth storage cluster, which is equivalent to further screening the storage in the second storage cluster through the disk capacity of the i-th virtual machine.
[0080] It should be noted that based on the number of CPU cores, CPUs can be divided into single-core CPUs, dual-core CPUs, and multi-core CPUs.
[0081] In some embodiments of the present application, the scoring algorithm includes a host scoring algorithm and a storage scoring algorithm;
[0082] Based on this, the target host and target storage can be determined as follows:
[0083] Determine scores for all candidate hosts in the candidate host cluster based on the host scoring algorithm;
[0084] Determine the target host based on the scores of all candidate hosts;
[0085] Determine scores of all candidate storages associated with the target host in the candidate storage cluster based on the storage scoring algorithm;
[0086] The target storage is determined based on the scores of all candidate storages.
[0087] In one implementation, the host with the highest score among all candidate hosts is determined as the target host.
[0088] In another implementation, the score of each candidate host among all the candidate hosts is used as a weight, and weighted random processing is performed on all the candidate hosts to obtain the target host.
[0089] By using the score of each candidate host as a weight, performing weighted random processing on all candidate hosts and selecting the target host for deployment among all candidate hosts, it is possible to effectively avoid excessive pressure on a single host and facilitate load balancing of the hosts.
[0090] In one implementation, the storage with the highest score among all candidate storages is determined as the target storage.
[0091] In another implementation, the score of each candidate storage among all the candidate storages is used as a weight, and weighted random processing is performed on all the candidate storages to obtain the target storage.
[0092] By using the score of each candidate storage as a weight, performing weighted random processing on all candidate storages, and selecting the target storage deployment from all candidate storages, it is possible to effectively avoid excessive pressure on a certain storage segment and facilitate storage load balancing.
[0093] It should be noted that the candidate host score is used to represent the likelihood of determining the candidate host as the target host in multiple virtual machine scheduling. It should be noted that the candidate storage score is used to represent the likelihood of determining the candidate storage associated with the target host as the target storage in multiple virtual machine scheduling.
[0094] In some embodiments of the present application, the candidate host cluster includes M candidate hosts, where M is a positive integer greater than or equal to 1;
[0095] Based on this, the scores of all candidate hosts in the candidate host cluster can be determined as follows:
[0096] For the first candidate host among the M candidate hosts, determine the score of the first candidate host based on the number of CPU cores of the first candidate host, the total number of CPU cores of the M candidate hosts, the memory capacity of the first candidate host, the total memory capacity of the M candidate hosts, the number of used CPU cores in the total number of CPU cores and the number of used CPU cores in the number of CPU cores of the first candidate host, the used memory capacity in the total memory capacity and the used memory capacity in the memory capacity of the first candidate host.
[0097] It should be noted that the first candidate host is any candidate host among the M candidate hosts.
[0098] It should be noted that the total number of CPU cores of the M candidate hosts is the sum of the number of CPU cores of all the candidate hosts in the M candidate hosts; the total memory capacity of the M candidate hosts is the sum of the memory capacity of all the candidate hosts in the M candidate hosts.
[0099] In one implementation, the score of the first candidate host may be determined as follows:
[0100] Determine a first parameter based on the number of CPU cores of the first candidate host and the total number of CPU cores in the M candidate hosts, where the first parameter is greater than 0 and less than 1;
[0101] Determine a second parameter based on the memory capacity of the first candidate host and the total memory capacity, where the second parameter is greater than 0 and less than 1;
[0102] Determine a third parameter based on the number of used CPU cores in the total number of CPU cores and the number of used CPU cores in the first candidate host, where the third parameter is greater than 0 and less than or equal to 1;
[0103] Determining a fourth parameter based on a used memory capacity in the total memory capacity and a used memory capacity in the memory capacity of the first candidate host, where the fourth parameter is greater than 0 and less than or equal to 1;
[0104] Determine a first value corresponding to the first candidate host based on at least one of the first parameter, the second parameter, the third parameter, and the fourth parameter, where the first value is greater than 0 and less than 1;
[0105] Based on the first value, a score of the first candidate host is determined.
[0106] It should be understood that the first parameter may be determined by, but not limited to, the following implementations:
[0107] In one implementation, the ratio of the number of CPU cores of the first candidate host to the total number of CPU cores in the M candidate hosts may be determined as the first parameter.
[0108] In another implementation, the ratio of the number of CPU cores of the first candidate host to the total number of CPU cores in the M candidate hosts can be used as the first intermediate parameter, and the product of the first intermediate parameter and the first coefficient can be determined as the first parameter. The first coefficient can be a random number greater than 0 and less than or equal to 1.
[0109] It should be understood that the second parameter may be determined by, but not limited to, the following implementations:
[0110] In one implementation, the ratio of the memory capacity of the first candidate host to the total memory capacity of the M candidate hosts may be determined as the second parameter.
[0111] In another implementation, the ratio of the memory capacity of the first candidate host to the total memory capacity of the M candidate hosts can be used as the second intermediate parameter, and the product of the second intermediate parameter and the second coefficient can be determined as the second parameter. The second coefficient can be a random number greater than 0 and less than or equal to 1.
[0112] It should be understood that the third parameter may be determined by, but not limited to, the following implementations:
[0113] In one implementation, the third parameter may be obtained by dividing the difference between the number of used CPU cores in the total number of CPU cores in the M candidate hosts and the number of used CPU cores in the first candidate host by the number of used CPU cores in the total number of CPU cores in the M candidate hosts.
[0114] In another implementation, the third parameter may be determined as a ratio of the number of used CPU cores in the first candidate host to the number of used CPU cores in the total number of CPU cores in the M candidate hosts.
[0115] It should be understood that the fourth parameter may be determined by, but not limited to, the following implementations:
[0116] In one implementation, the fourth parameter may be obtained by dividing the difference between the used memory capacity in the total memory capacity of the M candidate hosts and the used memory capacity in the memory capacity of the first candidate host by the used memory capacity in the total memory capacity of the M candidate hosts.
[0117] In another implementation, the fourth parameter may be determined as a ratio of the used memory capacity of the first candidate host to the used memory capacity of the total memory capacity of the M candidate hosts.
[0118] It should be understood that the first value may be determined by, but not limited to, the following implementations:
[0119] In one implementation, any one of the first parameter, the second parameter, the third parameter, and the fourth parameter may be determined as the first value.
[0120] In another implementation, the first value can be obtained by the following formula (1):
[0121]
[0122] Among them, HC is the number of CPU cores of the first candidate host; TC is the total number of CPU cores in the M candidate hosts; HM is the memory capacity of the first candidate host; TM is the total memory capacity in the M candidate hosts; TCU is the number of used CPU cores in the total number of CPU cores in the M candidate hosts; HCU is the number of used CPU cores in the number of CPU cores in the first candidate host; TMU is the used memory capacity in the total memory capacity in the M candidate hosts; HMU is the used memory capacity in the memory capacity of the first candidate host.
[0123] It should be understood that the score of the first candidate host may be determined by, but not limited to, the following implementations:
[0124] In one implementation, the first value may be directly determined as the score of the first candidate host.
[0125] In another implementation, the first value is subjected to binomial distribution processing n times to obtain a second value, and the second value is determined as the score of the first candidate host, where n is a positive integer greater than 1, and the second value is greater than 0 and less than 1; illustratively, n can be 10, or 20, and this application does not impose any specific limitation on the value of n.
[0126] It should be noted that the first value is the probability of determining the first candidate host as the target host in n virtual machine scheduling events; the second value is the number of times the first candidate host is determined as the target host in n virtual machine scheduling events.
[0127] In another implementation, the first value is subjected to binomial distribution processing n times to obtain a second value, and the sum of the second value and the third value is determined as the score of the first candidate host, where n is a positive integer greater than 1, the second value is greater than 0 and less than 1, and the third value is a random number greater than 0 and less than 1; illustratively, n can be 10, or 20, and this application does not impose any specific limitation on the value of n.
[0128] By determining the sum of the second value and the third value as the score of the first candidate host, it is possible to avoid the situation where different first candidate hosts have the same score when the second value is directly determined as the score of the first candidate host, which in turn leads to the inability to accurately determine the target host based on the same score; determining the sum of the second value and the random number third value as the score of the first candidate host is beneficial to ensuring that different first candidate hosts have different scores, thereby facilitating accurate determination of the target host among the M candidate hosts.
[0129] In some embodiments of the present application, the target host may be determined in the following manner:
[0130] The score of each candidate host among all the candidate hosts is used as a weight, and weighted random processing is performed on all the candidate hosts to obtain the target host.
[0131] By using the score of each candidate host as a weight, all candidate hosts are weighted and randomly processed, and the target host is selected for deployment, so as to avoid excessive load pressure on a single host among all candidate hosts, which is conducive to achieving load balancing for all candidate hosts.
[0132] In some embodiments of the present application, the all candidate storages include X segments of candidate storage, where X is a positive integer greater than or equal to 1;
[0133] Based on this, the scores of all candidate storages associated with the target host in the candidate storage cluster can be determined as follows:
[0134] For a first candidate storage in the X segments of candidate storage, a score of the first candidate storage is determined based on the allocated storage capacity of the first candidate storage, the disk capacity of the i-th virtual machine, the total storage capacity of the X segments of candidate storage, and the used storage capacity of the first candidate storage.
[0135] It should be noted that the first candidate storage is any candidate storage among the X candidate storages.
[0136] It should be noted that the allocated storage capacity includes allocated and used storage capacity and allocated unused storage capacity.
[0137] In one implementation, the score of the first candidate storage may be determined as follows:
[0138] Determining a fifth parameter based on the allocated storage capacity of the first candidate storage, the disk capacity of the i-th virtual machine, and the total storage capacity;
[0139] Determining a sixth parameter using a first piecewise function based on the used storage capacity of the first candidate storage and the total storage capacity;
[0140] Determining a seventh parameter using a second piecewise function based on the allocated storage capacity in the first candidate storage and the total storage capacity;
[0141] Based on at least one of the fifth parameter, the sixth parameter, and the seventh parameter, a score of the first candidate storage is determined.
[0142] It should be understood that the fifth parameter may be determined by, but not limited to, the following implementations:
[0143] In one implementation, the fifth parameter may be determined by the following formula (2):
[0144]
[0145] RS is the score of the storage capacity required by the i-th virtual machine in the first candidate storage, CA is the allocated storage capacity in the first candidate storage, CR is the disk capacity of the i-th virtual machine, and CT is the total storage capacity of the X-segment candidate storage.
[0146] Specifically, the score of the storage capacity required by the i-th virtual machine in the first candidate storage obtained by formula (2) is determined as the fifth parameter.
[0147] In another implementation, the score of the storage capacity required by the i-th virtual machine in the first candidate storage obtained by formula (2) can be used as a third intermediate parameter, and the product of the third intermediate parameter and the third coefficient can be determined as the fifth parameter. The third coefficient can be a random number greater than 0 and less than or equal to 1.
[0148] In another implementation, the score of the storage capacity required by the i-th virtual machine in the first candidate storage obtained by formula (2) can be determined as a fourth intermediate parameter, and the sum of the fourth intermediate parameter and the fourth coefficient can be determined as the fifth parameter. The fourth coefficient can be a random number greater than 0 and less than or equal to 1.
[0149] It should be understood that the sixth parameter may be determined by, but not limited to, the following implementations:
[0150] In one implementation, the sixth parameter can be determined by the following formula (3) in combination with the first piecewise function:
[0151]
[0152] The first piecewise function is
[0153] Wherein, x is the ratio of the used storage capacity in the first candidate storage to the total storage capacity of the X-segment candidate storage, CU is the used storage capacity in the first candidate storage, and CT is the total storage capacity of the X-segment candidate storage.
[0154] Specifically, the proportion of the used storage capacity in the first candidate storage to the total storage capacity of the X-segment candidate storage can be obtained by formula (3), and then the value obtained by using the first piecewise function based on the proportion is determined as the sixth parameter.
[0155] In another implementation, first, the ratio of the used storage capacity of the first candidate storage to the total storage capacity of the X-segment candidate storage can be obtained by formula (3); second, the value obtained by using the first piecewise function based on the ratio is determined as the fifth intermediate parameter; finally, the product of the fifth intermediate parameter and the fifth coefficient is determined as the sixth parameter, and the fifth coefficient can be a random number greater than 0 and less than or equal to 1;
[0156] It should be noted that, in other alternative embodiments, the interval division and value of x in the above-mentioned first piecewise function can also be simply transformed to obtain a new first piecewise function, and this application does not impose any specific restrictions on this.
[0157] It should be understood that the seventh parameter may be determined by, but not limited to, the following implementations:
[0158] In one implementation, the seventh parameter can be determined by the following formula (4) in combination with the second piecewise function:
[0159]
[0160] The second piecewise function is
[0161] Wherein, y is the proportion of the allocated storage capacity in the first candidate storage to the total storage capacity of the X-segment candidate storage, CA is the allocated storage capacity in the first candidate storage, and CT is the total storage capacity of the X-segment candidate storage.
[0162] Specifically, the proportion of the used storage capacity in the first candidate storage to the total storage capacity of the X-segment candidate storage can be obtained by formula (4), and then the value obtained by using the second piecewise function based on the proportion is determined as the seventh parameter.
[0163] In another implementation, first, the ratio of the used storage capacity of the first candidate storage to the total storage capacity of the X-segment candidate storage can be obtained by formula (4). Then, the value obtained by using the second piecewise function based on the ratio is determined as the sixth intermediate parameter. Finally, the product of the sixth intermediate parameter and the sixth coefficient is determined as the seventh parameter. The sixth coefficient can be a random number greater than 0 and less than or equal to 1.
[0164] It should be noted that, in other alternative embodiments, the interval division and value of x in the above-mentioned first piecewise function can also be simply transformed to obtain a new first piecewise function, and this application does not impose any specific restrictions on this.
[0165] It should be understood that the score of the first candidate storage may be determined by, but not limited to, the following implementations:
[0166] In one implementation, any one of the fifth parameter, the sixth parameter, and the seventh parameter may be determined as the score of the first candidate storage.
[0167] In another implementation, the average value of the fifth parameter, the sixth parameter, and the seventh parameter may be determined as the score of the first candidate storage.
[0168] In another implementation, the sum of the average of the fifth parameter, the sixth parameter, and the seventh parameter and a fourth value may be determined as the score of the first candidate storage; the fourth value may be a random number greater than 0 and less than 1.
[0169] By determining the score of the first candidate storage as the sum of the average value of the fifth parameter, the sixth parameter, and the seventh parameter and the fourth value, this can avoid the situation where, when the average value of the fifth parameter, the sixth parameter, and the seventh parameter is directly determined as the score of the first candidate storage, different first candidate storages have the same score, which in turn makes it impossible to accurately determine the target storage based on the same score. Determining the score of the first candidate storage as the sum of the average value of the fifth parameter, the sixth parameter, and the seventh parameter and the fourth value of the random number is beneficial for ensuring that different first candidate storages have different scores, thereby facilitating accurate determination of the target storage among the X-segment candidate storages.
[0170] It should be noted that the sixth parameter is used to represent the score of the used storage capacity of the first candidate storage. The seventh parameter is used to represent the score of the allocated storage capacity of the first candidate storage.
[0171] In some embodiments of the present application, the target storage may be determined in the following manner:
[0172] The score of each candidate storage among all the candidate storages is used as a weight, and weighted random processing is performed on all the candidate storages to obtain the target storage.
[0173] By using the score of each candidate storage as a weight, all candidate storages are weighted and randomly processed, and the target storage is selected for deployment, avoiding excessive load pressure on a certain storage segment among all candidate storages, which is conducive to achieving load balancing for all candidate storages.
[0174] In some embodiments of the present application, when i is N, method 100 may further include:
[0175] Each of the N virtual machines is scheduled to a target host corresponding to each virtual machine, and a disk capacity of each virtual machine is scheduled to a target storage associated with the target host corresponding to each virtual machine.
[0176] If i is N, each of the N virtual machines is scheduled to the target host corresponding to each virtual machine, and the disk capacity of each virtual machine is scheduled to the target storage associated with the target host corresponding to each virtual machine. This is equivalent to, when i is N, batch creating N virtual machines at the same time to achieve unified deployment and maximize deployment time savings.
[0177] In some embodiments of the present application, before method 100, the method further includes:
[0178] Configuring a first performance label for each host in the first host cluster;
[0179] A second performance label is configured for each storage segment in the first storage cluster.
[0180] Exemplarily, the first performance tag includes a CPU performance tag; the second performance tag includes a storage performance tag.
[0181] Exemplarily, the hosts in the first host cluster are grouped and a first performance label is configured for each group of hosts.
[0182] Exemplarily, storage in the first storage cluster is grouped and a first performance label is configured for each group of storage.
[0183] Figure 2 It is a schematic flow chart of the virtual machine scheduling method 200 provided in an embodiment of the present application.
[0184] S201: The scheduling system configures a CPU performance label for each host in a first host cluster, and configures a storage performance label for each storage segment in a first storage cluster.
[0185] S202, the scheduling system obtains a scheduling request, which is used to request to schedule the i-th virtual machine among N virtual machines to the target host corresponding to the i-th virtual machine and schedule the disk capacity of the i-th virtual machine to the target storage associated with the target host. The scheduling request includes the performance label of the i-th virtual machine and the performance parameters of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N.
[0186] S203: The scheduling system determines a third host cluster in the first host cluster based on the CPU performance tag of the i-th virtual machine, and determines a third storage cluster in the first storage cluster based on the storage performance tag of the i-th virtual machine.
[0187] S204: The scheduling system determines the second host cluster and the second storage cluster based on the association relationship between the hosts in the third host cluster and the storage in the third storage cluster.
[0188] S205 : Scheduling the performance parameters of the i-th virtual machine in the system, and determining a fourth host cluster and a fourth storage cluster in the second host cluster and the second storage cluster.
[0189] S206: The scheduling system determines a candidate host cluster and a candidate storage cluster based on associations between hosts in the fourth host cluster and storages in the fourth storage cluster.
[0190] S207: The scheduling system determines the target host and the target storage in the candidate host cluster and the candidate storage cluster respectively based on the scoring algorithm.
[0191] S208, if i=N, the scheduling system schedules each of the N virtual machines to the target host corresponding to each virtual machine, and schedules the disk capacity of each virtual machine to the target storage associated with the target host corresponding to each virtual machine.
[0192] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all fall within the scope of protection of the present application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will no longer describe the various possible combinations separately. For another example, the various different embodiments of the present application can also be arbitrarily combined, as long as they do not violate the idea of the present application, they should also be regarded as the contents disclosed in the present application. It should also be understood that in the various method embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0193] The above describes the method provided in the embodiment of the present application, and the following describes the device provided in the embodiment of the present application.
[0194] Figure 3 It is a schematic block diagram of a virtual machine scheduling device 300 provided in an embodiment of the present application.
[0195] like Figure 3 As shown, the apparatus 300 may include:
[0196] An acquiring unit 310 is configured to acquire a scheduling request, the scheduling request being used to request that an i-th virtual machine among N virtual machines be scheduled to a target host corresponding to the i-th virtual machine and that the disk capacity of the i-th virtual machine be scheduled to a target storage associated with the target host. The scheduling request includes a performance tag of the i-th virtual machine and a performance parameter of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N.
[0197] A first determining unit 320 is configured to determine, based on the performance tag of the i-th virtual machine, a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center;
[0198] The second determining unit 330 is configured to determine a target host corresponding to the i-th virtual machine and a target storage corresponding to the i-th virtual machine in the second host cluster and the second storage cluster respectively based on the performance parameters of the i-th virtual machine.
[0199] In some embodiments of the present application, the first determining unit 320 may be configured to:
[0200] Based on the performance tag of the i-th virtual machine, determining a third host cluster and a third storage cluster in the first host cluster and the first storage cluster respectively;
[0201] The second host cluster and the second storage cluster are determined based on associations between hosts in the third host cluster and storages in the third storage cluster.
[0202] In some embodiments of the present application, the first determining unit 320 may further be configured to:
[0203] Determine a host in the first host cluster having the same CPU performance label as the CPU performance label of the i-th virtual machine as a host in the third host cluster;
[0204] The storage in the first storage cluster having the same storage performance label as the storage performance label of the i-th virtual machine is determined as the storage in the third storage cluster.
[0205] In some embodiments of the present application, the first determining unit 320 may further be configured to:
[0206] Determining a host in the third host cluster that is associated with any storage in the third storage cluster as a host in the second host cluster;
[0207] The storage in the third storage cluster that is associated with any host in the third host cluster is determined as the storage in the second storage cluster.
[0208] In some embodiments of the present application, the second determining unit 330 may be configured to:
[0209] Based on the performance parameters of the i-th virtual machine, determining a fourth host cluster and a fourth storage cluster in the second host cluster and the second storage cluster respectively;
[0210] Determining a candidate host cluster and a candidate storage cluster based on associations between hosts in the fourth host cluster and storages in the fourth storage cluster;
[0211] Based on the scoring algorithm, the target host and the target storage are determined in the candidate host cluster and the candidate storage cluster, respectively.
[0212] In some embodiments of the present application, the performance parameters include the number of CPU cores, memory capacity, and disk capacity;
[0213] Based on this, the second determining unit 330 may further be configured to:
[0214] Based on the number of CPU cores and memory capacity of the i-th virtual machine, determine a host in the second host cluster that meets a target condition as a host in the fourth host cluster, where the target condition is that the remaining number of CPU cores and the remaining memory capacity are respectively greater than or equal to the number of CPU cores and the memory capacity of the i-th virtual machine, where the remaining number of CPU cores includes the number of CPU cores remaining in any host in the second host cluster after the CPU cores are allocated to the i-1-th virtual machine, and the remaining memory capacity includes the memory capacity remaining in any host in the second host cluster after the memory capacity is allocated to the i-1-th virtual machine;
[0215] Based on the disk capacity of the i-th virtual machine, the storage in the second storage cluster whose remaining storage capacity is greater than or equal to the disk capacity is determined as the storage in the fourth storage cluster, where the remaining storage capacity includes the storage capacity remaining in any storage in the second storage cluster after allocating storage capacity to the i-1-th virtual machine.
[0216] In some embodiments of the present application, the scoring algorithm includes a host scoring algorithm and a storage scoring algorithm;
[0217] Based on this, the second determining unit 330 may further be configured to:
[0218] Determine scores for all candidate hosts in the candidate host cluster based on the host scoring algorithm;
[0219] Determine the target host based on the scores of all candidate hosts;
[0220] Determine scores of all candidate storages associated with the target host in the candidate storage cluster based on the storage scoring algorithm;
[0221] The target storage is determined based on the scores of all candidate storages.
[0222] In some embodiments of the present application, the candidate host cluster includes M candidate hosts, where M is a positive integer greater than or equal to 1;
[0223] Based on this, the second determining unit 330 may further be configured to:
[0224] For the first candidate host among the M candidate hosts, determine the score of the first candidate host based on the number of CPU cores of the first candidate host, the total number of CPU cores of the M candidate hosts, the memory capacity of the first candidate host, the total memory capacity of the M candidate hosts, the number of used CPU cores in the total number of CPU cores and the number of used CPU cores in the number of CPU cores of the first candidate host, the used memory capacity in the total memory capacity and the used memory capacity in the memory capacity of the first candidate host.
[0225] In some embodiments of the present application, the second determining unit 330 may further be configured to:
[0226] Determine a first parameter based on the number of CPU cores of the first candidate host and the total number of CPU cores in the M candidate hosts, where the first parameter is greater than 0 and less than 1;
[0227] Determine a second parameter based on the memory capacity of the first candidate host and the total memory capacity, where the second parameter is greater than 0 and less than 1;
[0228] Determine a third parameter based on the number of used CPU cores in the total number of CPU cores and the number of used CPU cores in the first candidate host, where the third parameter is greater than 0 and less than or equal to 1;
[0229] Determining a fourth parameter based on a used memory capacity in the total memory capacity and a used memory capacity in the memory capacity of the first candidate host, where the fourth parameter is greater than 0 and less than or equal to 1;
[0230] Determine a first value corresponding to the first candidate host based on at least one of the first parameter, the second parameter, the third parameter, and the fourth parameter, where the first value is greater than 0 and less than 1;
[0231] Based on the first value, a score of the first candidate host is determined.
[0232] In some embodiments of the present application, the second determining unit 330 may further be configured to:
[0233] Performing binomial distribution processing on the first value n times to obtain a second value, where n is a positive integer greater than 1, and the second value is greater than 0 and less than 1;
[0234] The sum of the second value and the third value is determined as the score of the first candidate host, and the third value is a random number greater than 0 and less than 1.
[0235] In some embodiments of the present application, the second determining unit 330 may further be configured to:
[0236] The score of each candidate host among all the candidate hosts is used as a weight, and weighted random processing is performed on all the candidate hosts to obtain the target host.
[0237] In some embodiments of the present application, the all candidate storages include X segments of candidate storage, where X is a positive integer greater than or equal to 1;
[0238] Based on this, the second determining unit 330 may further be configured to:
[0239] For a first candidate storage in the X segments of candidate storage, a score of the first candidate storage is determined based on the allocated storage capacity of the first candidate storage, the disk capacity of the i-th virtual machine, the total storage capacity of the X segments of candidate storage, and the used storage capacity of the first candidate storage.
[0240] In some embodiments of the present application, the second determining unit 330 may further be configured to:
[0241] Determining a fifth parameter based on the allocated storage capacity of the first candidate storage, the disk capacity of the i-th virtual machine, and the total storage capacity;
[0242] Determining a sixth parameter using a first piecewise function based on the used storage capacity of the first candidate storage and the total storage capacity;
[0243] Determining a seventh parameter using a second piecewise function based on the allocated storage capacity in the first candidate storage and the total storage capacity;
[0244] Based on at least one of the fifth parameter, the sixth parameter, and the seventh parameter, a score of the first candidate storage is determined.
[0245] In some embodiments of the present application, the second determining unit 330 may further be configured to:
[0246] The score of each candidate storage among all the candidate storages is used as a weight, and weighted random processing is performed on all the candidate storages to obtain the target storage.
[0247] In some embodiments of the present application, the apparatus 300 may further include a scheduling unit configured to:
[0248] When i is N, each of the N virtual machines is scheduled to the target host corresponding to each virtual machine, and the disk capacity of each virtual machine is scheduled to the target storage associated with the target host corresponding to each virtual machine.
[0249] In some embodiments of the present application, the apparatus 300 may further include a configuration unit configured to:
[0250] Configuring a first performance label for each host in the first host cluster;
[0251] A second performance label is configured for each storage segment in the first storage cluster.
[0252] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions can refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the device 300 may correspond to the corresponding subject in the method 100 or the method 200 of the embodiment of the present application, and the various units in the device 300 are respectively for implementing the corresponding processes in the method 100 or the method 200. For the sake of brevity, no further description is given here.
[0253] It should be noted that in the above description, the terms "first\second\third\fourth\fifth\sixth" are only used to distinguish similar objects and do not represent a specific ordering of the objects. It should be understood that "first\second\third\fourth\fifth\sixth" can be interchanged in a specific order or sequence where permitted and should not be a limitation of this application.
[0254] It should also be understood that the various units in the device 300 involved in the embodiment of the present application can be separately or all merged into one or several other units to constitute, or some (some) units thereof can also be further divided into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units is implemented by one unit. In other embodiments of the present application, the device 300 may also include other units. In practical applications, these functions can also be implemented with the assistance of other units and can be implemented by the collaboration of multiple units. According to another embodiment of the present application, the device 300 involved in the embodiment of the present application can be constructed by running a computer program (including program code) capable of executing each step involved in the corresponding method on a general-purpose computing device including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM), etc., to construct the device 300 involved in the embodiment of the present application, and to implement the virtual machine scheduling method of the embodiment of the present application. The computer program may be recorded on, for example, a computer-readable storage medium, loaded into an electronic device via the computer-readable storage medium, and run therein to implement the corresponding method of the embodiment of the present application.
[0255] In other words, the units mentioned above can be implemented in the form of hardware, can be implemented by instructions in the form of software, or can be implemented in the form of a combination of hardware and software. Specifically, the steps of the method embodiments in the embodiments of the present application can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software in a decoding processor. Optionally, the software can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps in the above method embodiments in combination with its hardware.
[0256] Figure 4 It is a schematic structural diagram of an electronic device 400 provided in an embodiment of the present application.
[0257] like Figure 4 As shown, the electronic device 400 includes at least a processor 410 and a computer-readable storage medium 420. The processor 410 and the computer-readable storage medium 420 may be connected via a bus or other means. The computer-readable storage medium 420 is used to store a computer program 421, which includes computer instructions. The processor 410 is used to execute the computer instructions stored in the computer-readable storage medium 420. The processor 410 is the computing core and control core of the electronic device 400. It is suitable for implementing one or more computer instructions, and is specifically suitable for loading and executing one or more computer instructions to implement the corresponding method flow or corresponding function.
[0258] As an example, the processor 410 may also be referred to as a central processing unit (CPU). The processor 410 may include, but is not limited to, a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like.
[0259] As an example, the computer-readable storage medium 420 may be a high-speed RAM memory, or a non-volatile memory (Non-Volatile Memory), such as at least one disk storage; optionally, it may also be at least one computer-readable storage medium located away from the aforementioned processor 410. Specifically, the computer-readable storage medium 420 includes, but is not limited to: volatile memory and / or non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0260] In one implementation, the electronic device 400 may be Figure 3 The virtual machine scheduling device 300 shown; the computer readable storage medium 420 stores computer instructions; the processor 410 loads and executes the computer instructions stored in the computer readable storage medium 420 to implement Figures 1 to 2 The corresponding steps in the method embodiment shown; in a specific implementation, the computer instructions in the computer-readable storage medium 420 are loaded by the processor 410 and the corresponding steps are executed. To avoid repetition, they are not repeated here.
[0261] According to another aspect of the present application, an embodiment of the present application further provides a computer-readable storage medium (Memory), which is a memory device in the electronic device 400 for storing programs and data. For example, a computer-readable storage medium 420. It can be understood that the computer-readable storage medium 420 here can include both the built-in storage medium in the electronic device 400 and, of course, the extended storage medium supported by the electronic device 400. The computer-readable storage medium provides a storage space, which stores the operating system of the electronic device 400. In addition, one or more computer instructions suitable for being loaded and executed by the processor 410 are also stored in the storage space. These computer instructions can be one or more computer programs 421 (including program codes).
[0262] The electronic device 400 may further include a transceiver 430 , which may be connected to the processor 410 or the computer-readable storage medium 420 .
[0263] Computer-readable storage medium 420 can control transceiver 430 to communicate with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices. Transceiver 430 may include a transmitter and a receiver. Transceiver 430 may further include an antenna, and the number of antennas may be one or more.
[0264] According to another aspect of the present application, a computer program product or computer program is provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. For example, computer program 421 is provided. In this case, electronic device 400 may be a computer, and processor 410 reads the computer instructions from computer-readable storage medium 420. Processor 410 executes the computer instructions, causing the computer to perform the virtual machine scheduling methods provided in the various optional embodiments described above.
[0265] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process of the embodiment of the present application is run in whole or in part or the functions of the embodiment of the present application are implemented. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode.
[0266] Those skilled in the art will appreciate that the units and process steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0267] Finally, it should be noted that the above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited to this. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A virtual machine scheduling method, characterized in that: include: Obtaining a scheduling request, the scheduling request being used to request scheduling an i-th virtual machine among N virtual machines to a target host corresponding to the i-th virtual machine and scheduling disk capacity of the i-th virtual machine to a target storage associated with the target host, the scheduling request including a performance tag of the i-th virtual machine and a performance parameter of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N; Based on the performance tag of the i-th virtual machine, determining a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center; Determining the target host and the target storage in the second host cluster and the second storage cluster respectively based on the performance parameters of the i-th virtual machine; The determining the target host and the target storage in the second host cluster and the second storage cluster based on the performance parameter of the i-th virtual machine includes: Determining a fourth host cluster and a fourth storage cluster in the second host cluster and the second storage cluster respectively based on the performance parameters of the i-th virtual machine; Determining a candidate host cluster and a candidate storage cluster based on associations between hosts in the fourth host cluster and storages in the fourth storage cluster; The target host and the target storage are determined in the candidate host cluster and the candidate storage cluster respectively based on a scoring algorithm, wherein the scoring algorithm includes a host scoring algorithm and a storage scoring algorithm.
2. The method according to claim 1, characterized in that The determining, based on the performance tag of the i-th virtual machine, a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center, respectively, includes: Based on the performance tag of the i-th virtual machine, determining a third host cluster and a third storage cluster in the first host cluster and the first storage cluster respectively; The second host cluster and the second storage cluster are determined based on association relationships between hosts in the third host cluster and storage in the third storage cluster.
3. The method according to claim 2, characterized in that The determining, based on the performance tag of the i-th virtual machine, a third host cluster and a third storage cluster from the first host cluster and the first storage cluster, respectively, includes: Determine a host in the first host cluster whose CPU performance label is the same as the CPU performance label of the i-th virtual machine as a host in the third host cluster; The storage in the first storage cluster having the same storage performance label as the storage performance label of the i-th virtual machine is determined as the storage in the third storage cluster.
4. The method according to claim 2, characterized in that The determining the second host cluster and the second storage cluster based on the association relationship between the hosts in the third host cluster and the storage in the third storage cluster includes: Determine a first host in the third host cluster that has an association relationship with storage in the third storage cluster as a host in the second host cluster; The storage associated with the first host in the third storage cluster is determined as the storage in the second storage cluster.
5. The method according to claim 1, characterized in that The performance parameters include the number of CPU cores, memory capacity, and disk capacity; The determining, based on the performance parameters of the i-th virtual machine, a fourth host cluster and a fourth storage cluster in the second host cluster and the second storage cluster, respectively, includes: Based on the number of CPU cores and memory capacity of the i-th virtual machine, determine the host in the second host cluster that meets the target condition as a host in the fourth host cluster, where the target condition is that the remaining number of CPU cores and the remaining memory capacity are respectively greater than or equal to the number of CPU cores of the i-th virtual machine and the memory capacity of the i-th virtual machine, the remaining number of CPU cores includes the number of CPU cores remaining in any host in the second host cluster after the CPU cores are allocated to the i-1-th virtual machine, and the remaining memory capacity includes the memory capacity remaining in any host in the second host cluster after the memory capacity is allocated to the i-1-th virtual machine; Based on the disk capacity of the i-th virtual machine, the storage in the second storage cluster whose remaining storage capacity is greater than or equal to the disk capacity is determined as the storage in the fourth storage cluster, where the remaining storage capacity includes the storage capacity remaining in any storage in the second storage cluster after allocating storage capacity to the i-1-th virtual machine.
6. The method according to claim 1, wherein The determining the target host and the target storage in the candidate host cluster and the candidate storage cluster based on the scoring algorithm includes: Determining scores of all candidate hosts in the candidate host cluster based on the host scoring algorithm; Determining the target host based on the scores of all candidate hosts; Determining scores of all candidate storages associated with the target host in the candidate storage cluster based on the storage scoring algorithm; The target storage is determined based on the scores of all the candidate storages.
7. The method according to claim 6, characterized in that The candidate host cluster includes M candidate hosts, where M is a positive integer greater than or equal to 1; The step of determining the scores of all candidate hosts in the candidate host cluster based on the host scoring algorithm includes: For the first candidate host among the M candidate hosts, determine the score of the first candidate host based on the number of CPU cores of the first candidate host, the total number of CPU cores of the M candidate hosts, the memory capacity of the first candidate host, the total memory capacity of the M candidate hosts, the number of used CPU cores in the total number of CPU cores and the number of used CPU cores in the number of CPU cores of the first candidate host, the used memory capacity in the total memory capacity and the used memory capacity in the memory capacity of the first candidate host.
8. The method according to claim 6, characterized in that The determining the target host based on the scores of all the candidate hosts includes: The score of each candidate host among all the candidate hosts is used as a weight, and weighted random processing is performed on all the candidate hosts to obtain the target host.
9. The method according to claim 6, characterized in that All candidate storages include X segments of candidate storage, where X is a positive integer greater than or equal to 1; The step of determining the scores of all candidate storages associated with the target host in the candidate storage cluster based on the storage scoring algorithm includes: For a first candidate storage in the X segments of candidate storage, a score of the first candidate storage is determined based on the allocated storage capacity in the first candidate storage, the disk capacity of the i-th virtual machine, the total storage capacity of the X segments of candidate storage, and the used storage capacity in the first candidate storage.
10. The method according to any one of claims 1 to 9, characterized in that When i is N, the method further includes: Each of the N virtual machines is scheduled to a target host corresponding to each virtual machine, and a disk capacity of each virtual machine is scheduled to a target storage associated with the target host corresponding to each virtual machine.
11. A virtual machine scheduling device, characterized in that: For implementing the method according to any one of claims 1 to 10, the virtual machine scheduling device comprises: an acquiring unit, configured to acquire a scheduling request, the scheduling request being used to request that an i-th virtual machine among N virtual machines be scheduled to a target host corresponding to the i-th virtual machine and that a disk capacity of the i-th virtual machine be scheduled to a target storage associated with the target host, the scheduling request including a performance tag of the i-th virtual machine and a performance parameter of the i-th virtual machine, where N is a positive integer greater than or equal to 1, and i is a positive integer greater than or equal to 1 and less than or equal to N; A first determining unit is configured to determine, based on the performance tag of the i-th virtual machine, a second host cluster and a second storage cluster in the first host cluster and the first storage cluster included in the multi-data center; The second determining unit is configured to determine, based on the performance parameters of the i-th virtual machine, a target host corresponding to the i-th virtual machine and a target storage corresponding to the i-th virtual machine in the second host cluster and the second storage cluster respectively.
12. An electronic device, characterized in that: include: a processor adapted to execute a computer program; A computer-readable storage medium having a computer program stored therein, wherein the computer program, when executed by the processor, implements the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that Used to store a computer program, wherein the computer program causes a computer to execute the method according to any one of claims 1 to 10.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Cloud platform-based method for realizing multi-virtualization hybrid management and scheduling
CN105653372A
Cluster system deployment method and device, computer equipment and storage medium
CN110730205A