Method and apparatus for determining target machine

By using a multidimensional knapsack combinatorial optimization algorithm to automatically select target machines in the data center, the problems of long maintenance cycles and reliance on manpower are solved, enabling efficient and automated machine maintenance and reducing labor costs.

CN112130985BActive Publication Date: 2025-11-18BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201910554301.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-25
Publication Date
2025-11-18
Estimated Expiration
2039-06-25

AI Technical Summary

Technical Problem

In existing technologies, data center machine maintenance cycles are long and rely on manual labor, which is prone to errors and makes it difficult to efficiently select target machines for maintenance.

Method used

A multidimensional knapsack combinatorial optimization algorithm based on a greedy strategy is adopted. The algorithm generates a target sorting sequence using the number of service instances and deployment information, automatically filters out target machines, dynamically adjusts the number of service instances that can be stopped, and generates a new sorting sequence until all target machines are filtered out.

Benefits of technology

While ensuring service reliability, maximize the number of target machines, shorten maintenance cycles, reduce labor costs, and avoid manual screening and scaling up/down operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112130985B_ABST
    Figure CN112130985B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for determining target machines, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: in step S101, the number of service instances that can be stopped of a service is obtained according to service instances and service factors; in step S102, a target sorting sequence of a machine to be maintained is generated according to the number of service instances that can be stopped and deployment information between the service instances and the machine to be maintained; in step S103, a target machine is selected from the machine to be maintained according to the number of service instances deployed on the machine to be maintained and the number of service instances that can be stopped, according to the target sorting sequence; and in step S104, the machine to be maintained, the number of service instances that can be stopped and the deployment information between the service instances and the machine to be maintained are updated, and steps S102 to S104 are repeatedly executed until no target machine can be selected from the machine to be maintained. The embodiment does not need to consume manpower to perform service screening, expansion and contraction and migration operations, and can maximize the number of target machines and greatly shorten the maintenance period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for identifying a target machine. Background Technology

[0002] In large data centers, numerous services are often deployed across the same batch of machines. These services have certain reliability requirements, so many service instances run to meet these requirements. Meanwhile, due to business or security needs, machines in the data center undergo periodic downtime for maintenance. However, during maintenance, service reliability must still be guaranteed; that is, when the machine being maintained is shut down, the number of instances of those services with reliability requirements must still not fall below a certain threshold. Therefore, determining which machines to maintain while ensuring service reliability is crucial.

[0003] In existing technologies, maintenance personnel first manually identify which services fail to meet reliability requirements when a small batch of machines is down. Then, services are scaled up or migrated to meet reliability requirements. Next, these machines are shut down for maintenance, and this process is repeated until all machines are maintained. In developing this invention, the inventors discovered that existing technologies have at least the following problems: the maintenance cycle for all machines is long, and it relies entirely on manual labor, making it prone to errors. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method and apparatus for determining target machines, which eliminates the need for manpower to perform service screening, scaling up and down, and migration operations, and can maximize the number of target machines and significantly shorten the maintenance cycle.

[0005] To achieve the above objectives, according to a first aspect of the present invention, a method for determining a target machine is provided.

[0006] An embodiment of the present invention provides a method for determining a target machine, comprising: step S101, obtaining the number of service instances that can be shut down for at least one service based on service instances and service factors corresponding to at least one service; step S102, generating a target sorting sequence for the machines to be maintained based on the number of service instances that can be shut down for at least one service and the deployment information between the service instances and the machines to be maintained; step S103, selecting a target machine from the machines to be maintained according to the target sorting sequence, based on the number of service instances of at least one service deployed on the machines to be maintained and the number of service instances that can be shut down for at least one service; step S104, updating the machines to be maintained, the number of service instances that can be shut down for at least one service, and the deployment information between the service instances and the machines to be maintained, and repeating steps S102 to S104 until a target machine cannot be selected from the machines to be maintained.

[0007] Optionally, generating a target sorting sequence for the machines to be maintained based on the number of stoppable service instances of at least one service and the deployment information between the service instances and the machines to be maintained includes: sorting the at least one service in ascending order of the number of stoppable service instances of the at least one service, and grouping and merging services with the same number of service instances to obtain a service grouping sequence, wherein the service grouping sequence includes at least one service group; obtaining specific information of the at least one service group based on the deployment information between the service instances and the machines to be maintained; and sorting the machines to be maintained based on the sorting order of the at least one service group in the service grouping sequence and in combination with the specific information to obtain the target sorting sequence for the machines to be maintained.

[0008] Optionally, the specific information includes at least one of the following: service instance deployment information, maximum number of service instances, number of service instances and average number of service instances.

