WO2017148296A1 - 一种应用归属服务集群的分配方法和装置 - Google Patents

一种应用归属服务集群的分配方法和装置 Download PDF

Info

Publication number
WO2017148296A1
WO2017148296A1 PCT/CN2017/074172 CN2017074172W WO2017148296A1 WO 2017148296 A1 WO2017148296 A1 WO 2017148296A1 CN 2017074172 W CN2017074172 W CN 2017074172W WO 2017148296 A1 WO2017148296 A1 WO 2017148296A1
Authority
WO
WIPO (PCT)
Prior art keywords
allocation
applications
application
allocation result
service cluster
Prior art date
Application number
PCT/CN2017/074172
Other languages
English (en)
French (fr)
Inventor
刘剑波
Original Assignee
阿里巴巴集团控股有限公司
刘剑波
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 刘剑波 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017148296A1 publication Critical patent/WO2017148296A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/04Wireless resource allocation
    • H04W72/044Wireless resource allocation based on the type of the allocated resource
    • H04W72/0453Resources in frequency domain, e.g. a carrier in FDMA
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/04Wireless resource allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/50Allocation or scheduling criteria for wireless resources
    • H04W72/52Allocation or scheduling criteria for wireless resources based on load
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/50Allocation or scheduling criteria for wireless resources
    • H04W72/56Allocation or scheduling criteria for wireless resources based on priority criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/02Processing of mobility data, e.g. registration information at HLR [Home Location Register] or VLR [Visitor Location Register]; Transfer of mobility data, e.g. between HLR, VLR or external networks

