A data processing method, an electronic device, and a cluster

By reading resource record information on each host of a large-scale centerless cluster and determining whether it is necessary to migrate out or migrate to a virtual machine, the problem of resource imbalance in the centerless cluster is solved and the balanced scheduling of resources is achieved.

CN106959884BActive Publication Date: 2025-05-30LENOVO (BEIJING) LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201710179443.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2017-03-23
Publication Date
2025-05-30
Estimated Expiration
2037-09-12

AI Technical Summary

Technical Problem

In large-scale, centerless clusters, resource scheduling cannot be achieved, resulting in resource imbalance.

Method used

By reading the resource record information of the cluster on each host in the cluster, it is determined whether it is necessary to migrate out of the virtual machine or migrate into the virtual machine, thereby realizing resource scheduling and balancing.

Benefits of technology

There is no need for a unified controller or manager. By allocating resource scheduling to each host, the resource balance in the cluster is achieved and resource imbalance is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN106959884B_ABST
    Figure CN106959884B_ABST
Patent Text Reader

Abstract

The present application discloses a data processing method, an electronic device, and a cluster. The method includes: reading resource record information of the cluster, where the resource record information includes resource information of each host in the cluster; and based on the resource information, determining whether to migrate a virtual machine out or migrate a virtual machine in. The present application does not require a unified controller or manager in the cluster. Instead, the work of resource scheduling is assigned to each host, and each host determines whether the current host needs to perform resource scheduling, such as migrating a virtual machine out or migrating a virtual machine in, by judging the resource information of all hosts in the cluster, so as to achieve resource scheduling, achieve overall resource balance within the cluster, and achieve the purpose of the present application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data transmission, and particularly to a data processing method, an electronic device, and a cluster. Background Art

[0002] In current mainstream cloud infrastructure clusters, there is usually one or more central controllers used to schedule the overall resources of the cluster. For example, when creating a virtual service, the controller will select a host with the lowest resource occupancy rate according to the current internal resource situation of the cluster and migrate the new service to it to achieve uniform distribution of resources within the cluster; or, the controller starts a period, and once it times out, it decides to reallocate the current virtual machine.

[0003] In a large-scale centerless cluster, since there is no unified controller or manager, the solution of uniformly scheduling resources by the controller cannot be applied, resulting in the inability to achieve resource scheduling in the cluster and resource imbalance within the cluster. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a data processing method, an electronic device, and a cluster to solve the technical problem of resource imbalance in large-scale centerless clusters in the prior art.

[0005] This application provides a data processing method applied to a host in a cluster. The method includes:

[0006] Read the resource record information of the cluster, where the resource record information includes the resource information of each host in the cluster;

[0007] Based on the resource information, determine whether a virtual machine needs to be migrated out or migrated in.

[0008] Preferably, in the above method, the determining whether a virtual machine needs to be migrated out or migrated in based on the resource information includes:

[0009] When the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, mark the current host as a state where a virtual machine needs to be migrated out;

[0010] When the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, mark the current host as a state where a virtual machine can be migrated in.

[0011] Preferably, after marking the current host as a state where a virtual machine needs to be migrated out, the above method further includes:

[0012] Determine the first virtual machine that needs to be migrated out in the current host.

[0013] Preferably, after determining the first virtual machine to be migrated out of the current host, the method further includes:

[0014] Based on the resource occupancy required by the first virtual machine, search for a first host in other hosts of the cluster that is in a state where a virtual machine can be migrated in and the available resources meet the preset requirements. Update the resource information of the current host, the resource information of the first host, and the virtual machine information of the first virtual machine by the first host or the current host, so that the first virtual machine migrates out of the current host and migrates into the first host.

[0015] Preferably, after marking the current host as a state where a virtual machine can be migrated in, the method further includes:

[0016] Search for a second host in other hosts of the cluster that is in a state where a virtual machine needs to be migrated out. There is a second virtual machine in the second host that needs to be migrated out. Modify the resource information of the current host, the resource information of the second host, and the virtual machine information of the second virtual machine by the second host or the current host, so that the second virtual machine migrates out of the second host and migrates into the current host.