[0009] Optionally, the step of selecting target machines from the machines to be maintained according to the target sorting sequence, based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be shut down, includes: according to the target sorting sequence, sequentially determining whether the number of service instances of at least one service deployed on the machines to be maintained exceeds the number of service instances of at least one service that can be shut down; if yes, then determining the next machine; if no, then confirming the machine as the target machine and selecting the target machine from the machines to be maintained.

[0010] To achieve the above objectives, according to a second aspect of the present invention, an apparatus for determining a target machine is provided.

[0011] An apparatus for determining a target machine according to an embodiment of the present invention includes:

[0012] The acquisition module is used to execute step S101, which obtains the number of service instances that can be stopped for at least one service based on the service instance and service factor corresponding to at least one service; the determination module is used to execute steps S102 to S104, wherein...

[0013] Step S102 generates a target sorting sequence of machines to be maintained based on the number of service instances that can be shut down for at least one service and the deployment information between the service instances and the machines to be maintained; Step S103, according to the target sorting sequence, selects target machines from the machines to be maintained based on the number of service instances of at least one service deployed on the machines to be maintained and the number of service instances that can be shut down for at least one service; Step S104 updates the machines to be maintained, the number of service instances that can be shut down for at least one service, and the deployment information between the service instances and the machines to be maintained, and repeats steps S102 to S104 until no target machines can be selected from the machines to be maintained.

[0014] Optionally, the generation module is further configured to: sort the at least one service in ascending order of the number of service instances that can be stopped, and group and merge services with the same number of service instances to obtain a service group sequence, the service group sequence including at least one service group; obtain specific information of the at least one service group based on the deployment information between the service instances and the machines to be maintained; and sort the machines to be maintained according to the sorting order of the at least one service group in the service group sequence and in combination with the specific information to obtain a target sorting sequence of the machines to be maintained.

[0015] Optionally, the specific information includes at least one of the following: service instance deployment information, maximum number of service instances, number of service instances and average number of service instances.

[0016] Optionally, the extraction module is further configured to: determine, according to the target sorting sequence, whether the number of service instances of at least one service deployed on the machines to be maintained exceeds the number of service instances that can be stopped for at least one service; if yes, determine the next machine; if no, confirm the machine as the target machine and filter out the target machine from the machines to be maintained.

[0017] To achieve the above objectives, an electronic device is provided according to a third aspect of the present invention.

[0018] An electronic device according to an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining a target machine according to an embodiment of the present invention.

[0019] To achieve the above objectives, a computer-readable medium is provided according to a fourth aspect of the present invention.

[0020] An embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method for determining a target machine according to an embodiment of the present invention.

[0021] One embodiment of the above invention has the following advantages or beneficial effects: it can generate a target sorting sequence of machines to be maintained by utilizing the number of service instances that can be stopped and the deployment information between service instances and machines to be maintained. Then, it can select target machines from the machines to be maintained by using the order of the target sorting sequence. Furthermore, this embodiment can dynamically adjust the number of service instances that can be stopped. After identifying target machines, a new target sorting sequence is generated, and the new target sorting sequence can be analyzed until all target machines are extracted. Therefore, this embodiment of the invention can solve the problem of providing an effective and efficient algorithm for screening target machines to be maintained while meeting service reliability requirements. It eliminates the need for manpower to perform service screening, scaling up and down, migration, and other operations. Moreover, it maximizes the number of target machines in each screening, significantly shortens the maintenance cycle, and thus reduces overall labor costs.

[0022] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0023] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0024] Figure 1 This is a schematic diagram of the main steps of a method for determining a target machine according to an embodiment of the present invention;

[0025] Figure 2 This is a schematic diagram of the main flow of a method for determining a target machine according to a reference embodiment of the present invention;

[0026] Figure 3 This is a schematic diagram of the overall architecture of the target machine according to an embodiment of the present invention;

[0027] Figure 4 This is a schematic diagram of the main modules of the apparatus for determining a target machine according to an embodiment of the present invention;

[0028] Figure 5 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0029] Figure 6 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0030] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0031] This invention can abstract the problem of determining a target machine into a multidimensional knapsack combinatorial optimization problem. The knapsack problem, given a set of items, each with its own weight and value, asks how to select items within a limited total weight to maximize the total value. The multidimensional knapsack problem, also given a set of items, each with its own weight, volume, and other constraints, and each with its own value, asks how to select items within a limited total weight, volume, and other constraints to maximize the total value. The multidimensional knapsack combinatorial optimization problem is NP-complete (Non-deterministic Polynomial), meaning that no algorithm can arrive at the optimal solution within a reasonable timeframe. This invention, considering the specific requirements of determining the target machine, designs an approximate optimal solution algorithm based on a greedy strategy (i.e., always making the best choice at the moment, selecting the currently local optimum without considering the overall optimum). Within a reasonable computation timeframe, it can yield results close to the optimal solution. In other words, the target machine is determined using a multidimensional knapsack combinatorial optimization algorithm based on a greedy strategy. For example, if a service runs on two different machines, with three instances running on one machine and one on the other, from a service availability perspective, repairing the machine running only one instance is definitely more appropriate than repairing the machine running three instances, even when both are the same machine. This embodiment of the invention selects the machine with the maximum number of instances for repair while ensuring service reliability.