Definitions

  • the present application relates to the field of data processing technologies, and in particular, to a method for allocating a home service cluster and a device for allocating a home service cluster.
  • the consumption is mainly the one-time acquisition cost of the cluster and the cumulative bandwidth consumption cost generated by the inter-cluster communication between the clusters.
  • cross-cluster communication is mainly caused by data access between applications in different clusters. Therefore, the allocation optimization requirement for the application home service cluster is generated, so that the constraints of calculation and storage can be maximized. Reduce the acquisition cost and bandwidth consumption cost of the cluster.
  • the allocation method of the application home service cluster mainly relies on the user to allocate by experience, but the method requires a lot of manpower, material resources and time, resulting in low allocation efficiency. Moreover, the allocation scheme may not be the optimal solution, resulting in a waste of costs.
  • the distribution plan also needs to verify whether it is applicable to the current distributed system, and when it is not applicable, the allocation plan needs to be re-determined. Therefore, the current allocation method may require manual re-allocation, increasing the cost of manpower, material and time, and further reducing the distribution efficiency.
  • embodiments of the present application have been made in order to provide an application home service cluster allocation method and corresponding method that overcomes the above problems or at least partially solves the above problems.
  • a distribution device that applies a home service cluster.
  • the present application discloses a method for allocating a home service cluster, including:
  • the service cluster to which the application belongs is replaced multiple times, and multiple new allocation results are obtained;
  • the allocation result with the smallest resource consumption is selected as the optimal allocation result.
  • the allocating the plurality of applications to the plurality of service clusters is:
  • the application allocation is performed for each service cluster according to the order until all the applications are allocated to a certain service cluster; wherein, for the service clusters that are sorted, the application allocation is performed in the remaining applications after the distribution of the preceding service clusters.
  • the method before the allocating the multiple applications to the multiple service clusters, the method further includes:
  • the plurality of service clusters are sorted according to at least one load performance of the service cluster.
  • the method before the performing application allocation for each service cluster according to the sorting, the method further includes:
  • the application allocation for each service cluster according to the ordering includes:
  • the performing application allocation for each service cluster according to the ranking further includes:
  • Unallocated applications are randomly assigned to a service cluster one by one by sorting.
  • the method before the allocating the multiple applications to the multiple service clusters, the method further includes:
  • a node network diagram including multiple applications is constructed, and the associated weight is an edge weight of an edge connecting the two applications.
  • the two target applications with the largest selection association weight include:
  • the selecting a plurality of associated applications with the associated weights of the one of the target applications is:
  • a breadth-first search is performed starting from two target nodes of the target edge;
  • the maximum number of associated nodes is selected according to the edge weight of the target node from large to small, and the load performance of the service cluster is not exceeded.
  • the method further includes:
  • the replacing the service cluster to which the application belongs multiple times, and obtaining a plurality of newly added distribution results include:
  • one application is randomly selected for exchange until a plurality of new allocation results are obtained.
  • the replacing the service cluster to which the application belongs multiple times, and obtaining a plurality of newly added distribution results further includes:
  • two allocation results are selected in turn, randomly assigned from two Select two applications in the result, and exchange the service clusters to which the selected two applications belong, and obtain multiple new allocation results;
  • one application is randomly selected for exchange, and after obtaining a plurality of newly added allocation results, the method further includes:
  • the calculating the resource consumption amount of the initial allocation result and the newly added allocation result to the service cluster includes:
  • the allocation result with the smallest selected resource consumption as the optimal allocation result includes:
  • the newly obtained allocation result is used as the current optimal allocation.
  • the result is compared to the next new allocation result until the optimal allocation result is obtained.
  • the application also provides a distribution device applying a home service cluster, including:
  • a resource consumption calculation module configured to calculate a resource consumption amount of the initial allocation result and the new allocation result to the service cluster
  • the optimal allocation result selection module is configured to select an allocation result with the smallest resource consumption as the optimal allocation result.
  • the application initial allocation module is specifically configured to:
  • the application allocation is performed for each service cluster according to the order until all the applications are allocated to a certain service cluster; wherein, for the service clusters that are sorted, the application allocation is performed in the remaining applications after the distribution of the preceding service clusters.
  • the device further comprises:
  • the service cluster sorting module is configured to sort the multiple service clusters according to at least one load performance of the service cluster.
  • the device further comprises:
  • An association weight calculation module configured to calculate an association weight between any two applications
  • the application initial allocation module includes:
  • the associated application allocation sub-module is configured to select two target applications with the largest associated weight from among the currently selected multiple applications, and select multiple related applications with the associated weights of one of the target applications, and allocate To the service cluster.
  • the device further comprises:
  • An application sorting module configured to sort unallocated applications according to required resource consumption if at least one application is not allocated to the service cluster;
  • the application random allocation module is not allocated, and the unallocated applications are randomly assigned to a service cluster one by one according to the sorting.
  • the device further comprises:
  • a node network diagram building module for using the application as a node to have two data exchanges
  • the application is a neighboring node, and a node network diagram including a plurality of applications is constructed, and the association weight is an edge weight of an edge connecting the two applications.
  • the associated application allocation submodule comprises:
  • the target edge search subunit is used to find the target edge with the largest edge weight in the node network graph.
  • the associated application allocation submodule comprises:
  • a breadth-first search sub-unit configured to perform a breadth-first search in the sub-graph including the target edge, starting from two target nodes of the target edge;
  • the associated node selection subunit is configured to select the maximum number of associations from the plurality of associated nodes that are searched according to the weight of the edge of the target node from large to small, without exceeding the load performance of the service cluster. node.
  • the device further comprises:
  • a new allocation result determination module is configured to determine that the newly added allocation result after replacement does not exceed the load performance of each service cluster.
  • the applying the module multiple times comprises:
  • the application switching sub-module is configured to randomly select one application for exchange in two randomly selected service clusters until multiple new allocation results are obtained.
  • the applying the module multiple times comprises:
  • the service cluster interaction sub-module is configured to sequentially select two allocation results for the currently obtained allocation result, randomly select two applications from the two distribution results, and exchange the service clusters to which the selected two applications belong, and obtain Multiple new assignment results
  • the service cluster modification sub-module is configured to randomly select an application and modify the service cluster to which the selected application belongs, and obtain a plurality of newly added allocation results.
  • the device further comprises:
  • the allocation result screening module is configured to filter a plurality of distribution results in which the resource consumption is ranked from small to large.
  • the resource consumption calculation module includes:
  • a cluster purchase cost calculation sub-module configured to calculate a cluster acquisition cost required for each of the initial allocation result and the new allocation result
  • a bandwidth consumption cost calculation sub-module configured to calculate a bandwidth consumption cost of each application across the cluster in the initial allocation result and the new allocation result; summing bandwidth consumption cost of each application, obtaining the initial allocation result, and the The total bandwidth consumption cost of the new allocation result.
  • the optimal allocation result selection module comprises:
  • the distribution result comparison sub-module is configured to: for the newly obtained allocation result that is currently obtained, if the resource consumption of the newly obtained new allocation result is smaller than the resource consumption amount of the initial allocation result, the currently obtained new The result of the allocation is used as the current optimal allocation result, and compared with the next new allocation result until the optimal allocation result is obtained.
  • multiple replacement processing of the service cluster to which the application belongs is performed based on the initial allocation result, to obtain a plurality of newly added allocation results, and calculation and comparison of resource consumption of the service cluster by using a plurality of newly added allocation results. Therefore, the optimal allocation result is determined, thereby improving the allocation efficiency of the application home service cluster, and ensuring that the obtained allocation scheme can effectively save the resource consumption cost of the service cluster.
  • the embodiment of the present application can automatically determine an optimal allocation result for a dynamically changing distributed system, and does not need to manually perform multiple allocations, thereby further improving the allocation efficiency of the application home service cluster.
  • Embodiment 1 is a flow chart showing the steps of Embodiment 1 of a method for allocating a home service cluster according to the present application;
  • Embodiment 3 is a structural block diagram of Embodiment 1 of a device for allocating a home service cluster according to the present application;
  • Embodiment 4 is a structural block diagram of Embodiment 1 of a device for allocating a home service cluster according to the present application;
  • FIG. 5 is a schematic diagram of a construction based on a node network diagram of the present application.
  • FIG. 6 is a schematic diagram of an allocation result of applying a home service cluster according to the present application.
  • FIG. 1 a flow chart of a first embodiment of a method for allocating a home service cluster according to the present application is shown.
  • the method may include the following steps:
  • step 101 multiple applications are allocated to multiple service clusters to obtain initial allocation results.
  • the above application may be a collection of data and programs for logically isolating units of different home data and calculations.
  • An application can also be understood as a concept of a data instance in a relational database.
  • a distributed system can have multiple service clusters.
  • a service cluster consists of a group of computers or groups of computers that are independent of each other and interconnected by a network.
  • a service cluster provides storage and computing power in a holistic manner. Communication tasks such as data interaction can be performed between different service clusters through network transmission.
  • multiple applications may be first allocated to multiple service clusters to obtain an initial allocation result.
  • the initial allocation method can be various, for example, it can be randomly assigned, or multiple service clusters can be sorted according to the load performance of the service cluster, and the applications are allocated according to the order.
  • Step 102 Replace the service cluster to which the application belongs, and obtain multiple new allocation results.
  • the service cluster to which the application belongs may be replaced multiple times. Each replacement will result in a new assignment result, which will result in multiple new assignments after multiple replacements. It can be replaced randomly when changing, or it can be replaced according to certain rules. For example, the service cluster number is replaced in the order of numbering. The embodiment of the present application does not limit the manner of replacement.
  • the method may further include:
  • the candidate allocation result as the optimal allocation result needs to meet the load performance of the service cluster to ensure that the allocation result can be implemented. Therefore, after the service cluster to which the application belongs is replaced, it is determined that the load performance of each service cluster can still satisfy the allocation result.
  • Step 103 Calculate a resource consumption amount of the initial allocation result and the new allocation result to the service cluster.
  • the service cluster has different acquisition costs, maximum storage capacity, and total CPU count according to the number of computers it contains.
  • Each service cluster also has a certain export bandwidth; each application allocated in the service cluster needs to be certain.
  • Storage space applications may also need to interact with each other, that is, have a certain amount of data exchange. Data exchange across clusters consumes a certain cluster's egress bandwidth, resulting in export bandwidth costs.
  • different application allocation schemes will result in different cluster acquisition costs and bandwidth consumption costs.
  • the applications that each cluster can store and run are also subject to certain constraints.
  • the optimal allocation result can be the total purchase of N' clusters.
  • Set cost + cross-cluster bandwidth consumption cost is minimal.
  • the optimal allocation result may be defined by a person skilled in the art according to actual conditions, for example, only the total acquisition cost of the cluster is minimized as an optimal allocation result, or the total acquisition cost of the cluster + the maintenance cost is the minimum distribution. result.
  • the resource consumption of the service cluster may include the cost of cluster acquisition and/or bandwidth consumption, or other costs of configuring the cluster and running the cluster.
  • the resource consumption of the service cluster by the initial allocation result and the plurality of newly added allocation results can be calculated to further compare the resource consumption of each allocation result.
  • Step 104 Select an allocation result with the smallest resource consumption as the optimal allocation result.
  • the allocation result with the smallest resource consumption amount may be selected as the optimal allocation result.
  • it may be compared with the initial allocation result. If the resource consumption of the newly added allocation result is less than the resource consumption of the initial allocation result, the new allocation result is used as the optimal allocation. result. It is also possible to further obtain the next newly added allocation result, compare it with the previous newly added allocation result, and repeat the multiple new allocation result acquisition and comparison until the optimal allocation result is obtained. It is also possible to use the allocation result with the smallest resource consumption as the optimal allocation result after a certain number of comparisons with the newly added allocation result.
  • multiple replacement processing of the service cluster to which the application belongs is performed based on the initial allocation result, to obtain a plurality of newly added allocation results, and calculation and comparison of resource consumption of the service cluster by using a plurality of newly added allocation results. Therefore, the optimal allocation result is determined, thereby improving the allocation efficiency of the application home service cluster, and ensuring that the obtained allocation scheme can effectively save the resource consumption cost of the service cluster.
  • the embodiment of the present application can automatically determine an optimal allocation result for a dynamically changing distributed system, and does not need to manually perform multiple allocations, thereby further improving the allocation efficiency of the application home service cluster.
  • FIG. 2 an embodiment of an application method for assigning a home service cluster of the present application is shown.
  • the flow chart of the steps of the second step may specifically include the following steps:
  • Step 201 Sort multiple service clusters according to at least one load performance of the service cluster.
  • the above load performance may include at least one of a maximum storage capacity of each service cluster, a total CPU count, and an average export bandwidth cost between service clusters.
  • Load performance can also include processing power metrics for other service clusters.
  • Multiple service clusters can be sorted by the load performance of the service cluster.
  • the specific sorting manner may be various, for example, sorting according to different load performances, or setting weights for load performance, and sorting according to comprehensive weights of multiple load performances of the service cluster. Sorting can be ascending or descending. A person skilled in the art can perform the sorting according to the load performance according to the actual situation, which is not limited by the embodiment of the present application.
  • Step 202 Perform application allocation for each service cluster according to the order, until all applications are allocated to a service cluster; wherein, for the service clusters that are sorted, the application distribution is performed in the remaining applications after the service cluster allocation of the previous order. , get the initial allocation result.
  • the application allocation can be performed by sorting.
  • assigning the application can be preferentially assigned to the service cluster with the highest ranking.
  • the remaining applications are allocated to the sorted service cluster.
  • the allocation may have certain constraints.
  • the total amount of data that can be allocated by the service cluster does not exceed 90% of the maximum storage capacity of the service cluster; or the application in the service cluster is served at any point in time.
  • the memory and CPU consumption of the cluster does not exceed 80% of its maximum processing capacity; or, a single application may not be assigned to different service clusters separately, but must be completely assigned to the same service cluster; or a combination of the above multiple constraints may be used. .
  • constraints or combinations of constraints according to actual conditions. The embodiments of the present application do not limit the specific content of the constraints and the combination of the constraints.
  • the process of applying allocation to each service cluster can be processed cyclically until all applications are assigned to an application, and finally the initial allocation result is obtained. Or until the constraints are no longer met.
  • the sorting is performed for each service cluster.
  • the method may further include:
  • the performing application allocation for each service cluster according to the ordering may include:
  • the amount of data exchange between any two applications can be calculated as the associated weight between applications. After calculating the associated weights between all applications, you can select the two applications with the largest associated weight as the target application. Based on the selected two target applications, other related applications with a large associated weight with any one of the target applications may be selected and allocated to the service cluster to which the target application belongs.
  • the services in the same service cluster can exchange data without consuming the egress bandwidth of the service cluster, you can allocate applications with large data exchange capacity to the same service cluster as much as possible to reduce service clusters. The amount of data exchange reduces the bandwidth usage of the service cluster.
  • the performing application allocation for each service cluster according to the ranking further includes:
  • the unallocated applications are sorted according to the required resource consumption; the unallocated applications are randomly assigned to a service cluster one by one according to the order.
  • the unallocated applications may be sorted in descending order according to the resource consumption of the unallocated applications, and the unallocated applications are randomly allocated one by one to a service cluster that can accommodate the application. Among them, the random allocation may be repeated several times until it is assigned to a service cluster that can accommodate the application.
  • the required resource consumption may be a combination of at least one or more of an acquisition cost, a bandwidth occupation, a storage space required for the application, and a memory consumption required by the application runtime.
  • the method may further include:
  • a node network diagram including multiple applications is constructed, and the associated weight is an edge weight of an edge connecting the two applications.
  • the initial assignment result can be obtained by means of the graph algorithm based on the application composition graph model.
  • the application may be used as a node of the graph, and any two applications with data exchange are used as adjacent nodes, and the associated weights of the data exchange amount between the applications are used as the edge weights of the edges of the two application nodes, thereby constructing and including A node network diagram with multiple applications.
  • the two target applications that select the largest associated weight include:
  • the edge weights of the two nodes in the node network diagram represent the association weights between the two applications.
  • the two target applications with the largest associated weights can be found by finding the target edge with the largest weight on the node network map.
  • the target edge is connected to two nodes, that is, corresponding to the two target applications with the largest associated weight.
  • the selecting a plurality of associated applications in which the associated weights of the one of the target applications are ranked may include:
  • Sub-step S11 in the sub-picture including the target side, the breadth-first search is performed starting from the two target nodes of the target side.
  • Sub-step S12 selecting, from the plurality of associated nodes, the maximum number of associated nodes according to the edge weight of the target node from large to small, without exceeding the load performance of the service cluster.
  • a node containing the target edge can be formed into a subgraph, and the breadth first search (BFS) is started from the target node.
  • BFS breadth first search
  • Breadth-first search is a graph search algorithm, which is different from depth-first search. It starts from a certain node and traverses each node along the width of the graph until the nodes in the graph are accessed.
  • the largest number of associated nodes may be selected according to the order weight of the target nodes, and the load performance of the service cluster is selected, that is, the target is selected.
  • the associated weights of the application are sorted by the top multiple related applications.
  • FIG. 5 shows a schematic diagram of a node network diagram based on the present application.
  • the application is used as a node, and the associated weight between applications is used as the edge weight of the node.
  • the target edge with the largest edge weight is not found, and the target application corresponding to the two nodes connected by the target edge needs to meet certain constraints.
  • the breadth-first search is started from the target node, and the other nodes adjacent to the target node are continuously expanded in the order of the edge weights from large to small, and the other in the sub-picture is A node is added to a tile formed by a target node and a plurality of associated nodes until all nodes in the subgraph are associated, or the constraint cannot be satisfied.
  • Node 1, Node 2, Node 3, and Node 4 in Figure 5 form one tile, and Node 5, Node 6 and Node 9, and Node 7 and Node 8, respectively, form additional tiles.
  • the application 1, the application 2, the application 3, and the application 4 are assigned to one service cluster, and the application 5, the application 6 and the application 9 and the application 7 and the application 8 are respectively allocated to the other two service clusters.
  • FIG. 6 a schematic diagram of an allocation result of applying a home service cluster according to the present application is shown. As shown in FIG. 6, the above nine applications are respectively assigned to the service cluster A, the service cluster B, and the service cluster C.
  • association weight between the application and the application to construct the node network graph based on the edge weights of each node, how to make the data exchange between the applications allocated to the same service cluster as large as possible, and at the same time make the data exchange between the service clusters
  • the problem of being as small as possible is converted into a problem of how to make the weights of multiple applications within the tile as large as possible and the edge weight between the tiles as small as possible.
  • the sum of the edge weights between multiple nodes within the tile is as large as possible, and the sum of the edge weights between the tiles is as large as possible. small. That is, the amount of data exchange between applications of the same service cluster is as large as possible, and the amount of data exchange between service clusters is as small as possible.
  • Step 203 Replace the service cluster to which the application belongs, and obtain multiple new allocation results.
  • the step 203 may include:
  • Sub-step S21 in the randomly selected two service clusters, one application is randomly selected for exchange until a plurality of newly added allocation results are obtained.
  • the method may further include: screening a plurality of allocation results in which the resource consumption amount is ranked from small to large.
  • the plurality of newly added allocation results that are currently obtained may be sorted according to the resource consumption amount from small to large, and the plurality of allocation results of the top ranking are filtered out.
  • the step 203 may include: sub-step S22, sequentially selecting two allocation results for the currently obtained allocation result, randomly selecting two applications from the two distribution results, and selecting The service clusters to which the two applications belong are exchanged to obtain multiple new allocation results.
  • two allocation results may be selected in order, and two applications are respectively selected in the selected distribution result, and the service clusters to which the selected two applications belong are exchanged, thereby generating a new one. Increase the distribution result. Multiple exchanges can be repeated to obtain multiple new assignment results.
  • the step 203 may include:
  • Sub-step S23 randomly selecting an application and modifying the service cluster to which the selected application belongs, and obtaining a plurality of newly added allocation results.
  • Step 204 Calculate a resource consumption amount of the initial allocation result and the new allocation result to the service cluster.
  • the step 204 may include:
  • Sub-step S31 calculating a cluster acquisition cost required for each of the initial allocation result and the new allocation result.
  • the cluster acquisition cost required for each allocation result can be calculated for the initial allocation result and the newly added allocation result.
  • step S32 calculating a bandwidth consumption cost of each application across the cluster in the initial allocation result and the newly added allocation result; adding bandwidth consumption cost of each application, obtaining the initial allocation result and the new Increase the total bandwidth consumption cost of the distribution result.
  • the bandwidth consumption cost of the service cluster when cross-cluster interaction data between applications is calculated for each initial allocation result and a plurality of newly added allocation results.
  • the bandwidth consumption cost of each application is added to obtain the total bandwidth consumption cost of each allocation result.
  • the above sub-steps S21 and 204 can use the Simulated Annealing (SA) method to obtain new allocation results, and calculate the resource consumption of each new allocation result to the service cluster to finally obtain the optimal. Processing of the distribution result.
  • SA Simulated Annealing
  • the simulated annealing algorithm is a generalized probability algorithm that is commonly used to calculate optimal results in a large search space.
  • the concept of the initial solution state S in the simulated annealing algorithm can be used to represent the initial allocation result, that is, the starting point of the iterative calculation; S' can represent the newly added allocation result.
  • S' can represent the newly added allocation result.
  • the foregoing sub-steps S22, S23, and 204 may use a genetic algorithm (GA) to obtain new allocation results and calculate resource consumption of each new allocation result to the service cluster, so as to obtain an optimal optimal result. Processing of the distribution result.
  • the genetic algorithm is a random search method derived from the evolutionary laws of the biological world.
  • each application can be encoded as a chromosome
  • M applications are numbered from 0-M
  • N service clusters are numbered from 0-N to obtain an M-dimensional chromosome vector, each dimension representing an application, corresponding to a value. [0, N) indicates the cluster index currently assigned by the application, that is, the service cluster number to which the application belongs.
  • the fitness in the initial population P(0) is calculated, and the fitness can be obtained by calculating the reciprocal of the resource consumption required for the distribution result. The greater the resource consumption required to allocate results, the lower the fitness, and vice versa.
  • the evaluation function and the fitness are representations of the resource consumption required for the distribution result, and those skilled in the art can arbitrarily select according to the actual situation.
  • the evaluation can be used.
  • the function represents the resource consumption required for the allocation result; when the simulated annealing algorithm is used to obtain the new allocation result, the fitness consumption of the allocation result can also be expressed by the fitness degree.
  • the crossover operation can be performed on the chromosomes, and the crossover operator is applied to the group.
  • two chromosomes can be randomly selected in the chromosome of the initial population P(0), and the values are mutually exchanged under the premise that the constraint condition is met, that is, the service clusters to which the two applications belong are exchanged, and the new allocation result is obtained.
  • the mutation operation may be performed on the chromosome, and the mutation operator is applied to the group. That is, changes in gene values at certain loci of individual strings in a population.
  • a chromosome may be randomly selected in the chromosome of the initial population P(0), and the index value is modified on the premise that the constraint condition is satisfied, that is, an application is randomly selected and the service cluster to which the selected application belongs is modified to obtain a new one. Increase the distribution result.
  • the specific processing for calculating the resource consumption by using the genetic algorithm framework may be Calculate the fitness of the population P(t+1).
  • the evolutionary algebra t accumulates to the maximum evolution algebra T, and then terminates the iterative calculation, and the group with the greatest fitness in the evolution process is taken as the optimal solution, that is, the optimal distribution result.
  • sub-step S21 - sub-step S23 is only an example. In an actual application, a plurality of newly added allocation results may be obtained in a different order according to one or more manners provided above. For example, sub-step S21 is performed first, sub-step S23 is performed, and sub-step S22 is finally performed.
  • the optimal distribution result can be obtained by using a combination of simulated annealing algorithm and genetic algorithm in various ways.
  • a simulated annealing algorithm can be used to obtain a large number of distribution results, and then the genetic algorithm is used to control the optimization direction of the distribution result so as to approach the optimal distribution result; or the mutation operation in the genetic algorithm can be used first to obtain a number of new allocation results.
  • the crossover operation in the genetic algorithm is used to obtain the optimal allocation result.
  • the resource consumption calculated by the two algorithms may be consumed by the same kind of resources, or may be different.
  • the resource consumption calculated by the simulated annealing algorithm is directed to the consumption of the cluster acquisition cost, and the genetic algorithm calculates the bandwidth cost consumption.
  • Step 205 If the resource consumption of the currently added new allocation result is smaller than the resource consumption quantity of the initial allocation result, the currently added new allocation result is used as the current The optimal allocation result is compared with the next new allocation result until the optimal allocation result is obtained.
  • the newly obtained allocation result can be compared with the resource consumption of the initial allocation result. If the resource consumption of the newly added allocation result is smaller than the resource consumption of the initial allocation result, the newly added allocation result is used as the current optimal allocation result, and vice versa, the next new allocation result and the initial allocation are continued. The resulting resource consumption is compared. For the current optimal allocation result, it can be compared with the next new allocation result, and the comparison is repeated and the current optimal allocation result is determined until the allocation result with the smallest resource consumption is obtained, which is taken as the optimal allocation result.
  • the number of occurrences of the comparison result of the resource consumption of the cluster with the new allocation result greater than the initial allocation result is counted, and when the number of occurrences exceeds the preset number, the resource consumption of the candidate allocation result is minimized.
  • the result of the allocation is used as the optimal allocation result.
  • the initial allocation result is obtained through the node network graph, and the optimal allocation result is further obtained by the simulated annealing algorithm and/or the genetic algorithm, thereby improving the efficiency of applying the home service cluster allocation. Moreover, the resulting allocation scheme is closer to the optimal solution, saving the cost of distributed system deployment and operation.
  • the embodiment of the present application can automatically determine an optimal allocation result for a dynamically changing distributed system, and does not need to manually perform multiple allocations, thereby further improving the allocation efficiency of the application home service cluster.
  • Embodiment 1 of a device for assigning a home service cluster of the present application is shown, which may specifically include the following modules:
  • the application initial allocation module 301 is configured to allocate multiple applications to multiple service clusters to obtain initial allocation results.
  • the application module 302 is applied to replace the service cluster to which the application belongs multiple times, and multiple new allocation results are obtained.
  • the resource consumption calculation module 303 is configured to calculate a resource consumption amount of the initial allocation result and the new allocation result to the service cluster.
  • the optimal allocation result selection module 304 is configured to select an allocation result with the smallest resource consumption as the optimal allocation result.
  • multiple replacement processing of the service cluster to which the application belongs is performed based on the initial allocation result, to obtain a plurality of newly added allocation results, and calculation and comparison of resource consumption of the service cluster by using a plurality of newly added allocation results. Therefore, the optimal allocation result is determined, thereby improving the allocation efficiency of the application home service cluster, and ensuring that the obtained allocation scheme can effectively save the resource consumption cost of the service cluster.
  • the embodiment of the present application can automatically determine an optimal allocation result for a dynamically changing distributed system, and does not need to manually perform multiple allocations, thereby further improving the allocation efficiency of the application home service cluster.
  • FIG. 4 a structural block diagram of a second embodiment of a device for assigning a home service cluster of the present application is shown, which may specifically include the following modules:
  • the service cluster sorting module 401 is configured to sort the plurality of service clusters according to at least one load performance of the service cluster.
  • the node network diagram construction module 402 is configured to use the application as a node, and use two applications with data exchange as adjacent nodes to construct a node network diagram including multiple applications, where the association weight is an edge connecting two applications.
  • the edge weight is an edge connecting two applications.
  • the initial allocation module 403 is configured to allocate multiple applications to multiple service clusters to obtain initial allocation results.
  • the application module 404 is applied to replace the service cluster to which the application belongs multiple times, and multiple new allocation results are obtained.
  • the resource consumption calculation module 405 is configured to calculate a resource consumption amount of the initial allocation result and the new allocation result to the service cluster.
  • the optimal allocation result selection module 406 is configured to select an allocation result with the smallest resource consumption as the optimal allocation result.
  • the application initial allocation module 403 may be specifically configured to:
  • the application allocation is performed for each service cluster according to the order until all the applications are allocated to a certain service cluster; wherein, for the service clusters that are sorted, the application allocation is performed in the remaining applications after the distribution of the preceding service clusters.
  • the apparatus may further include:
  • the associated weight calculation module is configured to calculate an association weight between any two applications.
  • the application initial allocation module 403 can include:
  • the associated application allocation sub-module is configured to select two target applications with the largest associated weight from among the currently selected multiple applications, and select multiple related applications with the associated weights of one of the target applications, and allocate To the service cluster.
  • the apparatus may further include:
  • the application sorting module is configured to sort the unallocated applications according to the required resource consumption if at least one application is not allocated to the service cluster.
  • the application random allocation module is not allocated, and the unallocated applications are randomly assigned to a service cluster one by one according to the sorting.
  • the associated application allocation submodule may include include:
  • the target edge search subunit is used to find the target edge with the largest edge weight in the node network graph.
  • the associated application allocation submodule may include:
  • the breadth-first search sub-unit is configured to perform a breadth-first search in the sub-graph including the target edge starting from two target nodes of the target edge.
  • the associated node selection subunit is configured to select the maximum number of associations from the plurality of associated nodes that are searched according to the weight of the edge of the target node from large to small, without exceeding the load performance of the service cluster. node.
  • the apparatus may further include:
  • a new allocation result determination module is configured to determine that the newly added allocation result after replacement does not exceed the load performance of each service cluster.
  • the application multiple replacement module 404 may include:
  • the application switching sub-module is configured to randomly select one application for exchange in two randomly selected service clusters until multiple new allocation results are obtained.
  • the application multiple replacement module 404 may include:
  • the service cluster interaction sub-module is configured to sequentially select two allocation results for the currently obtained allocation result, randomly select two applications from the two distribution results, and exchange the service clusters to which the selected two applications belong, and obtain Multiple new assignment results.
  • the service cluster modification sub-module is configured to randomly select an application and modify the service cluster to which the selected application belongs, and obtain a plurality of newly added allocation results.
  • the apparatus may further include:
  • the allocation result screening module is configured to filter a plurality of distribution results in which the resource consumption is ranked from small to large.
  • the resource consumption calculation module 405 may include:
  • the cluster purchase cost calculation sub-module is configured to calculate a cluster acquisition cost required for each of the initial allocation result and the new allocation result.
  • a bandwidth consumption cost calculation sub-module configured to calculate a bandwidth consumption cost of each application across the cluster in the initial allocation result and the new allocation result; summing bandwidth consumption cost of each application, obtaining the initial allocation result, and the The total bandwidth consumption cost of the new allocation result.
  • the optimal allocation result selection module 406 may include:
  • the distribution result comparison sub-module is configured to: for the newly obtained allocation result that is currently obtained, if the resource consumption of the newly obtained new allocation result is smaller than the resource consumption amount of the initial allocation result, the currently obtained new The result of the allocation is used as the current optimal allocation result, and compared with the next new allocation result until the optimal allocation result is obtained.
  • the initial allocation result is obtained through the node network graph, and the optimal allocation result is further obtained by the simulated annealing algorithm and/or the genetic algorithm, thereby improving the efficiency of applying the home service cluster allocation. Moreover, the resulting allocation scheme is closer to the optimal solution, saving the cost of distributed system deployment and operation.
  • the embodiment of the present application can automatically determine an optimal allocation result for a dynamically changing distributed system, and does not need to manually perform multiple allocations, thereby further improving the allocation efficiency of the application home service cluster.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • embodiments of the embodiments of the present application can be provided as a method, apparatus, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-persistent computer readable media, such as modulated data signals and carrier waves.
  • Embodiments of the present application are described with reference to flowcharts and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing terminal device to produce a machine such that instructions are executed by a processor of a computer or other programmable data processing terminal device
  • Means are provided for implementing the functions specified in one or more of the flow or in one or more blocks of the flow chart.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the instruction device implements the functions specified in one or more blocks of the flowchart or in a flow or block of the flowchart.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请提供了一种应用归属服务集群的分配方法和装置。所述方法包括:将多个应用分配至多个服务集群,获得初始分配结果;多次更换所述应用归属的服务集群,获得多个新增分配结果;计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量;选择资源消耗量最小的分配结果作为最优分配结果。本申请提升了应用归属服务集群的分配效率,同时保证了得到的分配方案可以有效地节省服务集群的资源消耗成本。