[0017] Preferably, reading the resource record information of the cluster includes:

[0018] Read the resource record information of the cluster at preset time intervals.

[0019] Preferably, the resource information of each host in the resource record information is stored separately by the host.

[0020] Preferably, the method further includes:

[0021] Generate the resource information of the virtual machine to be created and store it in the resource record information;

[0022] Based on the resource record information, search for a third host in the cluster that is in a state where a virtual machine can be migrated in and the available resources meet the preset requirements. Update the resource information of the third host and the resource information of the virtual machine to be created by the third host, so that the virtual machine to be created is created on the third host.

[0023] This application also provides an electronic device, including:

[0024] An input interface for reading the resource record information of the cluster, where the resource record information includes the resource information of each host in the cluster;

[0025] A processor for determining whether a virtual machine needs to be migrated out or migrated in based on the resource information.

[0026] The present application also provides a cluster, including a database and multiple hosts, where:

[0027] The database is used to store resource record information, and the resource record information includes the resource information of each host in the cluster;

[0028] The host is used to read the resource record information and, based on the resource information, determine whether a virtual machine needs to be migrated out or migrated in.

[0029] For the above-mentioned cluster, preferably:

[0030] The host is specifically used to: when the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, mark the current host as a state that needs to migrate out a virtual machine; when the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, mark the current host as a state that can migrate in a virtual machine.

[0031] As can be seen from the above solution, a data processing method, an electronic device, and a cluster provided by the present application enable the host in the cluster to read the resource record information of the cluster, thereby obtaining the resource information of each host in the cluster, and then further determining whether the current host needs to migrate out a virtual machine or migrate in a virtual machine based on these resource information, realizing the scheduling of virtual machine resources. In the present application, there is no need for a unified controller or manager in the cluster. Instead, the work of resource scheduling is distributed to each host, and each host determines whether the current host needs to perform resource scheduling, such as virtual machine migration out or virtual machine migration in, by judging the resource information of all hosts in the cluster, so as to achieve resource scheduling, achieve the overall resource balance within the cluster, and achieve the purpose of the present application. Description of the Drawings

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0033] Figure 1 It is a flowchart for implementing a data processing method provided in Embodiment 1 of the present application;

[0034] Figure 2 And Figure 3 They are respectively application example diagrams of the embodiments of the present application;

[0035] Figures 4 to 7 They are respectively partial flowcharts of Embodiment 1 of the present application;

[0036] Figure 8 Schematic diagram of a structure of an electronic device provided in the second embodiment of the present application;

[0037] Figure 9 Schematic diagram of a structure of a cluster provided in the third embodiment of the present application;

[0038] Figures 10 to 14 They are respectively other application example diagrams of the embodiments of the present application. Detailed implementation manners

[0039] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0040] Refer to Figure 1 , which is a flowchart of the implementation of a data processing method provided in the first embodiment of the present application, and is applicable to the host in a large-scale centerless server cluster. The cluster contains multiple hosts, as Figure 2 shown in, each host can run virtual machines to provide various services for users.

[0041] The method in this embodiment can run on each host in the cluster and includes the following steps:

[0042] Step 101: Read the resource record information of the cluster.

[0043] Among them, the resource record information may include the resource information of each host in the cluster. The resource information may include information in multiple dimensions, such as the number of virtual central processing unit (CPU) cores, virtual memory size, disk space, egress bandwidth, etc. As Figure 3 shown in the total number and current resource occupancy of the virtual CPU cores, virtual memory, disk space, and egress bandwidth of hosts node1 to node4 respectively.

[0044] Taking host node2 as an example, the total Total of each dimension information is:

[0045] Number of virtual CPU cores vCpu: 100; virtual memory size vMem: 100g; disk space disc: 10T; egress bandwidth bandwidth: 20000G;