[0032] Figure 1 This is a schematic diagram illustrating the main steps of a method for determining a target machine according to an embodiment of the present invention. As a possible embodiment of the present invention, such as... Figure 1 As shown, the main steps of the method for determining the target machine in this embodiment of the invention may include steps S101 to S104.

[0033] Step S101: Based on the service instance and service factor corresponding to at least one service, obtain the number of service instances that can be stopped for at least one service.

[0034] In this embodiment of the invention, when abstracting the machine selection problem into a multi-dimensional knapsack problem, each service is treated as a dimension of the knapsack, each machine as a candidate item, the number of service instances deployed on a machine for a service is considered the cost of that machine in that service dimension, and the capacity of the knapsack is the number of service instances that can be shut down. Therefore, the problem of determining the target machine in this embodiment can be understood as determining which machines can be put into the knapsack without exceeding its capacity. These machines that can be put into the knapsack are the target machines, i.e., the machines that can be repaired in this task. Therefore, in determining the target machine in this embodiment, the number of shut-down service instances for at least one service is first calculated.

[0035] Typically, a service is deployed across multiple physical machines, running numerous service instances (i.e., application instances) to meet its reliability requirements. In other words, the service instances corresponding to the service are deployed across multiple physical machines. When machines in a data center are under maintenance, the service is affected. To ensure service reliability, the number of service instances corresponding to the service must not be less than a certain value. In this embodiment of the invention, the certain number of service instances represents the minimum requirement for the service to run. At this minimum, the service can still operate, but the load may be relatively high. If any abnormal situation suddenly occurs, such as a surge in traffic, the service may fail to operate normally. It is important to note that maintenance will be performed to avoid such abnormal situations. However, in a real-world scenario, if a normal service requires 100 service instances, 150 service instances will be running online to prevent a service avalanche due to short-term pressure.

[0036] In this embodiment of the invention, the number of service instances that can be shut down (i.e., the proportion of the minimum acceptable number of service instances to ensure service reliability to the total number of service instances) is calculated based on the service factor corresponding to the service. For ease of description, the number of service instances that can be shut down in this embodiment refers to the maximum value of the number of service instances that can be shut down. Furthermore, the service factor is different for different services. For example, consider two services, service1 and service2. Service1 has 100 service instances and a service factor of 0.5, while service2 has 150 service instances and a service factor of 0.6. Therefore, the number of service instances that can be shut down for service1 is 50, and the number of service instances that can be shut down for service2 is 60.

[0037] Step S102: Based on the number of service instances that can be stopped for at least one service and the deployment information between the service instances and the machines to be maintained, generate a target sorting sequence of machines to be maintained. The deployment information between the service instances and the machines to be maintained refers to the specific machine on which the service instance is deployed. Table 1 shows the deployment information between service instances and the machines to be maintained. Table 1 contains services service1 to service5 and machines node1 to machine node6. As can be seen from the table, service1 has 4 service instances, and their deployment information is as follows: 1 service instance is deployed on machine node1, 2 service instances are deployed on machine node4, and 1 service instance is deployed on machine node6.

[0038] Table 1 Deployment Information Between Service Instances and Machines to be Maintained

[0039] service1 service2 service3 service4 service5 node1 1 0 1 2 0 node2 0 1 1 1 0 node3 0 1 0 1 2 node4 2 0 1 1 0 node5 0 0 2 0 2 node6 1 1 0 1 1

[0040] This invention abstracts the machine selection problem into a multi-dimensional knapsack problem, which involves determining which machines can be placed in the knapsack. This requires sequentially determining whether the machines to be maintained can be placed in the knapsack. Therefore, in step S102, a target sorting sequence of the machines to be maintained is generated. In this invention, the number of service instances that can be shut down, calculated in step S101, is combined with the deployment information between the service instances and the machines to be maintained to sort all the machines to be maintained, thus generating a judgment order for the machines to be maintained. For example, if there are machines to be maintained: node1, node2, node3, node4, node5, and node6, the generated target sorting sequence is node2, node4, node1, node6, node5, and node3. Therefore, the priority is to determine whether node2 can be placed in the knapsack, that is, to determine whether the service can operate normally if node2 is under maintenance.