Description

一种应用归属服务集群的分配方法和装置 技术领域
本申请涉及数据处理技术领域,特别是涉及一种应用归属服务集群的分配方法和一种应用归属服务集群的分配装置。
背景技术
在一个典型的分布式系统中,为了便于对存储和计算进行管理,比较好的方式是以应用的形式对数据和任务进行隔离,将应用作为一个整体分配至一个由若干相互独立、通过网络互联的计算机组成的集群。同一集群上的不同应用拥有各自独立的存储空间,但共享集群的计算能力。
在这种架构的分布式系统中,其消耗主要为集群的一次性购置成本和集群间跨集群通讯而产生的累积性带宽消耗成本。其中,跨集群通讯主要是由于处于不同集群的应用之间相互访问数据造成,由此,产生了对应用归属服务集群的分配优化需求,以使得在满足计算、存储等约束条件的同时可以最大限度降低集群的购置成本和带宽消耗成本。
目前对应用归属服务集群的分配方法中,主要是依赖于用户凭借经验进行分配,但该方法需要耗费大量的人力物力和时间,造成分配效率较低的问题。而且,分配方案可能并非是最优方案,造成了成本的浪费。
此外,分布式系统中会不断增加新的应用和下线部分过期应用,集群也会进行机器扩容、机器报废等的处理,应用和集群处于一个动态变化的过程中,针对于动态变化的分布式系统,分配方案也需要检验是否适用于当前的分布式系统,当不适用时需要重新确定分配方案。因此,目前的分配方法可能需要人工重新进行多次分配,增加了对人力物力和时间的耗费,进一步降低了分配效率。
发明内容
鉴于上述问题,提出了本申请实施例以便提供一种克服上述问题或者至少部分地解决上述问题的一种应用归属服务集群的分配方法和相应的 一种应用归属服务集群的分配装置。
为了解决上述问题,本申请公开了一种应用归属服务集群的分配方法,包括:
将多个应用分配至多个服务集群,获得初始分配结果;
多次更换所述应用归属的服务集群,获得多个新增分配结果;
计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量;
选择资源消耗量最小的分配结果作为最优分配结果。
优选地,所述将多个应用分配至多个服务集群为:
按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配。
优选地,在所述将多个应用分配至多个服务集群之前,所述方法还包括:
按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
优选地,在所述按照排序针对各服务集群进行应用分配之前,所述方法还包括:
计算任意两个应用之间的关联权重;
所述按照排序针对各服务集群进行应用分配包括:
从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
优选地,所述按照排序针对各服务集群进行应用分配还包括:
若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需 资源消耗量进行排序;
按照排序逐个将未分配的应用随机分配至某一服务集群。
优选地,在所述将多个应用分配至多个服务集群之前,所述方法还包括:
以所述应用为节点,以具备数据交换的两个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
优选地,所述选择关联权重最大的两个目标应用包括:
查找所述节点网络图中边权重最大的目标边。
优选地,所述选择与所述目标应用之一的关联权重排序靠前的多个关联应用包括:
在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索;
从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
优选地,在所述多次更换所述应用归属的服务集群,获得多个新增分配结果之后,所述方法还包括:
确定更换后的新增分配结果未超出各服务集群的负载性能。
优选地,所述多次更换所述应用归属的服务集群,获得多个新增分配结果包括:
在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
优选地,所述多次更换所述应用归属的服务集群,获得多个新增分配结果还包括:
针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配 结果中选择两个应用,并对选择的两个应用所归属的服务集群进行交换,获得多个新增分配结果;
和/或,随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
优选地,在所述在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果之后,所述方法还包括:
筛选资源消耗量从小到大排序靠前的多个分配结果。
优选地,所述计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量包括:
计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本;
和/或,计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
优选地,所述选择资源消耗量最小的分配结果作为最优分配结果包括:
针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
本申请还提供了一种应用归属服务集群的分配装置,包括:
应用初始分配模块,用于将多个应用分配至多个服务集群,获得初始分配结果;
应用多次更换模块,用于多次更换所述应用归属的服务集群,获得多个新增分配结果;
资源消耗量计算模块,用于计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量;
最优分配结果选择模块,用于选择资源消耗量最小的分配结果作为最优分配结果。
优选地,所述应用初始分配模块具体用于:
按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配。
优选地,所述装置还包括:
服务集群排序模块,用于按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
优选地,所述装置还包括:
关联权重计算模块,用于计算任意两个应用之间的关联权重;
所述应用初始分配模块包括:
关联应用分配子模块,用于从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
优选地,所述装置还包括:
应用排序模块,用于若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需资源消耗量进行排序;
未分配应用随机分配模块,用于按照排序逐个将未分配的应用随机分配至某一服务集群。
优选地,所述装置还包括:
节点网络图构建模块,用于以所述应用为节点,以具备数据交换的两 个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
优选地,所述关联应用分配子模块包括:
目标边查找子单元,用于查找所述节点网络图中边权重最大的目标边。
优选地,所述关联应用分配子模块包括:
广度优先搜索子单元,用于在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索;
关联节点选择子单元,用于从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
优选地,所述装置还包括:
新增分配结果确定模块,用于确定更换后的新增分配结果未超出各服务集群的负载性能。
优选地,所述应用多次更换模块包括:
应用交换子模块,用于在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
优选地,所述应用多次更换模块包括:
服务集群交互子模块,用于针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配结果中选择两个应用,并对选中的两个应用所归属的服务集群进行交换,获得多个新增分配结果
服务集群修改子模块,用于随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
优选地,所述装置还包括:
分配结果筛选模块,用于筛选资源消耗量从小到大排序靠前的多个分配结果。
优选地,所述资源消耗量计算模块包括:
集群购置成本计算子模块,用于计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本;
带宽消耗成本计算子模块,用于计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
优选地,所述最优分配结果选择模块包括:
分配结果比较子模块,用于针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
本申请实施例包括以下优点:
根据本申请实施例,基于初始分配结果进行应用归属的服务集群的多次更换处理,以获得多个新增分配结果,通过对多个新增分配结果对服务集群的资源消耗量的计算和比较,由此确定最优分配结果,从而提升了应用归属服务集群的分配效率,同时保证了得到的分配方案可以有效地节省服务集群的资源消耗成本。
而且,本申请实施例可以针对动态变化的分布式系统而自动确定出最优分配结果,无须人工进行多次分配,进一步提升了应用归属服务集群的分配效率。
附图说明
图1是本申请的一种应用归属服务集群的分配方法实施例一的步骤流程图;
图2是本申请的一种应用归属服务集群的分配方法实施例二的步骤流 程图;
图3是本申请的一种应用归属服务集群的分配装置实施例一的结构框图;
图4是本申请的一种应用归属服务集群的分配装置实施例一的结构框图;
图5是本申请一种基于节点网络图的构建示意图;
图6是本申请一种应用归属服务集群的分配结果示意图。
具体实施方式
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。
参照图1,示出了本申请的一种应用归属服务集群的分配方法实施例一的步骤流程图,具体可以包括如下步骤:
步骤101,将多个应用分配至多个服务集群,获得初始分配结果。
上述的应用可以为一组数据和程序的集合,用于将不同归属的数据和计算,在逻辑上进行相互隔离的单位。也可以将应用理解为关系型数据库中数据实例的概念。一个分布式系统可以具有多个服务集群。服务集群由若干台相互独立、通过网络互联的计算机组成的计算机群或服务器组。一个服务集群以一个整体的方式提供存储和计算能力。不同服务集群之间可以通过网络传输的方式进行数据交互等的通讯任务。
在本申请实施例的具体实现中,可以首先将多个应用分配至多个服务集群,得到初始的分配结果。初始的分配方式可以有多种,例如可以随机分配,也可以按照服务集群的负载性能对多个服务集群进行排序,按照排序分配应用。
步骤102,多次更换所述应用归属的服务集群,获得多个新增分配结果。
针对初始分配结果,可以多次更换应用归属的服务集群。每一次更换都会产生一个新的分配结果,多次更换后即可获得多个新的分配结果。更换时可以随机更换,也可以按照一定的规则进行更换。例如,针对服务集群编号,按照编号顺序更换,本申请实施例对更换的方式不作限制。
随机更换应用归属的服务集群的方式可以有多种,例如,可以在服务集群中随机选择两个服务集群,分别随机选择一个应用,交换分配至所选择的另一个服务集群;或者,可以在任意两个服务集群中分别随机选择两个应用,将两个应用归属的服务集群进行交换。本领域技术人员可以根据实际需要,采用各种方式更换应用归属的服务集群,以获得多个分配结果。
作为本申请实施例的优选示例,在所述步骤102之后,所述方法可以还包括:
确定更换后的新增分配结果未超出各服务集群的负载性能。
作为最优分配结果的候选分配结果需要符合服务集群的负载性能,以保证分配结果可以实施。因此,更换应用归属的服务集群后,需要确定更换后的分配结果中,各个服务集群的负载性能依然能满足实现该分配结果。
步骤103,计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量。
需要说明的是,服务集群根据其所包含的计算机数量具有不同的购置成本、最大存储量和CPU总核数,各服务集群也具有一定的出口带宽;分配于服务集群中的每个应用需要一定的存储空间,应用之间也可能需要进行数据交互,即具有一定的数据交换量。跨集群的数据交互需要消耗一定的集群的出口带宽,造成出口带宽成本。由此,不同的应用分配方案,会产生不同的集群购置成本和带宽消耗成本。而且,根据集群的最大存储量和CPU总核数,每个集群所能存储和运行的应用也会受到一定约束条件的分配限制。假设系统中具有N个服务集群和M个应用,需要将M个应用分配至N’(N’≤N)个服务集群,最优的分配结果可以为N’个集群的总购 置成本+跨集群的带宽消耗成本最小。实际应用中,最优的分配结果可以由本领域技术人员根据实际情况进行定义,例如仅将集群的总购置成本最小作为最优的分配结果,或集群总购置成本+维护成本最小作为最优的分配结果。
服务集群的资源消耗量可以包括集群购置成本和/或带宽消耗成本,也可以是其他的配置集群和运行集群所消耗的成本。
可以计算初始分配结果和多个新增分配结果各自对服务集群的资源消耗量,以便进一步比较各个分配结果的资源消耗量。
步骤104,选择资源消耗量最小的分配结果作为最优分配结果。
在得到多个候选的分配结果及计算得到各自的资源消耗量后,可以从中选择资源消耗量最小的分配结果作为最优分配结果。实际应用中,也可以在得到一个新增分配结果后,与初始分配结果进行比较,若新增分配结果的资源消耗量小于初始分配结果的资源消耗量,则将新增分配结果作为最优分配结果。也可以进一步地获取下一个新增分配结果,与上一个新增分配结果进行比较,重复多次的新增分配结果获取和比较,直到得到最优的分配结果。还可以经过一定次数的与新增分配结果比较后,将资源消耗最小的分配结果作为最优分配结果。
根据本申请实施例,基于初始分配结果进行应用归属的服务集群的多次更换处理,以获得多个新增分配结果,通过对多个新增分配结果对服务集群的资源消耗量的计算和比较,由此确定最优分配结果,从而提升了应用归属服务集群的分配效率,同时保证了得到的分配方案可以有效地节省服务集群的资源消耗成本。
而且,本申请实施例可以针对动态变化的分布式系统而自动确定出最优分配结果,无须人工进行多次分配,进一步提升了应用归属服务集群的分配效率。
参照图2,示出了本申请的一种应用归属服务集群的分配方法实施例 二的步骤流程图,具体可以包括如下步骤:
步骤201,按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
上述的负载性能可以包括每一个服务集群的最大存储量、CPU总核数、各服务集群间的出口平均带宽成本中至少一种。负载性能也可以包括其他的服务集群的处理能力指标。可以按照服务集群的负载性能对多个服务集群进行排序。具体的排序方式可以有多种,例如分别按照不同的负载性能进行排序,或者针对负载性能设置权重,根据服务集群的多个负载性能的综合权重排序。排序可以是升序,也可以是降序。本领域技术人员可以根据实际情况,按照负载性能进行排序,本申请实施例对此不作限制。
步骤202,按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配,获得初始分配结果。
在确定服务集群的排序后,可以按照排序进行应用分配。分配时可以优先将应用分配至排序靠前的服务集群,排序在前的服务集群分配完毕后再将剩余的应用分配至排序在后的服务集群。
实际应用中,分配可以具有一定的约束条件,例如,服务集群所能分配的应用的总数据量不超过服务集群的最大存储量的90%;或者,服务集群内的应用在任一时间点对服务集群的内存和CPU消耗不超过其最大处理能力的80%;或者,单个应用不得分别分配至不同的服务集群,而必须完整地分配至同一个服务集群;也可以采用上述多个约束条件的组合。当然,本领域技术人员可以根据实际情况设定各种约束条件或约束条件的组合,本申请实施例不限制约束条件的具体内容和约束条件的组合方式。
对各服务集群进行应用分配的处理,可以循环处理直至所有应用均分配至某个应用,并最终得到初始分配结果。或者,直至无法再满足约束条件为止。
作为本申请实施例的优选示例,在所述按照排序针对各服务集群进行 应用分配之前,所述方法可以还包括:
计算任意两个应用之间的关联权重。
所述按照排序针对各服务集群进行应用分配可以包括:
从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
可以计算任意两个应用之间的数据交换量,以作为应用之间的关联权重。在计算得到全部应用之间的关联权重后,可以选择关联权重最大的两个应用作为目标应用。基于选择的两个目标应用,可以继续选择与任意一个目标应用的关联权重较大的其他关联应用,分配至与目标应用所属的服务集群中。
因为处于同一服务集群中的应用之间在交换数据时可以不占用服务集群的出口带宽,因此,可以尽量将相互间数据交换量较大的应用分配至同一个服务集群中,以减少服务集群间的数据交换量,降低对服务集群的带宽占用。
作为本申请实施例的优选示例,所述按照排序针对各服务集群进行应用分配还包括:
若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需资源消耗量进行排序;按照排序逐个将未分配的应用随机分配至某一服务集群。
对于剩余的未分配应用,可以按照未分配应用所需资源消耗量进行降序排序,按照排序逐个将未分配应用随机分配至一个可容纳该应用的服务集群中。其中,随机分配可能要反复若干次,直至分配到可容纳该应用的服务集群。所需资源消耗量可以为购置成本,带宽占用,应用所需的存储空间,应用运行时需要占用的内存等资源消耗量中至少一种或多种的组合。
作为本申请实施例的优选示例,在所述步骤202之前,所述方法可以还包括:
以所述应用为节点,以具备数据交换的两个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
从图的角度考虑,可以基于应用构成图模型,通过图算法的方式得到初始分配结果。具体地,可以以应用作为图的节点,以具备数据交换的任意两个应用作为相邻的节点,代表应用之间数据交换量的关联权重作为两个应用节点的边的边权重,从而构建包括有多个应用的节点网络图。
作为本申请实施例的优选示例,所述选择关联权重最大的两个目标应用包括:
查找所述节点网络图中边权重最大的目标边。
节点网络图中的两个节点的边权重表示两个应用之间的关联权重,选择关联权重最大的两个目标应用,可以通过在节点网络图中查找边权重最大的目标边而实现,查找到的目标边所连接两个节点,即对应于关联权重最大的两个目标应用。
作为本申请实施例的优选示例,所述选择与所述目标应用之一的关联权重排序靠前的多个关联应用可以包括:
子步骤S11,在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索。
子步骤S12,从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
可以将包含有目标边的节点形成一个子图,以目标节点为起点进行广度优先搜索(Breadth First Search,BFS)。广度优先搜索是一种图搜索算法,区别于深度优先搜索,其从某个节点开始,沿着图的宽度遍历各个节点,直至图中的全部节点被访问完毕才终止搜索计算。
从搜索得到的多个关联节点中,可以按照与目标节点的边权重从大到小的顺序,在满足服务集群的负载性能的条件下,选择数量最多的关联节点,即选择了与任意一个目标应用的关联权重排序靠前的多个关联应用。
为了便于本领域技术人员理解本申请实施例,图5示出了本申请一种基于节点网络图的构建示意图。从图中可见,将应用作为节点,将应用间的关联权重作为节点的边权重。其中,首先查找到未被分配的、边权重最大的目标边,同时目标边连接的两个节点所对应的目标应用需要满足一定的约束条件。在包含有目标边的子图中,以目标节点为起点进行广度优先搜索,不断地将与目标节点相邻的其他节点、按照边权重从大到小的顺序进行扩展,将子图中的其他节点加入到由目标节点及多个关联节点形成的图块中,直至子图中所有节点均被关联,或已无法满足约束条件。图5中的节点1、节点2、节点3和节点4形成一个图块,节点5、节点6和节点9以及节点7和节点8分别形成另外的图块。即,应用1、应用2、应用3和应用4被分配至一个服务集群,应用5、应用6和应用9以及应用7和应用8分别分配至其他的两个服务集群。相应的,参考图6示出了本申请一种应用归属服务集群的分配结果示意图。如图6,上述9个应用分别被分配至服务集群A、服务集群B和服务集群C。
利用应用和应用间的关联权重构建基于边权重关联各个节点的节点网络图,可以将如何使得分配至同一服务集群的应用之间的数据交换量尽量大、同时使得服务集群之间的数据交换量尽量小的问题,转换成如何使得图块之内的多个应用间边权重尽量大、而图块间的边权重尽量小的问题。通过以目标节点展开广度优先搜索,按照其他节点的边权重大小顺序进行扩展关联,使得图块之内多个节点之间的边权重之和尽量大,而图块之间的边权重之和尽量小。即,同一服务集群的应用之间的数据交换量尽量大,而服务集群之间的数据交换量尽量小。
步骤203,多次更换所述应用归属的服务集群,获得多个新增分配结果。
作为本申请实施例的优选示例一,所述步骤203可以包括:
子步骤S21,在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
针对于初始分配结果中的多个服务集群,可以在服务集群中随机选择两个服务集群,分别随机选择一个应用,交换分配至所选择的另一个服务集群,从而可以获得新增的分配结果。可以反复进行多次的交换,以获得多个新增分配结果。新增分配结果的具体数量可以由本领域技术人员根据实际情况设定。作为本申请实施例的优选示例,在所述子步骤S21之后,所述方法可以还包括:筛选资源消耗量从小到大排序靠前的多个分配结果。
具体地,可以针对当前获得的多个新增分配结果,可以按照其资源消耗量从小到大进行排序,将排序靠前的若干个分配结果筛选出。
作为本申请实施例的优选示例二,所述步骤203可以包括:子步骤S22,针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配结果中选择两个应用,并对选择的两个应用所归属的服务集群进行交换,获得多个新增分配结果。
针对于当前获得的多个分配结果,可以从中依次选择两个分配结果,在选择的分配结果中分别选择两个应用,对所选择的两个应用所归属的服务集群进行交换,从而产生了新增分配结果。可以反复进行多次的交换,以获得多个新增分配结果。
作为本申请实施例的优选示例三,所述步骤203可以包括:
子步骤S23,随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
可以在任意一个服务集群中,随机选择一个应用,并将选择的应用分配至其他服务集群,以获得新增分配结果。同样,可以反复多次随机选择应用并重新分配应用至其他服务集群,以获得多个新增分配结果。
步骤204,计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量。
作为本申请实施例的优选示例,所述步骤204可以包括:
子步骤S31,计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本。
可以针对初始分配结果和新增分配结果,计算各个分配结果所需的集群购置成本。
和/或,子步骤S32,计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
可以针对初始分配结果和多个新增的分配结果,计算各个分配结果中,各个应用之间跨集群交互数据时所对服务集群的带宽消耗成本。将各个应用的带宽消耗成本加和,分别得到各个分配结果的总带宽消耗成本。
实际应用中,上述子步骤S21和步骤204可以利用模拟退火算法(Simulated Annealing,SA),实现获得新增分配结果,并计算各个新增分配结果对服务集群的资源消耗量,以最终获得最优分配结果的处理。模拟退火算法是一种通用概率算法,通常用于在一个较大的搜索空间内计算最优结果。
具体地,模拟退火算法中的初始解状态S的概念可以用于表示初始分配结果,即迭代计算的起点;S′可以表示新增分配结果。每一次的随机更换应用归属的服务集群而获得新增分配结果,即产生新解S’,并累计迭代次数一次。通过计算公式Δt′=C(S′)-C(S)计算资源消耗量的增量;其中,C(S)为表示分配结果的资源消耗量的评价函数,Δt′为该次迭代计算得到的资源消耗量增量。
当Δt′小于0,即新增分配结果的资源消耗量小于之前的分配结果,可以接受S′作为新的当前解。重复随机更换应用归属的服务集群获得新增分配结果的步骤,以对新增分配结果的资源消耗量增量进行迭代计算,满足终止条件后则将终止迭代计算并将当前解作为最优解,即最优的分配结果。终止条件可以为连续N个新解均没有被接受,也可以为新增结果无法 满足约束条件,还可以是获得足够多的被接受的当前解,当前解的数量应尽可能大,以保证后续可以获得最优解。当然,本领域技术人员也可以根据实际情况设定当前解的数量。
实际应用中,上述子步骤S22、S23和步骤204可以利用遗传算法(Genetic Algorithm,GA),实现获得新增分配结果并计算各个新增分配结果对服务集群的资源消耗量,以最终获得最优分配结果的处理。遗传算法是借鉴生物界的进化规律演化而来的随机搜索方法。
具体地,可以将各个应用作为染色体进行编码,将M个应用从0-M编号,N个服务集群从0-N编号,得到一个M维的染色体向量,每一维代表一个应用,对应取值为[0,N),表示该应用当前分配的集群索引,即该应用所属的服务集群编号。
可以设置进化代数t=0,设置最大进化代数T,随机生成M个个体的集合作为初始群体P(0),即初始分配结果。计算初始群体P(0)中的适应度,适应度可以通过计算该分配结果所需资源消耗量的倒数得到。分配结果所需资源消耗量越大,表示适应度越低,反之亦然。
在实际应用中,评价函数和适应度均为分配结果所需资源消耗量的表示方式,本领域技术人员可以根据实际情况任意选用,例如,在利用遗传算法获得新增分配结果时,可以用评价函数表示分配结果所需资源消耗量;在利用模拟退火算法获得新增分配结果时,也可以用适应度表示分配结果所需资源消耗量。
针对于上述的子步骤S22,利用遗传算法框架实现获得新增分配结果的具体处理中,可以针对染色体进行交叉运算,将交叉算子作用于群体。具体地,可以在初始群体P(0)的染色体中随机选取两个染色体,在满足约束条件的前提下相互交互取值,即对两个应用归属的服务集群进行交换,获得新增分配结果。
或者,针对于上述的子步骤S23,利用遗传算法框架实现获得新增分配的具体处理中,可以针对染色体进行变异运算,将变异算子作用于群体, 即对群体中的个体串的某些基因座上的基因值作变动。具体地,可以在初始群体P(0)的染色体中随机选取一个染色体,在满足约束条件的前提下修改索引值,即随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得新增分配结果。
针对于上述的步骤204,即针对交叉运算和/或变异运算后,从群体P(t)进化到下一代群体P(t+1),利用遗传算法框架计算资源消耗量的具体处理中,可以计算群体P(t+1)的适应度。当多次进化,进化代数t累计到最大进化代数T后则终止迭代计算,将进化过程中具有最大适应度的群体作为最优解,即最优分配结果。
由于每一步交叉运算和变异运算都会对进化是否满足约束条件进行检查,因此整个进化过程均可得到有效的分配结果,保证了进化的合理性。
需要说明的是,上述子步骤S21-子步骤S23的执行顺序仅为示例,实际应用中,可以根据上述提供的一种或多种方式按照不同次序的组合以获得多个新增的分配结果。例如先执行子步骤S21,再执行子步骤S23,最后执行子步骤S22。
需要说明的是,实际应用中可以采用多种方式结合模拟退火算法和遗传算法计算获得最优分配结果。例如,可以先利用模拟退火算法获得大量的分配结果,然后利用遗传算法控制分配结果的优化方向,以便接近最优分配结果;或者也可以先利用遗传算法中的变异运算,获得若干新增分配结果,再基于得到的若干分配结果,利用模拟退火算法获得大量的分配结果,最后再利用遗传算法中的交叉运算获得最优分配结果。
当结合模拟退火算法和遗传算法获得最优分配结果时,两种算法所对应计算的资源消耗量可以为相同种类的资源的消耗,也可以不同。例如,模拟退火算法所计算的资源消耗量针对于集群购置成本的消耗,而遗传算法所计算的是带宽成本的消耗。
此外,除了使用遗传算法获得最优分配结果,本领域技术也可以采用其他的算法获得最优分配结果,例如蚁群算法、粒子群算法等。
步骤205,针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
针对于当前获得的多个新增分配结果,可以将当前获得的新增分配结果与初始分配结果的资源消耗量进行比较。若当前获得的新增分配结果的资源消耗量小于初始分配结果的资源消耗量,则将当前获得的新增分配结果作为当前最优分配结果,反之则继续将下一新增分配结果与初始分配结果的资源消耗量进行比较。针对当前最优分配结果,可以与下一个新增分配结果进行比较,反复进行比较并确定当前最优分配结果,直至获得资源消耗量最小的分配结果,将其作为最优分配结果。或者,针对出现了新增分配结果的集群购置成本大于初始分配结果的资源消耗量的比较结果的出现次数进行统计,当出现的次数超出预设次数,则将候选分配结果中资源消耗量最小的分配结果作为最优分配结果。
根据本申请实施例,通过节点网络图得到初始分配结果,并进一步通过模拟退火算法和/或遗传算法得到最优分配结果,从而提升了应用归属服务集群分配的效率。而且,所得到的分配方案更接近最优方案,节省了分布式系统部署和运行的成本。
而且,本申请实施例可以针对动态变化的分布式系统而自动确定出最优分配结果,无须人工进行多次分配,进一步提升了应用归属服务集群的分配效率。
需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。
参照图3,示出了本申请的一种应用归属服务集群的分配装置实施例一的结构框图,具体可以包括如下模块:
应用初始分配模块301,用于将多个应用分配至多个服务集群,获得初始分配结果。
应用多次更换模块302,用于多次更换所述应用归属的服务集群,获得多个新增分配结果。
资源消耗量计算模块303,用于计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量。
最优分配结果选择模块304,用于选择资源消耗量最小的分配结果作为最优分配结果。
根据本申请实施例,基于初始分配结果进行应用归属的服务集群的多次更换处理,以获得多个新增分配结果,通过对多个新增分配结果对服务集群的资源消耗量的计算和比较,由此确定最优分配结果,从而提升了应用归属服务集群的分配效率,同时保证了得到的分配方案可以有效地节省服务集群的资源消耗成本。
而且,本申请实施例可以针对动态变化的分布式系统而自动确定出最优分配结果,无须人工进行多次分配,进一步提升了应用归属服务集群的分配效率。
参照图4,示出了本申请的一种应用归属服务集群的分配装置实施例二的结构框图,具体可以包括如下模块:
服务集群排序模块401,用于按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
节点网络图构建模块402,用于以所述应用为节点,以具备数据交换的两个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
应用初始分配模块403,用于将多个应用分配至多个服务集群,获得初始分配结果。
应用多次更换模块404,用于多次更换所述应用归属的服务集群,获得多个新增分配结果。
资源消耗量计算模块405,用于计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量。
最优分配结果选择模块406,用于选择资源消耗量最小的分配结果作为最优分配结果。
作为本申请实施例的优选示例,所述应用初始分配模块403可以具体用于:
按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配。
作为本申请实施例的优选示例,所述装置可以还包括:
关联权重计算模块,用于计算任意两个应用之间的关联权重。
所述应用初始分配模块403可以包括:
关联应用分配子模块,用于从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
作为本申请实施例的优选示例,所述装置可以还包括:
应用排序模块,用于若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需资源消耗量进行排序。
未分配应用随机分配模块,用于按照排序逐个将未分配的应用随机分配至某一服务集群。
作为本申请实施例的优选示例一,所述关联应用分配子模块可以包 括:
目标边查找子单元,用于查找所述节点网络图中边权重最大的目标边。
作为本申请实施例的优选示例二,所述关联应用分配子模块可以包括:
广度优先搜索子单元,用于在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索。
关联节点选择子单元,用于从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
作为本申请实施例的优选示例,所述装置可以还包括:
新增分配结果确定模块,用于确定更换后的新增分配结果未超出各服务集群的负载性能。
作为本申请实施例的优选示例,所述应用多次更换模块404可以包括:
应用交换子模块,用于在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
作为本申请实施例的优选示例,所述应用多次更换模块404可以包括:
服务集群交互子模块,用于针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配结果中选择两个应用,并对选中的两个应用所归属的服务集群进行交换,获得多个新增分配结果。
服务集群修改子模块,用于随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
作为本申请实施例的优选示例,所述装置可以还包括:
分配结果筛选模块,用于筛选资源消耗量从小到大排序靠前的多个分配结果。
作为本申请实施例的优选示例,所述资源消耗量计算模块405可以包括:
集群购置成本计算子模块,用于计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本。
带宽消耗成本计算子模块,用于计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
作为本申请实施例的优选示例,所述最优分配结果选择模块406可以包括:
分配结果比较子模块,用于针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
根据本申请实施例,通过节点网络图得到初始分配结果,并进一步通过模拟退火算法和/或遗传算法得到最优分配结果,从而提升了应用归属服务集群分配的效率。而且,所得到的分配方案更接近最优方案,节省了分布式系统部署和运行的成本。
而且,本申请实施例可以针对动态变化的分布式系统而自动确定出最优分配结果,无须人工进行多次分配,进一步提升了应用归属服务集群的分配效率。
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
在一个典型的配置中,所述计算机设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非持续性的电脑可读媒体(transitory media),如调制的数据信号和载波。
本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。
以上对本申请所提供的一种应用归属服务集群的分配方法和一种应用归属服务集群的分配装置,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (28)

  1. 一种应用归属服务集群的分配方法,其特征在于,包括:
    将多个应用分配至多个服务集群,获得初始分配结果;
    多次更换所述应用归属的服务集群,获得多个新增分配结果;
    计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量;
    选择资源消耗量最小的分配结果作为最优分配结果。
  2. 根据权利要求1所述的方法,其特征在于,所述将多个应用分配至多个服务集群为:
    按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配。
  3. 根据权利要求2所述的方法,其特征在于,在所述将多个应用分配至多个服务集群之前,所述方法还包括:
    按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
  4. 根据权利要求2所述的方法,其特征在于,在所述按照排序针对各服务集群进行应用分配之前,所述方法还包括:
    计算任意两个应用之间的关联权重;
    所述按照排序针对各服务集群进行应用分配包括:
    从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
  5. 根据权利要求4所述的方法,其特征在于,所述按照排序针对各 服务集群进行应用分配还包括:
    若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需资源消耗量进行排序;
    按照排序逐个将未分配的应用随机分配至某一服务集群。
  6. 根据权利要求4所述的方法,其特征在于,在所述将多个应用分配至多个服务集群之前,所述方法还包括:
    以所述应用为节点,以具备数据交换的两个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
  7. 根据权利要求6所述的方法,其特征在于,所述选择关联权重最大的两个目标应用包括:
    查找所述节点网络图中边权重最大的目标边。
  8. 根据权利要求6所述的方法,其特征在于,所述选择与所述目标应用之一的关联权重排序靠前的多个关联应用包括:
    在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索;
    从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
  9. 根据权利要求1所述的方法,其特征在于,在所述多次更换所述应用归属的服务集群,获得多个新增分配结果之后,所述方法还包括:
    确定更换后的新增分配结果未超出各服务集群的负载性能。
  10. 根据权利要求1所述的方法,其特征在于,所述多次更换所述应用归属的服务集群,获得多个新增分配结果包括:
    在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
  11. 根据权利要求10所述的方法,其特征在于,所述多次更换所述应用归属的服务集群,获得多个新增分配结果还包括:
    针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配结果中选择两个应用,并对选择的两个应用所归属的服务集群进行交换,获得多个新增分配结果;
    和/或,随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
  12. 根据权利要求11所述的方法,其特征在于,在所述在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果之后,所述方法还包括:
    筛选资源消耗量从小到大排序靠前的多个分配结果。
  13. 根据权利要求11所述的方法,其特征在于,所述计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量包括:
    计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本;
    和/或,计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
  14. 根据权利要求1所述的方法,其特征在于,所述选择资源消耗量最小的分配结果作为最优分配结果包括:
    针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
  15. 一种应用归属服务集群的分配装置,其特征在于,包括:
    应用初始分配模块,用于将多个应用分配至多个服务集群,获得初始分配结果;
    应用多次更换模块,用于多次更换所述应用归属的服务集群,获得多个新增分配结果;
    资源消耗量计算模块,用于计算所述初始分配结果和所述新增分配结果各自对所述服务集群的资源消耗量;
    最优分配结果选择模块,用于选择资源消耗量最小的分配结果作为最优分配结果。
  16. 根据权利要求15所述的装置,其特征在于,所述应用初始分配模块具体用于:
    按照排序针对各服务集群进行应用分配,直至所有应用均分配至某个服务集群;其中,针对排序在后的服务集群,在排序在前的服务集群分配后剩余的应用中进行应用分配。
  17. 根据权利要求16所述的装置,其特征在于,所述装置还包括:
    服务集群排序模块,用于按照所述服务集群的至少一种负载性能,对多个服务集群进行排序。
  18. 根据权利要求16所述的装置,其特征在于,所述装置还包括:
    关联权重计算模块,用于计算任意两个应用之间的关联权重;
    所述应用初始分配模块包括:
    关联应用分配子模块,用于从当前可选的多个应用中,选择关联权重最大的两个目标应用,并选择与所述目标应用之一的关联权重排序靠前的多个关联应用,分配至所述服务集群。
  19. 根据权利要求18所述的装置,其特征在于,所述装置还包括:
    应用排序模块,用于若至少一个应用未分配至所述服务集群,则将未分配的应用按照所需资源消耗量进行排序;
    未分配应用随机分配模块,用于按照排序逐个将未分配的应用随机分配至某一服务集群。
  20. 根据权利要求18所述的装置,其特征在于,所述装置还包括:
    节点网络图构建模块,用于以所述应用为节点,以具备数据交换的两个应用为相邻节点,构建包括多个应用的节点网络图,所述关联权重为连接两个应用的边的边权重。
  21. 根据权利要求20所述的装置,其特征在于,所述关联应用分配子模块包括:
    目标边查找子单元,用于查找所述节点网络图中边权重最大的目标边。
  22. 根据权利要求20所述的装置,其特征在于,所述关联应用分配子模块包括:
    广度优先搜索子单元,用于在包含所述目标边的子图中,以所述目标边的两个目标节点为起点,进行广度优先搜索;
    关联节点选择子单元,用于从搜索的多个关联节点中,按照与所述目标节点的边权重从大到小,在未超出所述服务集群的负载性能的条件下,选择最多数量的关联节点。
  23. 根据权利要求15所述的装置,其特征在于,所述装置还包括:
    新增分配结果确定模块,用于确定更换后的新增分配结果未超出各服务集群的负载性能。
  24. 根据权利要求15所述的装置,其特征在于,所述应用多次更换模块包括:
    应用交换子模块,用于在随机选择的两个服务集群中,分别随机选择一个应用进行交换,直至获得多个新增分配结果。
  25. 根据权利要求24所述的装置,其特征在于,所述应用多次更换 模块包括:
    服务集群交互子模块,用于针对当前获得的分配结果,依次选择两个分配结果,随机从两个分配结果中选择两个应用,并对选中的两个应用所归属的服务集群进行交换,获得多个新增分配结果
    服务集群修改子模块,用于随机选择一个应用并对所选择的应用归属的服务集群进行修改,获得多个新增分配结果。
  26. 根据权利要求25所述的装置,其特征在于,所述装置还包括:
    分配结果筛选模块,用于筛选资源消耗量从小到大排序靠前的多个分配结果。
  27. 根据权利要求25所述的装置,其特征在于,所述资源消耗量计算模块包括:
    集群购置成本计算子模块,用于计算所述初始分配结果和所述新增分配结果各自所需的集群购置成本;
    带宽消耗成本计算子模块,用于计算所述初始分配结果和所述新增分配结果中各个应用跨集群的带宽消耗成本;加和各个应用的带宽消耗成本,得到所述初始分配结果和所述新增分配结果的总带宽消耗成本。
  28. 根据权利要求15所述的装置,其特征在于,所述最优分配结果选择模块包括:
    分配结果比较子模块,用于针对当前获得的新增分配结果,若所述当前获得的新增分配结果的资源消耗量小于所述初始分配结果的资源消耗量,则将所述当前获得的新增分配结果作为当前最优分配结果,并与下一个新增分配结果进行比较,直至获得最优分配结果。