[0046] The current resource occupancy Used of each dimension information is:

[0047] Number of virtual CPU cores vCpu: 0; Virtual memory size vMem: 0; Disk space disc: 0; Egress bandwidth bandwidth: 0.

[0048] It should be noted that the resource record information can represent the current resource status of each host in the cluster.

[0049] Step 102: Based on the resource information, determine whether it is necessary to migrate virtual machines out or migrate virtual machines in.

[0050] That is to say, in the cluster, each host can be the subject of resource scheduling, and based on the current resource status of all hosts in the entire cluster, the virtual machine resources are scheduled. For example, migrate virtual machines in from other hosts, or migrate virtual machines out to other hosts to achieve balanced resource scheduling.

[0051] As can be seen from the above solution, in Embodiment 1 of the present application, a data processing method is provided. The host in the cluster reads the resource record information of the cluster, thereby reading the resource information of each host in the cluster, and then based on these resource information, determines whether the current host needs to migrate virtual machines out or needs to migrate virtual machines in, to achieve the scheduling of virtual machine resources. In this embodiment, there is no need for a unified controller or manager in the cluster, but the resource scheduling work is assigned to each host. Each host determines whether the current host needs to perform resource scheduling, such as virtual machine migration out or virtual machine migration in, by judging the resource information of all hosts in the cluster, so as to achieve resource scheduling, achieve overall resource balance within the cluster, and achieve the purpose of the embodiment.

[0052] At the same time, in this embodiment, the trigger for virtual machine migration is initiated by the host in the cluster, rather than by unified scheduling. Therefore, the time of virtual machine migration can be easily dispersed, reducing the probability of large-scale virtual machine migration within the cluster.

[0053] In one implementation, the resource information of each host in the resource record information is stored separately by the host itself. For example, Figure 2 After each host in [the example] goes online and enters the cluster, the host writes its resource information into the database. The resource information of all hosts in the cluster constitutes the resource record information of the cluster, which is provided for the host performing resource balanced scheduling to read.

[0054] When each host performing resource balanced scheduling reads the resource record information of the cluster, it can read the resource record information of the cluster at preset time intervals.

[0055] Among them, the size of the time interval can be set according to the needs of the host itself.

[0056] For example, a timer is set for each host in the cluster. After the timer records a time interval, i.e., the timer times out, the host reads the resource record information of the cluster once, and then performs a resource balancing scheduling. That is to say, in this embodiment, each host in the cluster can perform a resource scheduling regularly, further realizing the overall resource balance of the cluster.

[0057] In one implementation, when the host performing resource balancing scheduling in the cluster determines whether to migrate out or embed a virtual machine based on the resource information, it can be achieved through the following steps, as Figure 4 shown below:

[0058] Step 121: Determine the magnitude relationship between the average resource occupancy of all hosts in the resource information and the current resource occupancy of the current host.

[0059] Step 122: When the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, mark the current host as the state that needs to migrate out a virtual machine. That is to say, the current host needs to migrate the virtual machine to other hosts.

[0060] Step 123: When the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, mark the current host as the state that needs to migrate in a virtual machine. That is to say, other hosts can migrate the virtual machine to the current host.

[0061] When the average resource occupancy of all hosts in the resource information is equal to the current resource occupancy of the current host, the current host can do nothing because the resource occupancy of the current host in the cluster is in a relatively balanced state at this time.

[0062] When the current host is in the state of needing to migrate out a virtual machine, in this embodiment, the first virtual machine to be migrated out in the current host can be determined, and then the first virtual machine is migrated into the corresponding first host, as Figure 5 shown below. After step 122, the method may further include the following steps:

[0063] Step 103: Determine the first virtual machine to be migrated out in the current host.

[0064] Among them, in this embodiment, the current host can determine the first virtual machine according to the amount by which its current resource occupancy exceeds the average resource occupancy of all hosts in the cluster. For example, after the first virtual machine determined by the current host is migrated out, the current resource occupancy of the current host is less than or equal to the average resource occupancy of all hosts in the cluster.