[0041] Based on the above description, generating the target sorting sequence of machines to be maintained is a crucial part of this technical solution. In this embodiment, the target sorting sequence of machines to be maintained is generated based on a greedy strategy. The greedy strategy used in this algorithm considers the cost across all service dimensions, prioritizing the machine with the lowest overall cost ratio across all service dimensions. Therefore, as another parametric embodiment of this invention, step S102, based on the number of service instances that can be shut down for at least one service and the deployment information between the service instances and the machines to be maintained, generates the target sorting sequence of machines to be maintained, and may include steps S1021, S1022, and S1023.

[0042] Step S1021: Sort the at least one service in ascending order of the number of stopable service instances, and group and merge services with the same number of service instances to obtain a service group sequence, wherein the service group sequence includes at least one service group. In step S1021, the capacity of each dimension of the knapsack is sorted in ascending order, and dimension services with the same capacity are grouped and merged. Here, only the dimension service groups are retained, and the capacity of the groups is not retained. In the scenario of this embodiment of the invention, the sorting is performed in ascending order of the number of stopable service instances of at least one service, and if services with the same number of stopable service instances are grouped into the same group, a service group sequence can be obtained. For example, there are services service1, service2, service3, service4, and service5, and their corresponding stopable service instance numbers are 2, 1, 2, 3, and 2, respectively. Then the obtained service group sequence is (service2)(service1, service3, service5)(service4). The advantage of sorting services in ascending order of the number of stopable service instances in this embodiment of the invention is that it allows starting with services with lower costs (considered as the number of stopable service instances), thus maximizing the number of target machines. For example, if two services have 1 and 3 stopable service instances respectively, from a cost perspective, analyzing the service with 1 stopable service instance is more appropriate than analyzing the service with 3 stopable service instances.

[0043] Step S1022: Obtain specific information of the at least one service group based on the deployment information between the service instance and the machine to be maintained. After obtaining the service group sequence and each service group in step S1021, it is necessary to obtain specific information of each service group based on the deployment information between the service instance and the machine to be maintained. The specific information in this embodiment may include: service instance deployment information, maximum number of service instances, number of service instances, and average number of service instances.

[0044] Among them, service instance deployment information refers to the specific number of service instances deployed on the machines to be maintained. For example, in Table 1, the number of service instances for service2 is (0, 1, 1, 0, 0, 1). The maximum number of service instances refers to the maximum number of service instances deployed on the machines to be maintained. For example, in Table 1, the maximum number of service instances deployed for service1 on the machines to be maintained (node1 to node6) is 2 (i.e., 2 service instances are deployed on machine node4), and the maximum number of service instances deployed for service1 on the machines to be maintained (node1 to node3) is 1 (i.e., 1 service instance is deployed on machine node1). The total number of service instances refers to the total number of service instances deployed on the machines to be maintained. The information includes, for example, in Table 1, the service instances and information deployed by service1 on the machines to be maintained (node1 to node6) are 4 (i.e., a total of 4 service instances are deployed on machines node1 to node6), and the service instances and information deployed by service1 on the machines to be maintained (node1 to node3) are 1 (i.e., a total of 1 service instance is deployed on machines node1 to node3). The average number of service instances refers to the average number of service instances deployed on the machines to be maintained. For example, in Table 1, the average number of service instances deployed by service1 on the machines to be maintained (node1 to node6) is 1.33 (since no service instances are deployed on machines node2, node3, and node5, they are not considered). In this embodiment of the invention, the service grouping sequence is obtained in step S1021. However, analysis from step S102 shows that this scheme uses a greedy strategy to generate the target sorting sequence of the machines to be maintained. Therefore, the service grouping sequence obtained in step S1021 only considers the service cost and prioritizes services with lower service costs, i.e., it analyzes services with fewer service instances that can be stopped. However, for a service, the number of service instances deployed on multiple machines may be the same. For example, service1 in Table 1 has no service instances deployed on machines node2, node3, and node5. In this case, it is necessary to use other specific information about the service group, such as the maximum number of service instances, the number of service instances, and the average number of service instances, for sorting and analysis. The advantage of doing this is that machines with a lower overall number of deployed service instances can be selected first, thereby maximizing the number of target machines.

[0045] Step S1023: Based on the sorting order of at least one service group in the service group sequence and in conjunction with the specific information, sort the machines to be maintained to obtain the target sorting sequence of the machines to be maintained. The purpose of this step is to sort all the machines to be maintained according to the service group sequence obtained in step S1021, that is, to sort them in ascending order from the first service group to the last service group. Specifically, if a service group contains only one service, then sort the machines in ascending order according to the number of service instances deployed on each machine for that service. If a service group contains multiple services, then the specific information of the service group can be used to sort them in ascending order according to the maximum value, sum, or average value (wherein the priority order of the maximum value, sum, or average value can be set according to the actual situation).

