Cluster resource planning method, equipment, device and medium
By automatically selecting the optimal host node for instance deployment on the public cloud platform based on preset priorities and rules, the problem of low cluster resource planning efficiency is solved, and efficient automatic allocation of multi-component instances and excellent allocation results are achieved.
Patent Information
- Application Number
- CN202210887793.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2042-07-26
AI Technical Summary
The existing technology of cluster resource planning based on public cloud platforms is inefficient and requires experts to manually process work orders. It cannot achieve automated processing, and the quality of allocation results is difficult to guarantee.
By obtaining the host node list and component list, sorting and binding them according to preset priorities and rules, the optimal host node is automatically selected for instance deployment, realizing the automatic allocation and deployment of multi-component instances.
It improves the efficiency of multi-component cluster resource planning and the excellence of allocation results on public cloud platforms. It is suitable for various resource allocation scenarios and has good versatility.
Smart Images

Figure CN115309501B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cluster resource planning method, equipment, device and medium. Background Art
[0002] With the advent of the cloud computing era, various big data components have been widely used with the help of public cloud platforms. In particular, public cloud platforms can be used to deploy multiple components in clusters.
[0003] Currently, when deploying multiple components in a cluster based on a public cloud platform, the intervention of relevant experts is required to use expert experience to deploy instances for cluster nodes.
[0004] However, since expert experience depends on the experts themselves and requires them to manually process work orders, the deployment efficiency is low. Summary of the Invention
[0005] The present invention provides a cluster resource planning method, equipment, device and medium, which are used to solve the problem of low efficiency of cluster resource planning in the prior art.
[0006] In a first aspect, an embodiment of the present invention provides a cluster resource planning method, which is applied to a public cloud platform, comprising:
[0007] After obtaining the host node list and the first component list to be deployed, sorting the first component list according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled;
[0008] For each instance in each module in the list of instances to be scheduled, selecting a host node in the host node list according to a first preset rule to obtain a pre-selected host node list corresponding to the current instance;
[0009] After selecting an optimal host node from the pre-selected host node list according to a second preset rule, the optimal host node is bound to the current instance to obtain a binding relationship;
[0010] Deploy the instance corresponding to the host node in the binding relationship onto the host node.
[0011] An embodiment of the present invention provides a cluster resource planning method. An acquired first component list is sorted according to a first preset priority and a second preset priority to obtain a list of instances to be scheduled. For each instance in each module in the list of instances to be scheduled, a preselected host node list is determined according to a first preset rule. Furthermore, an optimal host node to be bound to the current instance is selected from the preselected host node list according to a second preset rule to obtain a binding relationship. The instance corresponding to the host node is deployed according to the binding relationship. Because this cluster resource planning method automatically allocates instances in multiple components and deploys them to suitable host nodes, it can improve the efficiency of multi-component cluster resource planning based on a public cloud platform.
[0012] In an optional implementation, sorting the first component list according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled includes:
[0013] Arrange each component in the first component list in descending order according to a first preset priority to obtain a second component list;
[0014] Arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component;
[0015] For each module in the component module list, an instance is created for the module according to the attribute information of the number of instances corresponding to the module, so as to obtain the list of instances to be scheduled.
[0016] The above method sorts the components in the first component list in descending order based on the first preset priority, sorts the modules corresponding to each component in descending order based on the second preset priority, and creates instances for the modules based on the attribute information of the number of instances corresponding to the modules, thereby obtaining a list of instances to be scheduled. Each component and each module corresponding to the component is sorted by priority, ensuring that the affinity dependency policy of the deployed instances is correctly resolved to improve the quality of the allocation results.
[0017] In an optional implementation, arranging each component in the first component list in descending order according to the first preset priority includes:
[0018] Traversing the first component list;
[0019] Sort each component in the first component list in ascending order of priority value.
[0020] In the above, each component in the first component list is sorted in descending order according to the first preset priority. That is, each component in the first component list is sorted from small to large according to the priority value. The smaller the priority value, the higher the priority of the corresponding component. In other words, each component in the first component list is sorted in descending order according to the priority. By sorting the components according to priority, it is convenient to traverse each component one by one in the subsequent process and optimize the host node assigned to the instance of each component.
[0021] In an optional implementation, the first preset rule includes:
[0022] The current host node meets the strong affinity rule;
[0023] Furthermore, the current host node satisfies the strong anti-affinity rule;
[0024] Furthermore, the available resources of the current host node meet the deployment requirements of the current instance.
[0025] The above method selects a host node from the host node list according to a first preset rule, namely, determining whether the current host node satisfies the strong affinity rule, whether the current host node satisfies the strong anti-affinity rule, and whether the available resources of the current host node are sufficient. If the current node satisfies all three of the above judgment conditions, the node is selected as a preselected host node and added to the preselected host node list corresponding to the current instance. If the current node does not meet any of the above three judgment conditions, the next host node is determined. The above method performs pre-screening and preliminarily determines the available preselected host nodes for the current instance, narrowing the selection range and improving the efficiency of node allocation.
[0026] In an optional embodiment, selecting the optimal host node from the host node list according to the pre-selected host node list and the second preset rule includes:
[0027] For each host node corresponding to each instance, determine the score of the host node corresponding to the instance according to a preset correspondence between host nodes, instances, and scores;
[0028] The scores of each host node corresponding to each instance are compared, and the host node with the highest score is used as the optimal host node.
[0029] This method determines the scores of the host nodes corresponding to instances based on a pre-defined relationship between host nodes, instances, and scores. It then compares the scores of each host node, selecting the one with the highest score as the optimal host node. This method's flexible scoring rules for host nodes corresponding to instances make it adaptable to a wide range of host node types, enhancing its universality.
[0030] In an optional embodiment, if the host nodes with the highest scores include at least two, the method further includes:
[0031] The idle resources of the at least two host nodes with the highest scores are compared, and the host node with the most idle resources is used as the optimal host node.
[0032] In the above method, if there are at least two host nodes with the highest scores, the free resources of the at least two host nodes with the highest scores are compared, and the host node with the most free resources is selected as the optimal host node. Therefore, the dual-selection rule of prioritizing the host node with the highest score and the most free resources further ensures the excellence of the resource allocation results.
[0033] In an optional embodiment, before selecting a host node from the host node list according to the first preset rule to obtain a pre-selected host node list corresponding to the current instance, the method further includes:
[0034] Traversing the list of instances to be scheduled;
[0035] For each instance in the list of instances to be scheduled, a pre-selected host node list corresponding to the current instance is initialized.
[0036] The above method needs to initialize a pre-selected host node list corresponding to each instance in the list of instances to be scheduled, so as to ensure the accuracy of the pre-selected host list obtained according to the first preset rule.
[0037] In a second aspect, an embodiment of the present invention provides a cluster resource planning device, which is applied to a public cloud platform and includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the cluster resource planning method described in any of the above embodiments.
[0038] In a third aspect, an embodiment of the present invention provides a cluster resource planning device, which is applied to a public cloud platform and includes:
[0039] A priority sorting module is used to obtain a list of host nodes and a list of first components to be deployed, and then sort the first list of components according to a first preset priority and a second preset priority to obtain a list of instances to be scheduled;
[0040] a rule verification module, configured to select a host node from the host node list according to a first preset rule for each instance in each module in the list of instances to be scheduled, and obtain a pre-selected host node list corresponding to the current instance;
[0041] a resource optimization module, configured to select an optimal host node from the pre-selected host node list according to a second preset rule, and bind the optimal host node to the current instance to obtain a binding relationship;
[0042] The deployment module is used to deploy the instance corresponding to the host node in the binding relationship onto the host node.
[0043] In an optional implementation, the priority sorting module is specifically configured to:
[0044] Arrange each component in the first component list in descending order according to a first preset priority to obtain a second component list;
[0045] Arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component;
[0046] For each module in the component module list, an instance is created for the module according to the attribute information of the number of instances corresponding to the module, so as to obtain the list of instances to be scheduled.
[0047] In an optional implementation, the priority sorting module is specifically configured to:
[0048] Traversing the first component list;
[0049] Sort each component in the first component list in ascending order of priority value.
[0050] In an optional implementation, the first preset rule includes:
[0051] The current host node meets the strong affinity rule;
[0052] Furthermore, the current host node satisfies the strong anti-affinity rule;
[0053] Furthermore, the available resources of the current host node meet the deployment requirements of the current instance.
[0054] In an optional implementation, the resource optimization module is specifically configured to:
[0055] For each host node corresponding to each instance, determine the score of the host node corresponding to the instance according to a preset correspondence between host nodes, instances, and scores;
[0056] The scores of each host node corresponding to each instance are compared, and the host node with the highest score is used as the optimal host node.
[0057] In an optional implementation, if the host nodes with the highest scores include at least two, the resource optimization module is further configured to:
[0058] The idle resources of the at least two host nodes with the highest scores are compared, and the host node with the most idle resources is used as the optimal host node.
[0059] In an optional implementation, the rule verification module is further configured to:
[0060] Traversing the list of instances to be scheduled;
[0061] For each instance in the list of instances to be scheduled, a pre-selected host node list corresponding to the current instance is initialized.
[0062] In a fourth aspect, an embodiment of the present invention provides a computer storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the steps of the cluster resource planning method described in any one of the above embodiments.
[0063] For the technical effects that may be achieved by the cluster resource planning device disclosed in the second aspect, the cluster resource planning apparatus disclosed in the third aspect, and the computer storage medium disclosed in the fourth aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible solutions in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0065] Figure 1 A schematic diagram of a process flow of a cluster resource planning method provided by an embodiment of the present invention;
[0066] Figure 2 A schematic diagram of a flow chart of another cluster resource planning method provided by an embodiment of the present invention;
[0067] Figure 3 A schematic diagram of a flow chart of an affinity rule verification method provided by an embodiment of the present invention;
[0068] Figure 4 A schematic diagram of a flow chart of a method for determining available resources of a host node provided by an embodiment of the present invention;
[0069] Figure 5A schematic diagram of a process flow for optimizing host node resources provided by an embodiment of the present invention;
[0070] Figure 6 A schematic diagram of the module structure of a cluster resource planning device provided by an embodiment of the present invention;
[0071] Figure 7 A schematic diagram of the structure of a cluster resource planning device provided by an embodiment of the present invention;
[0072] Figure 8 A schematic diagram of a program product of a cluster resource planning method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0073] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only some, not all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.
[0074] It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present invention, as detailed in the appended claims.
[0075] Currently, deploying multiple components in customer clusters on public cloud platforms requires the intervention of relevant experts. Expert experience is used to determine the compatibility and mutual exclusivity of different components on cluster nodes, confirm the resource requirements of instances, and pre-allocate different instances of different components on multiple host nodes in a balanced manner. However, since this method requires experts to manually handle work orders and cannot automate work order processing, the creation of public cloud clusters will be limited by the efficiency of expert processing as business volume grows. In addition, even with the manual intervention of experts, the excellence of resource planning and allocation results is difficult to guarantee.
[0076] In order to solve the above problems, embodiments of the present invention provide a cluster resource planning method, device, apparatus, and medium to improve the efficiency of cluster resource planning.
[0077] Example 1
[0078] The following describes a cluster resource planning method provided by the present invention through a specific embodiment. The method is applied to a public cloud platform, such as Figure 1 As shown, including:
[0079] Step 101: After obtaining a list of host nodes and a list of first components to be deployed, sort the list of first components according to a first preset priority and a second preset priority to obtain a list of instances to be scheduled;
[0080] Step 102: for each instance in each module in the list of instances to be scheduled, select a host node from the host node list according to a first preset rule to obtain a pre-selected host node list corresponding to the current instance;
[0081] Step 103: After selecting the optimal host node from the pre-selected host node list according to the second preset rule, the optimal host node is bound to the current instance to obtain a binding relationship;
[0082] Step 104: deploy the instance corresponding to the host node in the binding relationship onto the host node.
[0083] It should be noted that the cluster resource planning method provided in the embodiment of the present invention can be applied to cloud hosts, network-side devices, GPU (Graphics Processing Unit) computing devices, and terminals, and the application scenarios of the cluster resource planning method are not specifically limited here.
[0084] An embodiment of the present invention provides a cluster resource planning method, wherein a first component list is obtained and sorted according to a first preset priority and a second preset priority to obtain a list of instances to be scheduled. For each instance in each module in the list of instances to be scheduled, a preselected host node list is determined according to a first preset rule, and according to a second preset rule, the optimal host node to be bound to the current instance is selected from the preselected host node list to obtain a binding relationship, and the instance deployment corresponding to the host node is performed according to the binding relationship. Therefore, the cluster resource planning method realizes the automatic allocation and deployment of instances in multiple components to suitable host nodes, improves the efficiency of multi-component cluster resource planning based on a public cloud platform, and at the same time, ensures the excellence of the allocation results of the multi-component cluster resource planning.
[0085] In addition, this method can be widely adapted to various resource allocation scenarios and has good versatility.
[0086] As an optional implementation, the first component list is sorted according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled. Each component in the first component list can be sorted in descending order according to the first preset priority to obtain a second component list. Then, the modules corresponding to each component in the second component list can be sorted in descending order according to the second preset priority to obtain a component module list corresponding to the current component. Finally, for each module in the component module list, an instance is created for the module according to the attribute information of the number of instances corresponding to the module to obtain a list of instances to be scheduled.
[0087] In specific implementation, Figure 2 The figure is a flow chart of the overall cluster resource planning method provided by the present invention, see Figure 2 21, which is a specific process of sorting the first component list according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled, includes the following steps:
[0088] Step 201: Get the host node list Hosts and get the first component list Components1 that needs to be deployed;
[0089] Specifically, the host node list Hosts includes all host nodes owned by the cluster.
[0090] Step 202: Sort the first component list according to the first preset priority to obtain a second component list Components2;
[0091] Specifically, the first component list Components1 is traversed, and each component in the first component list Components1 is sorted from small to large according to the priority value, where the priority value of the component is the piririty attribute corresponding to the pre-configured component, and piririty is a positive integer value. The smaller the piririty value, the higher the priority of the corresponding component. In other words, after obtaining the first component list Components1 to be deployed, the first component list Components1 is traversed, and each component in the first component list Components1 is sorted from small to large according to the piririty value, to obtain the second component list Components2, where the components in the second component list Components2 are arranged from large to small according to priority.
[0092] Step 203: traverse the second component list and sort the modules corresponding to each component according to the second preset priority;
[0093] Specifically, the modules corresponding to each component in the second component list Components2 are arranged in descending order according to the second preset priority to obtain a component module list corresponding to the current component, wherein the second preset priority is the preset priority of the module, and the order of the modules contained in the component is defined by the internal structure of the corresponding component, and no additional adjustment is made.
[0094] Step 204: determine whether the current module is a dynamic module. If so, set the dynamic flag true for the current module. Otherwise, execute step 205.
[0095] Specifically, modules can be divided into dynamic modules and static modules according to their types. The module attribute information is pre-set through the replica value. If the replica value of the current module is a magic number, it indicates that the current module is a dynamic module, for example, the replica value of the current module is 999999 or 999998; if the replica value of the current module is not a magic number, it indicates that the current module is a static module, for example, the replica value of the current module is 3.
[0096] Step 205: Create a corresponding instance for each module according to the attribute information of the number of instances corresponding to the module.
[0097] For example, if the current module is a static module and the number of module instances is 3, then create three instances a1, a2, and a3 and add them to the list of instances to be scheduled; if the current module is a dynamic module, then create corresponding instances based on the number of host nodes and add them to the list of instances to be scheduled;
[0098] Specifically, for each module in the component module list, an instance is created based on the module's corresponding instance count attribute information to obtain a component module instance list. This means that instances with the specified replica count are generated for the module using the module's corresponding replica count. If the module's replica count is a magic number, it indicates that the module is dynamic. Instances are created based on the given number of host nodes and added to the list of instances to be scheduled. For example, if the module's replica count is 999999, it indicates that the module is deployed on all host nodes. If the module's replica count is 999998, it indicates that the module is deployed on two-thirds of the host nodes. If the module's replica count is not a magic number, it indicates that the module is static. Instances are created based on the module's replica count. For example, if the module's replica count is 3, indicating that the module has 3 instances, 3 instances are created and added to the list of instances to be scheduled.
[0099] For example, suppose the cluster has five host nodes and needs to be assigned three different big data components. The five host nodes are A1, A2, ..., A5, and the three components are B1, B2, and B3. Component B1 contains three modules: B11, B12, and B13; component B2 contains two modules: B21 and B22; and component B3 contains four modules: B31, B32, B33, and B34. Modules B12 and B33 are dynamic modules, while the remaining modules are static modules, each containing two instances. The first component list, second component list, component module list, and list of instances to be scheduled are shown in Table 1.
[0100]
[0101]
[0102] Table 1
[0103] In this embodiment of the present invention, the components in the first component list are sorted in descending order according to a first preset priority, the modules corresponding to each component are sorted in descending order according to a second preset priority, and instances are created for the modules based on the attribute information indicating the number of instances corresponding to the modules, thereby obtaining a list of instances to be scheduled. Therefore, each component and each module corresponding to the component is sorted by priority, ensuring that the affinity dependency policy of the deployed instances is correctly resolved, thereby improving the quality of the allocation results.
[0104] As an optional implementation, the first preset rule may include: the current host node satisfies a strong affinity rule; and the current host node satisfies a strong anti-affinity rule; and the available resources of the current host node meet the deployment requirements of the current instance.
[0105] It should be noted that, assuming a host node A1, component B1, and component B2, if instance C11 in component B1 is deployed on host node A1, host node A1 must then deploy instance C21 in component B2. In this case, instance C11 and instance C21 comply with the strong affinity rule, that is, instance C11 in component B1 and instance C21 in component B2 have a binding relationship when deployed on host node A1. If instance C11 in component B1 is deployed on host node A1, host node A1 cannot then deploy instance C21 in component B2. In this case, instance C11 and instance C21 comply with the strong anti-affinity rule, that is, instance C11 in component B1 and instance C21 in component B2 have a mutually exclusive relationship when deployed on host node A1. The above strong affinity rule and strong anti-affinity rule are pre-defined and can be specifically reflected in the affinity rule list.
[0106] In the specific implementation, see Figure 2 22, which is a specific process of selecting a host node from the host node list according to the first preset rule to obtain a pre-selected host node list corresponding to the current instance, includes the following steps:
[0107] Step 206: traverse the list of instances to be scheduled and initialize the pre-selected host node list PreChooseHosts corresponding to the current instance;
[0108] Specifically, for each instance in the list of instances to be scheduled, it is necessary to initialize a list of pre-selected host nodes corresponding to the current instance to ensure the accuracy of the pre-selected host list obtained according to the first preset rule.
[0109] Step 207: traverse the host node list Hosts to see if it meets the affinity rules and the hard limits of CPU performance and memory and disk performance;
[0110] Step 208: Determine whether the current host node meets the strong affinity rule. If so, execute step 209; otherwise, return to step 207.
[0111] Specifically, you can first select the instance that is allowed to be deployed corresponding to the current host node from the list of instances to be scheduled, and then for each instance that is allowed to be deployed, if the current instance has a binding relationship with the instance that is allowed to be deployed, that is, it satisfies the strong affinity rule, then the current instance can be deployed on the current host node; if the current instance does not satisfy the strong affinity rule, then the current instance cannot be deployed on the current host node, and traverse the next host node in the host node list.
[0112] Step 209: Determine whether the current host node meets the strong anti-affinity rule. If so, execute step 210; otherwise, return to step 207.
[0113] Specifically, first select the instance that is allowed to be deployed corresponding to the current host node from the list of instances to be scheduled. Then, for each instance that is allowed to be deployed, if the current instance and the instance that is allowed to be deployed meet the non-mutually exclusive principle, that is, do not meet the strong anti-affinity rule, then the current instance has the possibility of being deployed to the current host node. If the current instance meets the strong anti-affinity rule, then the current instance cannot be deployed on the current host node, and traverse the next host node in the host node list.
[0114] Specifically, if Figure 3 The figure shows a flowchart of affinity rule verification, which includes the following steps:
[0115] Step 301: Input the affinity rule list AffinityList and obtain the current host node list Hosts;
[0116] Specifically, the rule expression to be checked in the affinity rule list AffinityList includes strong affinity rules and strong anti-affinity rules.
[0117] Step 302: traverse the affinity rule list AffinityList to obtain the current rule expression to be verified;
[0118] Here, the current rule to be checked is judged, that is, whether it is a strong affinity rule or a strong anti-affinity rule.
[0119] Step 303: Obtain the attribute value X corresponding to the node according to the node attribute key specified by the current rule expression to be verified;
[0120] Specifically, if the current rule to be verified is a strong anti-affinity rule, the node attribute specified by the strong anti-affinity rule is a module, and the attribute value X1 of the current host node is obtained, where X1 is a list of all instances allowed to be deployed on the current node. If the current rule to be verified is a strong affinity rule, the node attribute specified by the strong affinity rule is a module, and the attribute value X2 of the current host node is obtained, where X2 is a list of all instances allowed to be deployed on the current node.
[0121] Step 304: Call different operation logics according to the operation type operator specified by the current rule expression to be checked;
[0122] Specifically, if the current rule to be verified is a strong anti-affinity rule, the node attribute specified by the strong anti-affinity rule is a module, the attribute value X1 of the current host node is obtained, and the IN operation logic is called, then step 305 is executed. If the current rule to be verified is a strong affinity rule, the node attribute specified by the strong affinity rule is a module, the attribute value X2 of the current host node is obtained, and the EXIST operation logic is called, then step 307 is executed.
[0123] Step 305, determine which operation logic is called. If the IN operation logic is called, execute step 306; if the NOTIN operation logic is called, execute step 307; if the EXIST operation logic is called, execute step 308; if the NOTEXIST operation logic is called, execute step 309;
[0124] It should be noted that the four operation logics of IN, NOTIN, EXIST, and NOTEXIST are irrelevant to the selected affinity rule. They only indicate whether the current scheduling rule is triggered. That is, each affinity rule can call any of the four operation logics.
[0125] Step 306: traverse X and the values specified by the current rule expression to be checked. If there is a match, return true; otherwise, return false.
[0126] For example, if the rule to be checked is a strong anti-affinity rule, and X is set to the list of instances allowed to be deployed on host node A1 corresponding to instance C35, where the values of X are C31, C35, C39, C16, and C23, and the values set are C16 and C33, then C35 and C16 meet the strong anti-affinity rule and cannot be deployed on the same host node at the same time. The strong anti-affinity rule also applies to C35 and C33, and cannot be deployed on the same host node at the same time. Since X and values match (i.e., both have C16), the return value is true, triggering the strong anti-affinity rule.
[0127] Step 307: traverse X and the values specified by the current rule expression to be checked. If there is no match, return true; otherwise, return false.
[0128] For example, if the current rule to be verified is a strong affinity rule, and X is set to the list of instances allowed to be deployed on host node A1 corresponding to instance C35, where the values of X are C31, C35, C39, C16, and C23, and the values set are C14 and C33, then the strong affinity rule is satisfied between C35 and C14, and both instances must be deployed on the same host node. The strong affinity rule is also satisfied between C35 and C33, and both instances must be deployed on the same host node. Since there is no match between X and values, that is, there are no identical instances, the return value is true, and the strong affinity rule is not triggered.
[0129] Step 308, traverse X, if it is not empty, return true; otherwise return false;
[0130] For example, if the current rule to be checked is a strong anti-affinity rule, set X to the list of instances allowed to be deployed by host node A1 corresponding to instance C35, where the values of X are C31, C35, C39, C16, and C23. Traverse X, and since X is not empty, return the value true.
[0131] Step 309, traverse X, if it is empty, return true; otherwise return false;
[0132] For example, if the current rule to be checked is a strong anti-affinity rule, set X to the list of instances allowed to be deployed by host node A1 corresponding to instance C35, where the value of X is an empty set, traverse X, and since X is empty, the value true is returned.
[0133] Step 210, determining whether the available resources of the current host node are sufficient, if so, executing step 211, otherwise, returning to step 207;
[0134] Specifically, an instance that is allowed to be deployed and corresponds to the current host node is selected from the list of instances to be scheduled; for each instance that is allowed to be deployed, if the available resources of the current host node meet the deployment requirements of the current instance, the current instance is allowed to be deployed on the current host node; if the available resources of the current host node do not meet the deployment requirements of the current instance, the current instance cannot be deployed on the current host node, and the next host node in the host node list is traversed.
[0135] Specifically, to determine whether the available resources of the current host node meet the deployment requirements of the current instance, the available resources of the current host node can be determined from three dimensions: central processing unit (CPU), memory, and disk. If all three dimensions of the available resources of the current host node meet the deployment requirements of the current instance, the current host node is added to the pre-selected host node list; if any one of the three dimensions of the available resources of the current host node does not meet the deployment requirements of the current instance, the next host node in the host node list is determined.
[0136] like Figure 4 As shown in FIG, a specific flow chart for determining whether the available resources of the current host node are sufficient includes the following steps:
[0137] Step 401: Obtain available resources of the current host node and obtain preset resource requirements of the current instance;
[0138] Step 402: Determine whether the available CPU of the current host node is greater than the required CPU of the current instance. If so, execute step 403; otherwise, execute step 406.
[0139] Step 403: Determine whether the available memory of the current host node is greater than the required memory of the current instance. If so, execute step 404; otherwise, execute step 406.
[0140] Step 404: determine whether the available disk of the current host node is greater than the required disk of the current instance. If so, execute step 405; otherwise, execute step 406.
[0141] Step 405: The current host node has sufficient available resources and is added to the pre-selected host node list PreChooseHosts;
[0142] Step 406: The available resources of the current host node are insufficient and the current host node cannot be added to the pre-selected host node list PreChooseHosts.
[0143] It's important to note that the weighting of CPU, memory, and disk can vary across cluster types. For example, for compute clusters, the weighting of CPU and memory can be increased during host node preselection, meaning that host nodes with high CPU and / or large memory capacity can be preferred. For storage clusters, the weighting of disk can be increased during host node preselection, meaning that host nodes with large disk capacity can be preferred. By configuring different weightings for different cluster types, we can select superior host nodes.
[0144] Specifically, first select the instance that is allowed to be deployed corresponding to the current host node from the list of instances to be scheduled, and then for each instance that is allowed to be deployed, if the instance has a binding relationship with the instance that is allowed to be deployed and complies with the principle of non-mutual exclusion, and the available resources of the current host node meet the deployment requirements of the current instance, then the current host node meets the first preset rule and is added to the pre-selected host node list PreChooseHosts; if the current host node does not meet any of the above-mentioned first preset rules, traverse the next host node in the host node list.
[0145] Step 211, add the current host node to the pre-selected host node list PreChooseHosts;
[0146] Specifically, if the pre-selected host node list (PreChooseHosts) corresponding to any instance is empty, other host nodes outside the host node list can be obtained and added to the host node list, and the instance can be deployed to the host node. By obtaining other host nodes outside the host node list, this method reduces the probability of instance allocation failure and thus improves the reliability of cluster resource allocation results.
[0147] In an embodiment of the present invention, a host node is selected from a host node list according to a first preset rule, that is, whether the current host node satisfies a strong affinity rule, whether the current host node satisfies a strong anti-affinity rule, and whether the available resources of the current host node are sufficient are determined. If the current node satisfies all three of the above judgment conditions, the node is selected as a preselected host node and added to the preselected host node list corresponding to the current instance. If the current node does not satisfy any of the three judgment conditions, the next host node is determined. Pre-screening is performed by the above method to preliminarily determine the optional preselected host nodes for the current instance, thereby narrowing the selection range and improving the efficiency of node allocation.
[0148] As an optional implementation, according to the second preset rule, the optimal host node is selected from the pre-selected host node list. Specifically, for each host node corresponding to each instance, the score of the host node corresponding to the instance can be determined according to the preset correspondence between the host node, instance and score, and then the score of each host node corresponding to each instance can be compared, and the host node with the highest score can be selected as the optimal host node.
[0149] It should be noted that, assuming a host node A1, component B1, and component B2, if instance C11 in component B1 is deployed on host node A1, it is recommended to deploy instance C21 in component B2 on host node A1 as well to improve system performance. However, if instance C21 in component B2 does not exist, system functions can be achieved by only deploying instance C11 in component B1 on host node A1. The relationship between instance C11 and instance C21 here meets the weak affinity rule, that is, if instance C11 in component B1 and instance C21 in component B2 are deployed together on host node A1, system performance will be better. If either instance C11 in component B1 or instance C21 in component B2 is deployed on host node A1, system performance will be better. System performance can also be achieved on node A1. If instance C11 of component B1 has already been deployed on host node A1, it is not recommended to deploy instance C21 of component B2 on host node A1 as well. However, if force majeure occurs and instance C11 of component B1 and instance C21 of component B2 must be deployed together on host node A1, system functionality can still be achieved, but system performance will be reduced. Here, instances C11 and C21 satisfy the weak affinity rule. That is, deploying either component B1 or component B2 on host node A1 results in better system performance. System performance can also be achieved if instance C11 of component B1 and instance C21 of component B2 are deployed together on host node A1. The above weak affinity rules and weak anti-affinity rules are predefined and can be expressed in the form of an affinity rule list.
[0150] In specific implementation, the weak affinity rules and weak anti-affinity rules specified in the affinity rule list both pre-set the score (weight) of each host node, where the score defined in the weak affinity rule is a positive integer, and the score defined in the weak anti-affinity rule is a negative integer. Figure 223, for each node in the pre-selected host nodes corresponding to the current instance, determine the to-be-verified rule of the current host node according to the affinity rule list; if the to-be-verified rule of the current host node is a weak affinity rule, then according to the score defined in the weak affinity rule, the score of the current host node that allows the current instance to be deployed can be obtained, wherein the obtained score is a positive integer; if the to-be-verified rule of the current host node is a weak anti-affinity rule, then according to the score defined in the weak anti-affinity rule, the score of the current host node that allows the current instance to be deployed can be obtained, wherein the obtained score is a negative integer.
[0151] Specifically, if the current host node A1 can deploy n instances, C1, C2, ..., Cn, assume that for instance C1, the score of the current host node A1 is Y1; for instance C2, the score of the current host node A1 is Y2; ... for instance Cn, the score of the current host node A1 is Yn. By summing the above scores, Y1, Y2, ..., Yn, we can get the total score Y of the current host node, and then compare and select the host node with the highest score as the optimal host node.
[0152] In this embodiment of the present invention, based on a preset correspondence between host nodes, instances, and scores, the scores of the host nodes corresponding to the instances are determined, and the scores of each host node are compared to select the host node with the highest score as the optimal host node. This method has a relatively flexible scoring rule for the host nodes corresponding to the instances, making it adaptable to a wide range of different host nodes, thus enhancing its universality.
[0153] Specifically, if there are at least two host nodes with the highest scores, the idle resources of the at least two host nodes with the highest scores may be compared, and the host node with the most idle resources may be selected as the optimal host node.
[0154] In the specific implementation, see Figure 2 23, after selecting the optimal host node from the pre-selected host node list, binding the optimal host node to the current instance to obtain a specific flow chart of the binding relationship between the host node and the instance, includes the following steps:
[0155] Step 212: traverse the pre-selected host node list PreChooseHosts, score each host node, and select the best host node;
[0156] Step 213: Determine whether the weak affinity rule score of the current host node is greater than the highest score of the host node. If so, execute step 215; if so, execute step 214; if so, return to step 212.
[0157] Step 214: compare the idle resource levels of the host nodes and select the host node with the most idle resources as the optimal host node;
[0158] Specifically, host nodes with more idle resources are selected as optimal host nodes. When analyzing idle resources on host nodes, we can analyze them from three dimensions: CPU, memory, and disk. Different weights can be preset for different types of clusters. For example, for computing clusters, we can increase the weight of CPU and memory; for storage clusters, we can increase the weight of disk.
[0159] like Figure 5 As shown in FIG, a preferred workflow diagram for resource planning includes the following steps:
[0160] Step 501, input host node host1, host node host2;
[0161] Among them, host node host1 and host node host2 have the highest scores and are equal.
[0162] Step 502: collecting idle resources of host node host1 and collecting idle resources of host node host2;
[0163] Step 503: Weightedly calculate the idle resource score S1 of the host node host1 and the idle resource score S2 of the host node host2;
[0164] Specifically, the idle resources of the host node host1 and the host node host2 are collected respectively, and weighted calculations are performed according to the preset weights and the absolute values of the idle resources to obtain the idle resource status score S1 of the host node host1 and the idle resource status score S2 of the host node host2.
[0165] Step 504, determine whether the condition S1>S2 is satisfied, if so, execute step 505, otherwise, execute step 506;
[0166] Step 505: host node host1 is selected as the optimal host node;
[0167] Step 506: select the host node host2 as the optimal host node.
[0168] In the embodiment of the present invention, S1 and S2 are compared, and the host node with the highest score is selected as the optimal host node.
[0169] Step 215: Bind the current instance to the optimal host node to obtain a binding relationship between the host node and the instance;
[0170] Step 216: Determine whether a host node is deployed for each instance. If so, execute step 217; otherwise, execute step 218.
[0171] Step 217: output the adjusted binding relationship between the host node and the component module instance;
[0172] Step 218: Output the allocation failure reason and the list of allocated host nodes.
[0173] An embodiment of the present invention provides a cluster resource planning method. If there are at least two host nodes with the highest scores, the idle resources of the at least two host nodes with the highest scores are compared, and the host node with the highest idle resource score is selected as the optimal host node. Therefore, by configuring different dimensions and weights to prioritize the idle resources of host nodes, the scoring rules are flexible and can be widely applied to different types of clusters. In addition, the dual optimization rule of prioritizing the host node with the highest score and the highest idle resource score further ensures the excellence of the resource allocation results.
[0174] As an implementation method, the method may also quantify the expert experience into a set of JSON template files, including an affinity rule list, a first preset priority, a second preset priority, available resources of the host node, and a preset weight.
[0175] If there is no template file based on expert experience, it is necessary to pre-set the relationship between modules in the component, the affinity rule list, the first preset priority, the second preset priority, the preset weight, and the available resources of the host node.
[0176] By solidifying expert experience and generating template files, cluster resource planning methods can be efficiently automated. The definition of component affinity rules is created in the template files, which can accurately express the dependencies and mutual exclusion relationships between components. The template files can also be used to consider the resource requirements of components in a hierarchical manner, and the requirements of different layers can be considered separately. In addition, different template combinations can be introduced as needed, and their priority relationships can be adjusted as needed to ensure the rationality and excellence of resource allocation.
[0177] Example 2
[0178] Based on the same concept, an embodiment of the present invention also provides a cluster resource planning device, which is applied to a public cloud platform. Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0179] like Figure 6 As shown, the above device includes the following modules:
[0180] Priority sorting module 601 is used to obtain the host node list and the first component list to be deployed, and then sort the first component list according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled;
[0181] A rule verification module 602 is configured to select a host node from the host node list according to a first preset rule for each instance in each module in the list of instances to be scheduled, and obtain a pre-selected host node list corresponding to the current instance;
[0182] The resource optimization module 603 is configured to select an optimal host node from the pre-selected host node list according to a second preset rule, and bind the optimal host node to the current instance to obtain a binding relationship;
[0183] The deployment module 604 is configured to deploy the instance corresponding to the host node in the binding relationship onto the host node.
[0184] As an optional implementation, the priority sorting module is specifically configured to:
[0185] Arrange each component in the first component list in descending order according to the first preset priority to obtain a second component list;
[0186] Arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component;
[0187] For each module in the component module list, an instance is created for the module according to the attribute information of the number of instances corresponding to the module, so as to obtain a list of instances to be scheduled.
[0188] The priority sorting module is specifically used to:
[0189] Traversing the first component list;
[0190] Sort each component in the first component list in ascending order of priority value.
[0191] As an optional implementation, the first preset rule includes:
[0192] The current host node meets the strong affinity rule;
[0193] Moreover, the current host node meets the strong anti-affinity rule;
[0194] Furthermore, the available resources of the current host node meet the deployment requirements of the current instance.
[0195] As an optional implementation, the resource optimization module is specifically configured to:
[0196] For each host node corresponding to each instance, determine the score of the host node corresponding to the instance based on the preset correspondence between the host node, instance, and score;
[0197] The scores of each host node corresponding to each instance are compared, and the host node with the highest score is selected as the optimal host node.
[0198] As an optional implementation, if there are at least two host nodes with the highest scores, the resource optimization module is further configured to:
[0199] The idle resources of at least two host nodes with the highest scores are compared, and the host node with the most idle resources is selected as the optimal host node.
[0200] As an optional implementation manner, before selecting a host node from the host node list according to the first preset rule to obtain a pre-selected host node list corresponding to the current instance, the rule verification module is further configured to:
[0201] Traverse the list of instances to be scheduled;
[0202] For each instance in the list of instances to be scheduled, initialize a list of pre-selected host nodes corresponding to the current instance.
[0203] Example 3
[0204] Based on the same concept, an embodiment of the present invention also provides a cluster resource planning device, which is applied to a public cloud platform. Since the cluster resource planning device is the cluster resource planning device in the method in the embodiment of the present invention, and the principle of solving the problem by the cluster resource planning device is similar to that of the method, the implementation of the cluster resource planning device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0205] Refer to the following Figure 7 The cluster resource planning device 70 according to this embodiment of the present invention will be described. Figure 7 The cluster resource planning device 70 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0206] like Figure 7 As shown, cluster resource planning device 70 can be implemented as a general-purpose computing device, such as a terminal device. Components of cluster resource planning device 70 may include, but are not limited to, the at least one processor 71 described above, the at least one memory 72 storing instructions executable by processor 71, and a bus 73 connecting various system components (including memory 72 and processor 71). Processor 71 is a processor of an intelligent device.
[0207] The processor 71 executes the executable instructions to implement the following steps:
[0208] After obtaining the host node list and the first component list to be deployed, sorting the first component list according to the first preset priority and the second preset priority to obtain a list of instances to be scheduled;
[0209] For each instance in each module in the list of instances to be scheduled, select a host node from the host node list according to a first preset rule to obtain a pre-selected host node list corresponding to the current instance;
[0210] According to the second preset rule, after selecting the optimal host node from the pre-selected host node list, the optimal host node is bound to the current instance to obtain a binding relationship;
[0211] Deploy the instance corresponding to the host node in the binding relationship to the host node.
[0212] As an optional implementation manner, the processor 71 is specifically configured to:
[0213] Arrange each component in the first component list in descending order according to the first preset priority to obtain a second component list;
[0214] Arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component;
[0215] For each module in the component module list, an instance is created for the module according to the attribute information of the number of instances corresponding to the module, so as to obtain a list of instances to be scheduled.
[0216] As an optional implementation manner, the processor 71 is specifically configured to:
[0217] Traverse the first component list;
[0218] Sort each component in the first component list in ascending order of priority.
[0219] As an optional implementation, the first preset rule includes:
[0220] The current host node meets the strong affinity rule;
[0221] Moreover, the current host node meets the strong anti-affinity rule;
[0222] Furthermore, the available resources of the current host node meet the deployment requirements of the current instance.
[0223] As an optional implementation manner, the processor 71 is specifically configured to:
[0224] For each host node corresponding to each instance, determine the score of the host node corresponding to the instance based on the preset correspondence between the host node, instance, and score;
[0225] The scores of each host node corresponding to each instance are compared, and the host node with the highest score is selected as the optimal host node.
[0226] As an optional implementation manner, if there are at least two host nodes with the highest scores, the processor 71 is further configured to:
[0227] The idle resources of at least two host nodes with the highest scores are compared, and the host node with the most idle resources is selected as the optimal host node.
[0228] As an optional implementation manner, before selecting a host node from the host node list according to the first preset rule and obtaining a pre-selected host node list corresponding to the current instance, the processor 71 is further configured to:
[0229] Traverse the list of instances to be scheduled;
[0230] For each instance in the list of instances to be scheduled, initialize a list of pre-selected host nodes corresponding to the current instance.
[0231] Bus 73 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, and a processor or local bus using any of a variety of bus architectures.
[0232] The memory 72 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 721 and / or a cache memory 722 , and may further include a read-only memory (ROM) 723 .
[0233] The memory 72 may also include a program / utility 725 having a set (at least one) of program modules 724, such program modules 724 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0234] The cluster resource planning device 70 can also communicate with one or more external devices 74 (e.g., a keyboard, pointing device, etc.), one or more devices that enable a user to interact with the cluster resource planning device 70, and / or any device that enables the cluster resource planning device 70 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). This communication can occur via an input / output (I / O) interface 75. Furthermore, the cluster resource planning device 70 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 76. As shown, the network adapter 76 communicates with other modules of the electronic device 70 via a bus 73. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the cluster resource planning device 70, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0235] Example 4
[0236] In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps of each module in the cluster resource planning device according to various exemplary embodiments of the present disclosure described in the "Exemplary Method" section above. For example, the network-side device may be used to obtain a host node list and a first component list to be deployed, sort the first component list according to a first preset priority and a second preset priority to obtain a list of instances to be scheduled; for each instance in each module in the list of instances to be scheduled, select a host node from the host node list according to a first preset rule to obtain a pre-selected host node list corresponding to the current instance; after selecting an optimal host node from the pre-selected host node list according to a second preset rule, bind the optimal host node to the current instance to obtain a binding relationship;
[0237] Deploy the instance corresponding to the host node in the binding relationship to the host node.
[0238] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0239] like Figure 8 FIG. 8 illustrates a program product 80 for cluster resource planning according to an embodiment of the present invention. The program product 80 may be a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0240] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0241] Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0242] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0243] It should be noted that although several modules or submodules of the system are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules described above can be embodied in a single module. Conversely, the features and functions of a single module described above can be further divided and embodied by multiple modules.
[0244] Furthermore, although the operations of the various modules of the system of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all illustrated operations must be performed to achieve the desired results. Additionally or alternatively, some operations may be omitted, multiple operations may be combined into one operation, and / or one operation may be decomposed into multiple operations.
[0245] The present application is described above with reference to block diagrams and / or flow charts illustrating methods, apparatus (systems) and / or computer program products according to embodiments of the present application. It should be understood that a block of a block diagram and / or flow chart, as well as a combination of blocks of a block diagram and / or flow chart, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine such that instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.
[0246] Accordingly, the present application may also be implemented using hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, transmit, or convey a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0247] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A cluster resource planning method, characterized in that: Applied to public cloud platforms, including: After obtaining the host node list and the first component list to be deployed, each component in the first component list is sorted in descending order according to the first preset priority to obtain a second component list, wherein the components in the second component list are sorted from highest to lowest priority; Arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component; For each module in the component module list, create an instance for the module according to the attribute information of the number of instances corresponding to the module, and obtain a list of instances to be scheduled; For each instance in each module in the list of instances to be scheduled, selecting a host node in the host node list according to a first preset rule to obtain a pre-selected host node list corresponding to the current instance; After selecting an optimal host node from the pre-selected host node list according to a second preset rule, the optimal host node is bound to the current instance to obtain a binding relationship; Deploy the instance corresponding to the host node in the binding relationship onto the host node.
2. The method according to claim 1, wherein Arranging each component in the first component list in descending order according to the first preset priority includes: Traversing the first component list; Sort each component in the first component list in ascending order according to the priority value, wherein the priority value is in inverse proportion to the priority of the component.
3. The method according to claim 1, wherein The first preset rule includes: The current host node meets the strong affinity rule; Furthermore, the current host node satisfies the strong anti-affinity rule; Furthermore, the available resources of the current host node meet the deployment requirements of the current instance.
4. The method according to claim 1, wherein The selecting the optimal host node from the pre-selected host node list according to the second preset rule includes: For each host node corresponding to each instance, determine the score of the host node corresponding to the instance according to a preset correspondence between host nodes, instances, and scores; The scores of each host node corresponding to each instance are compared, and the host node with the highest score is used as the optimal host node.
5. The method according to claim 4, wherein If the host nodes with the highest scores include at least two, the method further includes: The idle resources of the at least two host nodes with the highest scores are compared, and the host node with the most idle resources is used as the optimal host node.
6. The method according to any one of claims 1 to 5, characterized in that: Before selecting a host node from the host node list according to the first preset rule to obtain a pre-selected host node list corresponding to the current instance, the method further includes: Traversing the list of instances to be scheduled; For each instance in the list of instances to be scheduled, a pre-selected host node list corresponding to the current instance is initialized.
7. A cluster resource planning device, characterized in that: The system is applied to a public cloud platform and comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the cluster resource planning method according to any one of claims 1 to 6 when executing the computer program.
8. A cluster resource planning device, characterized in that: Applied to public cloud platforms, including: A priority sorting module is configured to, after obtaining a list of host nodes and a list of first components to be deployed, arrange each component in the first component list in descending order according to a first preset priority to obtain a second component list, wherein the components in the second component list are arranged in descending order according to priority; arrange the modules corresponding to each component in the second component list in descending order according to the second preset priority to obtain a component module list corresponding to the current component; for each module in the component module list, create an instance for the module according to attribute information of the number of instances corresponding to the module to obtain a list of instances to be scheduled; a rule verification module, configured to select a host node from the host node list according to a first preset rule for each instance in each module in the list of instances to be scheduled, and obtain a pre-selected host node list corresponding to the current instance; a resource optimization module, configured to select an optimal host node from the pre-selected host node list according to a second preset rule, and bind the optimal host node to the current instance to obtain a binding relationship; The deployment module is used to deploy the instance corresponding to the host node in the binding relationship onto the host node.
9. A computer storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the steps of the cluster resource planning method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Prioritization associated with controller engine instances
US20080208363A1
Multidimensional resource allocation in data centers
US20180254999A1