[0065] Step 104: Based on the resource occupancy required by the first virtual machine, search for a first host in other hosts of the cluster that is in a state where a virtual machine can be migrated in and the available resources meet the preset requirements.

[0066] Step 105: Update the resource information of the current host, the resource information of the first host, and the virtual machine information of the first virtual machine, so that the first virtual machine migrates out of the current host and migrates into the first host. Thus, the migration of the first virtual machine is completed.

[0067] Alternatively, in addition to being updated by the current host itself, the resource information of the current host, the resource information of the first host, and the virtual machine information of the first virtual machine can also be updated by the first host.

[0068] Among them, the preset requirement means that the available resources of the first host can meet the resources required by the first virtual machine migrating into the first host. For example, the available resources of the first host are greater than or equal to the resource occupancy required by the first virtual machine.

[0069] For example: The resource information of the current host can be updated to not include the resource information of the first virtual machine; after the resource information of the first host is updated, it includes the resource information of the first virtual machine; the virtual machine information of the first virtual machine is updated to the virtual machine information belonging to the first host. Thus, the process of the first virtual machine migrating from the current host to the first host is completed, realizing the balanced scheduling of resources.

[0070] When the current host is in a state where a virtual machine can be migrated in, the current host can migrate a second virtual machine into other hosts in the cluster. Specifically, after step 123, the method may further include the following steps, as Figure 6 shown in

[0071] Step 106: Search for a second host in other hosts of the cluster that is in a state where a virtual machine needs to be migrated out.

[0072] Among them, there is a second virtual machine in the second host that needs to be migrated out.

[0073] It should be noted that the second virtual machine that needs to be migrated out in the second host can be determined when the second host performs resource balanced scheduling. For example, when the second host determines that the current resource occupancy of the second host is greater than the average resource occupancy of all hosts in the cluster based on the resource information of each host in the cluster, the second host determines the second virtual machine that needs to be migrated out.

[0074] Step 107: Modify the resource information of the current host, the resource information of the second host, and the virtual machine information of the second virtual machine, so that the second virtual machine migrates out of the second host and migrates into the current host.

[0075] Alternatively, in addition to being updated by the current host itself, the resource information of the current host, the resource information of the second host, and the virtual machine information of the second virtual machine can also be updated by the second host.

[0076] For example: the resource information of the current host can be updated to include the resource information of the second virtual machine; after the resource information of the second host is updated, it does not include the resource information of the second virtual machine; the virtual machine information of the second virtual machine is updated to belong to the virtual machine information of the current host. Thus, the process of migrating the first virtual machine from the second host to the current host is completed, and the balanced scheduling of resources is achieved.

[0077] In one implementation, in addition to the situation of virtual machine migration in the cluster, there will also be a situation of creating a new virtual machine. Therefore, in order to achieve resource balance when creating a new virtual machine, the following solution is proposed in this embodiment, as Figure 7 shown below, the steps are as follows:

[0078] Step 701: Generate the resource information of the virtual machine to be created and store it in the resource record information.

[0079] Step 702: Based on the resource record information, search for a third host in the cluster that is in a state where a virtual machine can be migrated in and the available resource amount meets the preset requirements.

[0080] Thus, the third host updates the resource information of the third host and the resource information of the virtual machine to be created, so that the virtual machine to be created is created on the third host.

[0081] Among them, the third host can be the current host or other hosts in the cluster.

[0082] And the resource information of the third host is updated to include the information of the virtual machine to be created; the resource information of the virtual machine to be created is updated to belong to the resource information of the third host.

[0083] That is to say, the current host can determine the host on which the third virtual machine is created based on the resource information of all hosts in the cluster in the resource record information, which can be a host in the cluster that is in a state where a virtual machine can be migrated in and the available resource amount can meet the resource occupancy required by the virtual machine to be created, that is, the third host.