[0046] Taking Table 1 as an example, assuming that the service factor of each service is 0.5, the number of service instances that can be stopped for service1 to service5 are 2, 1, 2, 3, 2 respectively, that is, the backpack capacity is (2, 1, 2, 3, 2). Grouping and sorting service1 to service5, the service group sequence is (service2)(service1, service3, service5)(service4).

[0047] (1) Analyzing the first service group, which only contains service2, we can analyze the service instances deployed on machines node1 to node6 for service2. We find that no service instances are deployed on node1, node4, and node5, and one service instance is deployed on node2, node6, and node3 respectively. Therefore, the initial sorting of machines node1 to node6 can be (node1, node4, node5) (node2, node3, node6).

[0048] (2) Use the second service group to determine the sorting order of node1, node4, and node5. The second service group includes service1, service3, and service5. First, calculate the maximum value of the second service group on machines node1, node4, and node5, which are 1 (service1 has 1 service instance deployed on machine node1, and service3 has 1 service instance deployed on machine node1), 2 (service1 has 2 service instances deployed on machine node4), and 2 (service3 has 2 service instances deployed on machine node5, and service4 has 2 service instances deployed on machine node5). Therefore, sorted in ascending order, machine node1 is at the front.

[0049] (3) Analyze the order of node4 and node5 using the sum information of the second service group. As can be seen from Table 1, the sum information of the second service group on machine node4 and node5 is 3 and 4 respectively. Rank node4 before node5 according to the sorting order, so the sorted node1, node4, and node5 are obtained.

[0050] It's important to note that the same method is used to sort node2, node3, and node6, resulting in the order node2, node6, node3, which will not be repeated here. It's also important to note that in the above assumption, the sorted sequence of machines can be obtained using the first two service groups. If the second service group still cannot yield a sorted sequence, the analysis continues with the next service group. Furthermore, in the above assumption, the priority order is set as maximum value higher than and , and and higher than average. In practical applications, this can be adjusted according to actual needs, which will not be elaborated here. The final machine sorted sequence is node1, node4, node5, node2, node6, node3, thus yielding the sorted deployment information table shown in Table 2.

[0051] Table 2: Deployment Information Table After Sorting

[0052] node1 node4 node5 node2 node6 node3 service2 0 0 0 1 1 1 service1 1 2 0 0 1 0 service3 1 1 2 1 0 0 service5 0 0 2 0 1 2 service4 2 1 0 1 1 1

[0053] Step S103: According to the generated target sorting sequence of the machines to be maintained, and based on the number of service instances of at least one service deployed on the machines to be maintained and the number of service instances of at least one service that can be stopped, select the target machines from the machines to be maintained.

[0054] After generating the target sorting sequence of machines to be maintained in step S102, the system then sequentially determines whether each machine is a target machine, i.e., whether it can be placed in the knapsack. The criterion for this determination is whether placing the machine in the knapsack would exceed its capacity. In this technical solution, the knapsack capacity is determined by the number of service instances that can be stopped for each service. Therefore, the system checks whether the number of service instances deployed on the machine exceeds the number of service instances that can be stopped. If so, the machine is deemed not to be maintained, and the system moves on to the next machine. If not, the machine is considered maintainable, meaning it is a target machine and is selected from the list of machines to be maintained.

[0055] Therefore, as another possible embodiment of the present invention, step S103, according to the target sorting sequence, extracts the target machine from the machine to be maintained based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be stopped, and may include: according to the target sorting sequence, sequentially determining whether the number of service instances of at least one service deployed on the machine to be maintained exceeds the number of service instances of at least one service that can be stopped; if so, determining the next machine; if not, confirming the machine as the target machine and selecting the target machine from the machines to be maintained.

[0056] After step S103, extracting the target machine from the machine to be maintained only indicates the end of the extraction process, not that all target machines have been extracted. If no target machines can be extracted from the machine to be maintained, it means all target machines have been extracted. Therefore, after one extraction is complete, step S104 is executed to update the machine to be maintained, the number of stopable service instances for at least one service, and the deployment information between service instances and the machine to be maintained. Steps S102 to S104 are then repeated until no target machines can be extracted from the machine to be maintained. After extracting the target machine from the machine to be maintained, the machine to be maintained, the backpack capacity (i.e., the number of stopable service instances), and the deployment information between service instances and the machine to be maintained all change. Therefore, these changed information needs to be updated, and steps S102 to S104 are then re-executed until no target machines can be extracted from the machine to be maintained.