PCT/CN2017/074172 2016-03-02 2017-02-20 一种应用归属服务集群的分配方法和装置 WO2017148296A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610119120.2 2016-03-02
CN201610119120.2A CN107155215B (zh) 2016-03-02 2016-03-02 一种应用归属服务集群的分配方法和装置

Publications (1)

Publication Number Publication Date
WO2017148296A1 true WO2017148296A1 (zh) 2017-09-08

Family

ID=59742499

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/074172 WO2017148296A1 (zh) 2016-03-02 2017-02-20 一种应用归属服务集群的分配方法和装置

Country Status (3)

Country Link
CN (1) CN107155215B (zh)
TW (1) TWI740895B (zh)
WO (1) WO2017148296A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114466022A (zh) * 2021-12-31 2022-05-10 苏州浪潮智能科技有限公司 一种集群中获取服务器种子节点的方法、装置及介质
CN114564954A (zh) * 2022-03-01 2022-05-31 天元大数据信用管理有限公司 一种维护指标唯一性的指标管理方法及系统
CN115134369A (zh) * 2021-03-26 2022-09-30 北京金山云网络技术有限公司 一种cdn节点分配方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103327072A (zh) * 2013-05-22 2013-09-25 中国科学院微电子研究所 一种集群负载均衡的方法及其系统
CN103491151A (zh) * 2013-09-13 2014-01-01 中安消技术有限公司 一种云计算资源的调度方法、装置及云计算平台
US20150026342A1 (en) * 2013-07-16 2015-01-22 Hitachi, Ltd Virtual resource management tool for cloud computing service
CN104461740A (zh) * 2014-12-12 2015-03-25 国家电网公司 一种跨域集群计算资源聚合和分配的方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20120072250A (ko) * 2010-12-23 2012-07-03 한국전자통신연구원 동적 부하 분산 시스템 및 방법
US9537973B2 (en) * 2012-11-01 2017-01-03 Microsoft Technology Licensing, Llc CDN load balancing in the cloud
CN103473140A (zh) * 2013-10-09 2013-12-25 浪潮(北京)电子信息产业有限公司 一种生命科学应用的集群分配方法、软件安装方法及装置
KR20150044113A (ko) * 2013-10-16 2015-04-24 한국전자통신연구원 멀티 태스크 할당 장치 및 그 방법
CN105208133B (zh) * 2015-10-20 2018-05-25 上海斐讯数据通信技术有限公司 一种服务器、负载均衡器以及服务器负载均衡方法和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103327072A (zh) * 2013-05-22 2013-09-25 中国科学院微电子研究所 一种集群负载均衡的方法及其系统
US20150026342A1 (en) * 2013-07-16 2015-01-22 Hitachi, Ltd Virtual resource management tool for cloud computing service
CN103491151A (zh) * 2013-09-13 2014-01-01 中安消技术有限公司 一种云计算资源的调度方法、装置及云计算平台
CN104461740A (zh) * 2014-12-12 2015-03-25 国家电网公司 一种跨域集群计算资源聚合和分配的方法

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115134369A (zh) * 2021-03-26 2022-09-30 北京金山云网络技术有限公司 一种cdn节点分配方法、装置、电子设备及存储介质
CN115134369B (zh) * 2021-03-26 2024-01-19 北京金山云网络技术有限公司 一种cdn节点分配方法、装置、电子设备及存储介质
CN114466022A (zh) * 2021-12-31 2022-05-10 苏州浪潮智能科技有限公司 一种集群中获取服务器种子节点的方法、装置及介质
CN114466022B (zh) * 2021-12-31 2023-07-21 苏州浪潮智能科技有限公司 一种集群中获取服务器种子节点的方法、装置及介质
CN114564954A (zh) * 2022-03-01 2022-05-31 天元大数据信用管理有限公司 一种维护指标唯一性的指标管理方法及系统
CN114564954B (zh) * 2022-03-01 2024-04-12 天元大数据信用管理有限公司 一种维护指标唯一性的指标管理方法及系统