[0084] Reference Figure 8 FIG. 31 is a schematic structural diagram of an electronic device provided in Embodiment 2 of the present application. The electronic device can be a host in a cloud infrastructure device cluster.

[0085] In this embodiment, the electronic device may include the following structure:

[0086] An input interface 801, configured to read the resource record information of the cluster.

[0087] Among them, the resource record information includes the resource information of each host in the cluster. For specific content, reference can be made to Figure 3 that shown and the corresponding content above.

[0088] It should be noted that the input interface 801 can be an interface implementation capable of reading the resource information in the database.

[0089] The processor 802 is used to determine whether to migrate a virtual machine out or migrate a virtual machine in based on the resource information.

[0090] That is to say, in the cluster, each host can be used as the main electronic device for resource scheduling, and based on the current resource status of all hosts in the entire cluster, virtual machine resource scheduling is performed. For example, migrating a virtual machine from another host or migrating a virtual machine out to another host to achieve balanced resource scheduling.

[0091] As can be seen from the above solution, an electronic device provided in the second embodiment of the present application reads the resource record information of the cluster by the host in the cluster, thereby reading the resource information of each host included in the cluster, and then based on these resource information, it is determined whether the current host needs to migrate a virtual machine out or needs to migrate a virtual machine in, so as to achieve virtual machine resource scheduling. In this embodiment, there is no need to have a unified controller or manager in the cluster, but the resource scheduling work is assigned to each host. Each host determines whether the current host needs to perform resource scheduling, such as virtual machine migration out or virtual machine migration in, by judging the resource information of all hosts in the cluster, so as to achieve resource scheduling, achieve overall resource balance within the cluster, and achieve the purpose of the embodiment.

[0092] At the same time, in this embodiment, the trigger for virtual machine migration is initiated by the host in the cluster, rather than by unified scheduling. Therefore, the time for virtual machine migration can be easily dispersed, reducing the probability of large-scale virtual machine migration within the cluster.

[0093] In one implementation, the input interface 801 can read the resource record information of the cluster at preset time intervals.

[0094] The resource information of each host in the resource record information is stored separately by the host itself, and then read by the host performing resource balancing scheduling.

[0095] In one implementation, when the processor 802 determines whether to migrate a virtual machine out or migrate a virtual machine in based on the resource information, it can be implemented in the following manner:

[0096] When the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, mark the current host as a state where virtual machines need to be migrated out, determine the first virtual machine that needs to be migrated out in the current host, and based on the resource occupancy required by the first virtual machine, search for the first host in other hosts of the cluster that is in a state where virtual machines can be migrated in and the available resources meet the preset requirements. Update the resource information of the current host, the resource information of the first host, and the virtual machine information of the first virtual machine by the first host or the current host, so that the first virtual machine migrates out of the current host and migrates into the first host;

[0097] When the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, mark the current host as a state where virtual machines can be migrated in, and search for the second host in other hosts of the cluster that is in a state where virtual machines need to be migrated out. There is a second virtual machine in the second host that needs to be migrated out. Modify the resource information of the current host, the resource information of the second host, and the virtual machine information of the second virtual machine by the second host or the current host, so that the second virtual machine migrates out of the second host and migrates into the current host.

[0098] When the processor 802 creates a new virtual machine, it can be implemented in the following way:

[0099] Generate the resource information of the virtual machine to be created and store it in the resource record information. Based on the resource record information, search for the third host in the cluster that is in a state where virtual machines can be migrated in and the available resources meet the preset requirements. Update the resource information of the third host and the resource information of the virtual machine to be created by the third host, so that the virtual machine to be created is created on the third host.

[0100] The third host can be the current electronic device, that is, the current host, or other hosts in the cluster except the current host.

[0101] Reference Figure 9 , which is a schematic structural diagram of a cluster provided in Embodiment 3 of the present application. The cluster may include a database 901 and multiple hosts 902, and each host 902 is connected to the database 901, where:

[0102] The database 901 is used to store resource record information.

[0103] Among them, the resource record information includes the resource information of each host in the cluster. The resource information of each host is uploaded and stored by the host itself.