[0057] Taking Table 2 as an example, Table 2 is the deployment table obtained after one sorting. At this time, the machines to be maintained are node1 to node6, and the number of service instances that can be stopped for services 1 to 5 are (2, 1, 2, 3, 2) respectively. After obtaining Table 2, it is first determined whether machine node1 can be put into the knapsack, that is, whether the number of instances of each service in machine node1 exceeds the number of service instances that can be stopped. After the determination, machine node1 is the target machine. Then, the number of service instances of each service in node1 is subtracted from the number of service instances that can be stopped, and a new round of sorting is started. Finally, the target machines selected are node1 and node3.

[0058] Figure 2 This is a schematic diagram of the main flow of a method for determining a target machine according to a reference embodiment of the present invention. From Figure 2 As can be seen, the main process of the method for determining the target machine provided in the embodiments of the present invention may include:

[0059] Step S201: Based on the service instance and service factor corresponding to at least one service, obtain the number of service instances that can be stopped for at least one service;

[0060] Step S202: Sort at least one service in ascending order of the number of service instances that can be stopped, and group and merge services with the same number of service instances to obtain a service group sequence, wherein the service group sequence may include at least one service group;

[0061] Step S203: Based on the deployment information between the service instance and the machine to be maintained, obtain at least one specific information of the service group, wherein the specific information may include at least one of the following options: service instance deployment information, maximum number of service instances information, number of service instances and information on the average number of service instances;

[0062] Step S204: Sort the machines to be maintained according to the sorting order of at least one service group in the service group sequence and in combination with specific information to obtain the target sorting sequence of the machines to be maintained.

[0063] Step S205: According to the target sorting sequence, select one machine from the machines to be maintained as the machine to be analyzed;

[0064] Step S206: Determine whether the number of service instances of at least one service deployed on the machine to be analyzed exceeds the number of service instances that can be stopped for at least one service. If yes, proceed to step S207; otherwise, proceed to step S208.

[0065] Step S207: Determine if there are any unanalyzed machines among the machines to be maintained. If yes, proceed to step S205; otherwise, proceed to step S210.

[0066] Step S208: Confirm that the machine to be analyzed is the target machine, and select the target machine from the machines to be maintained;

[0067] Step S209: Update the number of service instances that can be stopped, the number of service instances, and the deployment information between the service instances and the machine to be maintained;

[0068] Step S210: Confirm that all target machines have been selected.

[0069] It is important to note that in this embodiment of the invention, when analyzing the sorted machines to be maintained, only one target machine is extracted at a time. Therefore, after extracting one target machine, the capacity of the knapsack (i.e., the number of service instances that can be stopped) changes. Consequently, the remaining machines to be maintained need to be re-sorted and a new round of filtering is required until no target machine can be selected from the remaining machines. In other words, putting any one of the remaining machines into the knapsack would exceed its capacity. At this point, it is considered that all target machines have been selected, and maintenance of the target machines can be performed while ensuring service reliability.

[0070] Figure 3 This is a schematic diagram of the overall architecture of the target machine according to an embodiment of the present invention. Figure 3 As can be seen, by inputting the list of machines where service instances reside (such as all services on the machines and their service instance deployments), service factors, and a list of potential machines to be maintained, this can be transformed into input for the knapsack algorithm and passed as parameters to a multi-dimensional knapsack combination optimization algorithm based on a greedy strategy. After calculation, the algorithm outputs the maximum number of target machine lists (i.e., the list of machines that can be maintained simultaneously). This embodiment of the invention can solve for an approximate optimal solution within one minute for 2000 machines, 1000 services, and 10 service instances deployed on a single machine for each service. First, the input is transformed. Based on the list of machines where the service instances reside and the service factors, the number of service instances that can be stopped for each service is calculated, i.e., the size of the knapsack. Thus, the machine selection problem is transformed into solving for the combination of selecting the maximum number of items, whose total cost does not exceed the capacity of each service dimension of the knapsack. Then, based on a greedy strategy, the maximum number of items is selected step by step, satisfying that the cost does not exceed the knapsack capacity.

[0071] The technical solution provided by this invention has been applied in the following two areas: When maintaining nodes in a Kubernetes (i.e., a container scheduling tool that can schedule multiple services) cluster, to avoid service reliability degradation caused by downtime, the technical solution provided by this invention maximizes the selection of machine combinations that can be maintained simultaneously without compromising service reliability; when maintaining a Kafka (i.e., a high-throughput distributed publish-subscribe messaging system) service, to avoid multiple replicas being taken offline simultaneously due to proxy service maintenance, thus causing some topics to become unavailable, the maximum list of proxy services that can be maintained simultaneously is selected. The technical solution provided by the embodiments of this invention is also applicable to other scenarios requiring optimized combinations.