Also Published As

Publication number Publication date
CN107155215B (zh) 2020-07-21
TWI740895B (zh) 2021-10-01
CN107155215A (zh) 2017-09-12
TW201734831A (zh) 2017-10-01

Similar Documents

Publication Publication Date Title
Yang et al. A multi-objective task scheduling method for fog computing in cyber-physical-social services
Mao et al. Max–min task scheduling algorithm for load balance in cloud computing
US9397917B2 (en) System and method for zoning in software defined networks
WO2015196911A1 (zh) 数据挖掘方法和节点
CN112286677A (zh) 一种面向资源受限边缘云的物联网应用优化部署方法
CN105159762A (zh) 基于贪心策略的启发式云计算任务调度方法
CN103179052A (zh) 一种基于接近度中心性的虚拟资源分配方法及系统
CN108664330A (zh) 一种基于变邻域搜索策略的云资源分配方法
WO2017148296A1 (zh) 一种应用归属服务集群的分配方法和装置
CN102984137A (zh) 一种基于多目标遗传算法下的多目标服务器调度方法
Li et al. An effective scheduling strategy based on hypergraph partition in geographically distributed datacenters
CN111813500B (zh) 一种多目标云工作流调度方法及装置
Pooranian et al. Using imperialist competition algorithm for independent task scheduling in grid computing
Aguilar-Fuster et al. A novel evaluation function for higher acceptance rates and more profitable metaheuristic-based online virtual network embedding
Mekki et al. Vehicular fog resource allocation scheme: A multi-objective optimization based approach
CN111176784A (zh) 一种基于极限学习机和蚁群系统的虚拟机整合方法
CN112187535B (zh) 雾计算环境下服务器部署方法及装置
Malik et al. Resource management in fog computing using clustering techniques: a systematic study
CN116708446A (zh) 基于网络性能综合权值决策的算网调度服务方法及系统
CN105187488A (zh) 一种基于遗传算法实现mas负载均衡的方法
Shahid et al. Level-based batch scheduling strategies for computational grid
Yassir et al. Graph-based model and algorithm for minimising big data movement in a cloud environment
Dai et al. Research on dynamic resource allocation with cooperation strategy in cloud computing
Guan et al. Multidimensional Resource Fragmentation-Aware Virtual Network Embedding for IoT Applications in MEC Networks
Sookhtsaraei et al. A multi objective virtual machine placement method for reduce operational costs in cloud computing by genetic

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17759147

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17759147

Country of ref document: EP

Kind code of ref document: A1