[0104] Another database may also be included in the cluster to back up and store the information in the database 901.

[0105] A host 902 for reading the resource record information and determining whether to migrate a virtual machine out or migrate a virtual machine in based on the resource information.

[0106] In a specific implementation, the host 902 is specifically configured to: when the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host 902, mark the current host as a state where a virtual machine needs to be migrated out; when the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host 902, mark the current host 902 as a state where a virtual machine can be migrated in.

[0107] After the host 902 marks itself as a state where a virtual machine needs to be migrated out, it can also determine the first virtual machine to be migrated out in the host, and based on the resource occupancy required by the first virtual machine, search for a host in other hosts of the cluster that is in a state where a virtual machine can be migrated in and the available resource amount meets the preset requirements, such as the first host. The first host or the current host 902 updates the resource information of the current host 902, the resource information of the first host, and the virtual machine information of the first virtual machine, so that the first virtual machine migrates out of the current host 902 and migrates into the first host.

[0108] After the host 902 marks the current host as a state where a virtual machine can be migrated in, it can also search for a second host in other hosts of the cluster that is in a state where a virtual machine needs to be migrated out. The second host has a second virtual machine that needs to be migrated out. The second host or the current host 902 modifies the resource information of the current host 902, the resource information of the second host, and the virtual machine information of the second virtual machine, so that the second virtual machine migrates out of the second host and migrates into the current host 902.

[0109] It should be noted that the host 902 can read the resource record information of the cluster at preset time intervals to perform resource scheduling. That is to say, each host in the cluster can perform resource balance scheduling regularly to further achieve resource balance.

[0110] The following takes Figure 9 the cluster shown in

[0111] For the hosts in the cluster, two roles can be set:

[0112] Seller: The host that needs to migrate out the virtual machine;

[0113] Buyer: The host that can migrate in the virtual machine.

[0114] In the information of the virtual machine, there is a transaction state "dealstate" used to describe the virtual machine transaction state between hosts, where:

[0115] Forsale: The state of being for sale, indicating that the virtual machine is in a state of waiting to be sold, that is, the virtual machine is in a state that needs to be migrated from the current host to other hosts;

[0116] Deal: The transaction is over, indicating that the transaction agreement has been completed between the seller and the buyer, and the actual operation of virtual machine migration or creation can begin.

[0117] And there can also be a "location" indicating the host to which the virtual machine belongs.

[0118] In the database of the cluster, the resource information and transaction information of each host are recorded, and data transactions are completed through the resource record information in the database, as Figure 10 shown in the overall deployment topology diagram of the cluster.

[0119] The database in the cluster can be a Cassandra database or a centralized database. As the data storage service of the centerless cloud infrastructure, the database stores the resource information and virtual machine information of the hosts, such as the number of occupied resources, the number of virtual machines, and the resources occupied by each virtual machine.

[0120] And after each host goes online and joins the cluster, its own resource information is written into the database. The resource information may have multiple dimensions, such as the number of virtual CPU cores, the size of virtual memory, disk space, egress bandwidth, etc.

[0121] In the hyper-converged infrastructure cloud scenario of the cluster in this embodiment, the creation of virtual machines can be initiated on each host. When a host creates a virtual machine or has too many resources occupied, the host searches for a suitable buyer host from the resource list and follows the following rules:

[0122] 1. The seller always selects the buyer with the most available resources or the most reserved resources and in an idle state (the idle state means not in a transaction state);

[0123] 2. If a failure occurs to the buyer during the transaction process, the seller needs to re-select a buyer and re-trigger the transaction;

[0124] 3. If a failure occurs to the seller during the transaction process, then the addition of the virtual machine needs to be re-triggered.

[0125] Taking the transaction between HOST1 and HOST2 as an example, the example of the seller triggering the transaction is described, as Figure 11 and Figure 12 shown in:

[0126] 1. Externally trigger HOST1 to create / migrate a virtual machine;