[0072] According to the technical solution for determining target machines in this embodiment of the invention, a target sorting sequence of machines to be maintained can be generated by utilizing the number of service instances that can be shut down and the deployment information between service instances and machines to be maintained. Then, the target machines can be selected from the machines to be maintained by using the order of the target sorting sequence. Furthermore, this embodiment can dynamically adjust the number of service instances that can be shut down. After identifying target machines, a new target sorting sequence is generated, and the new target sorting sequence can be analyzed until all target machines are extracted. Therefore, this embodiment of the invention can solve the problem of meeting service reliability requirements while providing an effective and efficient algorithm for screening target machines to be maintained. There is no need to spend manpower on service screening, scaling up and down, migration, etc. Moreover, each screening maximizes the number of target machines, significantly shortens the maintenance cycle, and thus reduces overall labor costs.

[0073] Figure 4 This is a schematic diagram of the main modules of a device for determining a target machine according to an embodiment of the present invention. Figure 4 As shown, the device 400 for determining the target machine in this embodiment of the invention mainly includes the following modules: an acquisition module 401 and a determination module 402.

[0074] The acquisition module 401 can be used to execute step S101, specifically, to acquire the number of service instances that can be stopped for at least one service based on the service instances and service factors corresponding to at least one service. The determination module 402 can be used to execute steps S102 to S104, wherein...

[0075] Step S102 generates a target sorting sequence of machines to be maintained based on the number of service instances that can be shut down for at least one service and the deployment information between the service instances and the machines to be maintained.

[0076] Step S103: According to the target sorting sequence, select the target machine from the machines to be maintained based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be stopped.

[0077] Step S104 updates the number of stoppable service instances of the machine to be maintained, the deployment information between the service instances and the machine to be maintained, and repeats steps S102 to S104 until the target machine cannot be selected from the machines to be maintained.

[0078] In this embodiment of the invention, the determining module 402 can also be used to: sort at least one service in ascending order of the number of service instances that can be stopped, and group and merge services with the same number of service instances to obtain a service group sequence, the service group sequence including at least one service group; obtain specific information of at least one service group based on the deployment information between the service instances and the machines to be maintained; and sort the machines to be maintained based on the sorting order of at least one service group in the service group sequence and in combination with the specific information to obtain a target sorting sequence of the machines to be maintained.

[0079] In this embodiment of the invention, the specific information may include at least one of the following options: service instance deployment information, maximum number of service instances, number of service instances and information on average number of service instances.

[0080] In this embodiment of the invention, the determining module 402 can also be used to: determine, according to the target sorting sequence, whether the number of service instances of at least one service deployed on the machines to be maintained exceeds the number of service instances that can be stopped for at least one service; if so, determine the next machine; if not, confirm the machine as the target machine and select the target machine from the machines to be maintained.

[0081] As can be seen from the above description, the device for determining target machines in this embodiment of the invention can generate a target sorting sequence of machines to be maintained by utilizing the number of service instances that can be shut down and the deployment information between the service instances and the machines to be maintained. Then, the target machines can be selected from the machines to be maintained by using the order of the target sorting sequence. Furthermore, this embodiment can dynamically adjust the number of service instances that can be shut down. After identifying the target machines, a new target sorting sequence is generated, and the new target sorting sequence can be analyzed until all target machines are extracted. Therefore, this embodiment of the invention can solve the problem of meeting service reliability requirements while providing an effective and efficient algorithm for screening target machines to be maintained. There is no need to spend manpower on service screening, scaling up and down, migration, and other operations. Moreover, each screening maximizes the number of target machines, significantly shortens the maintenance cycle, and thus reduces overall labor costs.

[0082] Figure 5 An exemplary system architecture 500 is shown, which can be applied to a method or apparatus for determining a target machine according to embodiments of the present invention.

[0083] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0084] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0085] Terminal devices 501, 502, and 503 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0086] Server 505 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 501, 502, and 503 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal device.

[0087] It should be noted that the method for determining the target machine provided in the embodiments of the present invention is generally executed by the server 505, and correspondingly, the device for determining the target machine is generally located in the server 505.

[0088] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0089] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing a terminal device of the present invention. Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0090] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0091] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0092] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.

[0093] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can 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. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0095] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including an acquisition module and a determination module. The names of these modules do not necessarily limit the module itself; for example, the acquisition module can also be described as "a module that acquires the number of service instances that can be stopped for at least one service based on service instances and service factors corresponding to at least one service."