[0127] 2. HOST1 creates a data entry for virtual machine 4, such as information on the resources occupied by the virtual machine. The dealstate is set to forsale, the location is empty, and the state of the virtual machine is tobuild (pending creation, while running indicates that it has been created and is running). At the same time, query the cluster resource usage from the database and select a host HOST2 with the most available resources and in a transaction idle state (HOST2 may be HOST1 or another host);

[0128] 3. HOST1 initiates communication with HOST2 to inform that there are virtual machine resources to be traded. HOST2 can reply to accept. If HOST2 replies to reject, then HOST1 reselects a host from the host list and triggers the transaction again. If no host is available at this time, return creation failure;

[0129] 4. After HOST2 accepts the transaction, rewrite the data entry created by HOST1 before, such as the host to which the occupied resources belong, modify the dealstate to deal, and modify the location to the identifier of HOST2 itself;

[0130] 5. HOST2 completes the creation of the virtual machine. In the case of migration, it completes the migration action with HOST1. At this time, the virtual machine entry is maintained by HOST2, and the data entry of the virtual machine is modified according to the creation state.

[0131] Among them, in this embodiment, the virtual machine can also be destroyed and started on the seller's side, etc.

[0132] It should be noted that there is an optimization timer in the virtual machine management model of each host in the cluster. After the timer times out, a resource balancing scheduling operation will be triggered.

[0133] The above is the transaction model triggered by the seller. When the optimization timer times out, the seller host will modify the dealstate of the redundant virtual machines to forsale, and search for a suitable buyer host from the host list, and repeat the process of creating virtual machines above.

[0134] There is also a transaction model triggered by the buyer, that is, when the seller's optimization timer times out, only modify the transaction status of its redundant virtual machines, which is equivalent to listing them for sale in the market and waiting for the buyer to transact. And when the optimization timer of the buyer host times out, it will search for virtual machines for sale in the virtual machine list, and the buyer will initiate a transaction with the seller actively.

[0135] Taking the transaction between HOST1 and HOST2 as an example, the example of the transaction triggered by the buyer is described as followsFigure 13 and Figure 14 as shown in

[0136] 1. The optimization timer of HOST1 times out;

[0137] 2. HOST1 queries the global resource usage situation, confirms that it is a seller and needs to sell virtual machines;

[0138] 3. HOST1 changes the transaction status of its redundant virtual machines to forsale;

[0139] 4. The optimization timer of HOST2 times out;

[0140] 5. HOST1 queries the global resource usage situation, confirms that it is a buyer and needs to acquire virtual machines;

[0141] 6. HOST2 queries the virtual machine for sale information and selects the virtual machine of HOST1 as the acquisition target;

[0142] 7. HOST2 initiates communication with HOST1 to trade virtual machines. If the transaction fails, it will re-select the virtual machine transaction object;

[0143] 8. HOST2 changes the location of the virtual machine to HOST2 and changes the transaction status to deal;

[0144] 9. The trading parties complete the migration of the virtual machine;

[0145] 10. HOST2 starts to maintain the virtual machine status and database entries.

[0146] Among them, in this embodiment, the virtual machine can also be destroyed and started on the seller side, etc.

[0147] As can be seen from the above solution, in this embodiment, it is applicable to the scenario of hyper-converged cloud infrastructure without central scheduling. The trigger of virtual machine migration is initiated by the host rather than by unified scheduling. Therefore, the migration time can be easily dispersed, and the probability of large-scale migration within the cluster is relatively small. In addition, the trading model can easily record the migration records of virtual machines, and the peer-to-peer migration between hosts has little impact even if a failure occurs, and there are many means for repair. The trading model dynamically shows the resource utilization within the cluster and can provide more abundant resource utilization data and resource flow data.

[0148] It should be noted that the various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0149] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.