[0096] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: step S101, obtaining the number of service instances that can be shut down for at least one service based on service instances and service factors corresponding to at least one service; step S102, generating a target sorting sequence for the machines to be maintained based on the number of service instances that can be shut down for at least one service and the deployment information between the service instances and the machines to be maintained; step S103, selecting target machines from the machines to be maintained according to the target sorting sequence, based on the number of service instances of at least one service deployed on the machines to be maintained and the number of service instances that can be shut down for at least one service; step S104, updating the machines to be maintained, the number of service instances that can be shut down for at least one service, and the deployment information between the service instances and the machines to be maintained, and repeating steps S102 to S104 until no target machines can be selected from the machines to be maintained.

[0097] According to the technical solution of the present invention, the number of service instances that can be stopped and the deployment information between the service instances and the machines to be maintained can be used to generate a target sorting sequence of machines to be maintained. Then, the target machines can be selected from the machines to be maintained by using the order of the target sorting sequence. Furthermore, this embodiment can dynamically adjust the number of service instances that can be stopped. After the target machines are identified, a new target sorting sequence is generated. The new target sorting sequence can be analyzed until all target machines are extracted. Therefore, the present invention can solve the problem of meeting service reliability requirements while providing an effective and efficient algorithm for screening target machines to be maintained. There is no need to spend manpower on service screening, scaling up and down, migration and other operations. Moreover, each screening maximizes the number of target machines, greatly shortens the maintenance cycle, and thus reduces the overall labor cost.

[0098] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for determining a target machine, characterized in that, include: Step S101: Based on the service instance and service factor corresponding to at least one service, obtain the number of service instances that can be stopped for at least one service. Step S102: Sort the at least one service in ascending order of the number of service instances that can be stopped, and merge services with the same number of service instances to obtain a service group sequence, the service group sequence including at least one service group; obtain specific information of the at least one service group based on the deployment information between the service instances and the machines to be maintained; sort the machines to be maintained according to the sorting order of the at least one service group in the service group sequence and in combination with the specific information to obtain a target sorting sequence of the machines to be maintained; Step S103: According to the target sorting sequence, select target machines from the machines to be maintained based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be stopped; the target machines are machines to be shut down for maintenance. Step S104: Update the number of stoppable service instances of the machine to be maintained and at least one service, and the deployment information between the service instances and the machine to be maintained. Repeat steps S102 to S104 until the target machine cannot be selected from the machines to be maintained.

2. The method according to claim 1, characterized in that, The specific information includes at least one of the following options: service instance deployment information, maximum number of service instances, number of service instances and information, and average number of service instances.

3. The method according to claim 1, characterized in that, The step of selecting target machines from the machines to be maintained according to the target sorting sequence, based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be shut down, includes: According to the target sorting sequence, determine in turn whether the number of service instances of at least one service deployed on the machine to be maintained exceeds the number of service instances that can be stopped for at least one service. If yes, then determine the next machine; if no, then confirm the machine as the target machine and select the target machine from the machines to be maintained.

4. A device for identifying a target machine, characterized in that, include: The acquisition module is used to execute step S101, which obtains the number of service instances that can be stopped for at least one service based on the service instance and service factor corresponding to at least one service. The determining module is used to execute steps S102 to S104, wherein, Step S102: Sort the at least one service in ascending order of the number of service instances that can be stopped, and merge services with the same number of service instances to obtain a service group sequence, the service group sequence including at least one service group; obtain specific information of the at least one service group based on the deployment information between the service instances and the machines to be maintained; sort the machines to be maintained according to the sorting order of the at least one service group in the service group sequence and in combination with the specific information to obtain a target sorting sequence of the machines to be maintained; Step S103: According to the target sorting sequence, select target machines from the machines to be maintained based on the number of service instances of at least one service deployed on the machine to be maintained and the number of service instances of at least one service that can be shut down; the target machines are machines to be shut down for maintenance. Step S104 updates the number of stoppable service instances of the machine to be maintained, the deployment information between the service instances and the machine to be maintained, and repeats steps S102 to S104 until the target machine cannot be selected from the machines to be maintained.

5. The apparatus according to claim 4, characterized in that, The specific information includes at least one of the following options: service instance deployment information, maximum number of service instances, number of service instances and information, and average number of service instances.

6. The apparatus according to claim 4, characterized in that, The determining module is also used for: According to the target sorting sequence, determine in turn whether the number of service instances of at least one service deployed on the machine to be maintained exceeds the number of service instances that can be stopped for at least one service. If yes, then determine the next machine; if no, then confirm the machine as the target machine and select the target machine from the machines to be maintained.

7. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-3.

8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Memory database instance management method and device

    CN106021370A