[0150] The above has introduced in detail a data processing method, an electronic device and a cluster provided by the present invention. The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data processing method is applied to each host in a cluster. Each host can be the subject of resource scheduling without the need for a unified controller or manager in the cluster. The work of resource scheduling is distributed to each host. The method includes: Each host reads the resource record information of the cluster, and the resource record information includes the resource information of each host in the cluster; Based on the resource information, each host determines whether the current host needs to migrate out a virtual machine or migrate in a virtual machine by judging the resource information of all hosts in the cluster, so as to disperse the time of virtual machine migration.

2. The method according to claim 1, wherein, judging whether to migrate out a virtual machine or migrate in a virtual machine based on the resource information includes: When the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, mark the current host as a state that needs to migrate out a virtual machine; When the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, mark the current host as a state that can migrate in a virtual machine.

3. The method according to claim 2, wherein, after marking the current host as a state that needs to migrate out a virtual machine, it further includes: Determine the first virtual machine that needs to be migrated out in the current host.

4. The method according to claim 3, wherein, after determining the first virtual machine that needs to be migrated out in the current host, the method further includes: Based on the resource occupancy required by the first virtual machine, find the first host in other hosts of the cluster that is in a state of being able to migrate in a virtual machine and the available resource amount meets the preset requirements. The first host or the current host updates the resource information of the current host, the resource information of the first host, and the virtual machine information of the first virtual machine, so that the first virtual machine migrates out of the current host and migrates into the first host.

5. The method according to claim 2, wherein, after marking the current host as a state that can migrate in a virtual machine, it further includes: Find the second host in other hosts of the cluster that is in a state of needing to migrate out a virtual machine. There is a second virtual machine in the second host that needs to be migrated out. The second host or the current host modifies the resource information of the current host, the resource information of the second host, and the virtual machine information of the second virtual machine, so that the second virtual machine migrates out of the second host and migrates into the current host.

6. The method according to claim 1, wherein, reading the resource record information of the cluster includes: Read the resource record information of the cluster at preset time intervals.

7. The method according to claim 1, wherein, The resource information of each host in the resource record information is stored separately by the host.

8. The method according to claim 1, wherein, it further includes: Generate the resource information of the virtual machine to be created and store it in the resource record information; Based on the resource record information, find a third host in the cluster that is in a state where a virtual machine can be migrated in and whose available resources meet the preset requirements. Update the resource information of the third host and the resource information of the virtual machine to be created by the third host, so that the virtual machine to be created is created on the third host.

9. An electronic device, which is a host in a cluster. Each host in the cluster can be the subject of resource scheduling. Without the need for a unified controller or manager in the cluster, the work of resource scheduling is assigned to each host. The electronic device comprises: An input interface for reading the resource record information of the cluster, where the resource record information includes the resource information of each host in the cluster; A processor for, based on the resource information, determining by each host whether the current host needs to migrate out a virtual machine or migrate in a virtual machine by judging the resource information of all hosts in the cluster, so as to disperse the time of virtual machine migration.

10. A cluster, comprising a database and multiple hosts. Each host can be the subject of resource scheduling. Without the need for a unified controller or manager in the cluster, the work of resource scheduling is assigned to each host. Wherein: The database is used to store resource record information, and the resource record information contains the resource information of each host in the cluster; The host is used to read the resource record information, and based on the resource information, determining by each host whether the current host needs to migrate out a virtual machine or migrate in a virtual machine by judging the resource information of all hosts in the cluster, so as to disperse the time of virtual machine migration.

11. The cluster according to claim 10, characterized in that: The host is specifically used for: when the average resource occupancy of all hosts in the resource information is less than the current resource occupancy of the current host, marking the current host as a state where a virtual machine needs to be migrated out; when the average resource occupancy of all hosts in the resource information is greater than the current resource occupancy of the current host, marking the current host as a state where a virtual machine can be migrated in.

Citation Information

Patent Citations

  • Virtualization cluster resource scheduling method and device

    CN103677958A

  • Method and device for acquiring resource utilization situation

    CN103942105A

  • Cloud computing based virtual machine load balancing method

    CN105740074A