Method for determining service startup sequence, electronic device, and storage medium

By constructing a directed acyclic graph and ant colony algorithm to optimize the service startup sequence, the problem of low server startup efficiency caused by static methods is solved, dynamic optimization and efficient resource utilization are achieved, and server startup efficiency and user experience are improved.

CN120469737BActive Publication Date: 2025-09-12INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510971865.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-09-12
Estimated Expiration
2045-07-15

AI Technical Summary

Technical Problem

The existing service startup sequence is determined by a predefined static method, which leads to low server startup efficiency and lengthy startup time. Especially when resource-intensive services are started in parallel, there is a lack of effective mechanisms to avoid resource competition and conflicts.

Method used

By constructing a directed acyclic graph and using the ant colony algorithm for dynamic optimization, we simulate ants exploring the optimal path, dynamically adjust pheromone weights, and optimize the service startup sequence to ensure that the startup time is reduced while satisfying dependencies.

Benefits of technology

It achieves dynamic optimization of the service startup sequence, significantly shortens the startup time, improves resource utilization, enhances server startup efficiency and user experience, and is particularly suitable for scenarios with fierce resource competition or frequent hardware configuration changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120469737B_ABST
    Figure CN120469737B_ABST
Patent Text Reader

Abstract

The present application discloses a method for determining a service startup sequence, an electronic device, and a storage medium, and relates to the field of servers. The method includes: constructing a directed acyclic graph based on the dependency relationship between services and / or processes in the server; based on an ant colony algorithm, having M ants perform N iterative operations based on the directed acyclic graph to obtain a target service startup sequence, wherein the i-th iterative operation of the N iterative operations includes: based on an ant colony algorithm, having each of the M ants construct a service startup sequence based on the directed acyclic graph, and determining the total server startup duration corresponding to the constructed service startup sequence; the target service startup sequence is the service startup sequence with the shortest total server startup duration among the service startup sequences constructed by each ant in the N iterative operations. The above solution solves the problem that the existing service startup sequence is determined by a predefined static method, resulting in low server startup efficiency and lengthy startup time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of servers, and in particular to a method for determining a service startup sequence, an electronic device, and a storage medium. Background Art

[0002] With the growing number of server applications, rapidly starting operating systems and services is crucial for improving data center efficiency. Traditional service startup strategies rely primarily on predefined sequences or scripts. While these strategies maintain inter-service dependencies, they fail to effectively optimize startup time. This is especially true when resource-intensive services are started in parallel, as they lack effective mechanisms to avoid resource contention and conflicts. As the number and complexity of servers increase, the startup delays caused by this static approach have severely impacted rapid business deployment and user experience.

[0003] In the related art, the existing service startup sequence is determined by a predefined static method, which leads to the problem of low server startup efficiency and lengthy startup time. Currently, no effective solution has been proposed. Summary of the Invention

[0004] The present application provides a method for determining a service startup sequence, a storage cluster system, an electronic device, and a storage medium, to at least solve the problem that the existing service startup sequence is determined by a predefined static method, resulting in low server startup efficiency and lengthy startup time.

[0005] The present application provides a method for determining a service startup sequence, comprising: constructing a directed acyclic graph based on dependency relationships between services and / or processes in a server, wherein each node in the directed acyclic graph is a service or process in the server, and directed edges in the directed acyclic graph are used to represent dependency relationships between nodes; based on an ant colony algorithm, M ants perform N iterative operations based on the directed acyclic graph to obtain a target service startup sequence, wherein the i-th iterative operation of the N iterative operations comprises: based on the ant colony algorithm, each of the M ants constructs a service startup sequence based on the directed acyclic graph, and determines the total server startup duration corresponding to the constructed service startup sequence; after each iterative operation is executed, the pheromone weight value of each node in the directed acyclic graph is updated, the target service startup sequence is the service startup sequence with the shortest total server startup duration among the service startup sequences constructed by each ant in the N iterative operations, the service startup sequence is used to indicate the startup order of services or processes in the server, M and N are both positive integers, and i is a positive integer not greater than N.

[0006] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned methods for determining a service startup sequence when executing the computer program.

[0007] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for determining a service startup sequence are implemented.

[0008] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned methods for determining a service startup sequence when the computer program is executed by a processor.

[0009] This application proposes a method for dynamically determining a service startup sequence, which intuitively displays the dependency relationship between services or processes by constructing a directed acyclic graph, and then introduces the dynamic optimization of the ant colony algorithm. M "ants" perform N rounds of iterations on the directed acyclic graph, simulating the behavior of ants exploring the optimal path in nature. In each round of iteration, the ants construct a service startup sequence based on the pheromone weight and calculate the total startup time. After the iteration is completed, the pheromone weight is updated to reflect the historical preference of service selection, guiding subsequent iterations to be more inclined to choose a path with a shorter total startup time. Through the above method, the shackles of static pre-definition are broken, and the dynamic optimization of the service startup sequence is realized, ensuring that while satisfying the dependency relationship, the startup time is reduced as much as possible, thereby improving the server startup efficiency. It solves the problem that the existing service startup sequence is determined by a predefined static method, resulting in low server startup efficiency and lengthy startup time. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0011] Figure 1 This is a hardware structure block diagram of a method for determining a service startup sequence according to an embodiment of the present application;

[0012] Figure 2 is a flow chart of a method for determining a service startup sequence according to an embodiment of the present application;

[0013] Figure 3 is a schematic diagram of a directed acyclic graph according to an embodiment of the present application;

[0014] Figure 4 This is an overall flow chart of a method for determining a service startup sequence according to an embodiment of the present application;

[0015] Figure 5 This is a flow chart of an ant path construction sub-process according to an embodiment of the present application;

[0016] Figure 6 This is a flow chart of a sub-process for updating pheromone weight values ​​according to an embodiment of the present application;

[0017] Figure 7 is a flow chart of a process for dynamically adjusting parameters according to an embodiment of the present application;

[0018] Figure 8 This is a structural block diagram of a device for determining a service startup sequence according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0020] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0021] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0022] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the service startup sequence determination method depends, the specific application environment architecture or specific hardware architecture is described herein.

[0023] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure diagram of a method for determining a service startup sequence according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. The server device may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0024] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the startup method of the operating system in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the server device via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0025] Transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a communication provider of the server device. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0026] In order to solve the above problem, a method for determining a service startup sequence is provided in this embodiment. Figure 2 is a flow chart of a method for determining a service startup sequence according to an embodiment of the present application, including but not limited to being applied to simulation software, such as Figure 2 As shown, the method includes the following steps S202-S204:

[0027] Step S202: constructing a directed acyclic graph based on the dependency relationships between services and / or processes in the server, wherein each node in the directed acyclic graph is a service or process in the server, and directed edges in the directed acyclic graph are used to represent the dependency relationships between nodes;

[0028] It should be noted that if service A must be started before service B, in the directed acyclic graph, an edge A->B is added. For example, Figure 3 It shows a directed acyclic graph.

[0029] It should be noted that each node in a directed acyclic graph is assigned a startup time t, and edges are unweighted (they only indicate dependency order). Each node has a pheromone weight and a heuristic weight. The initial pheromone weight is predefined, while the heuristic weight is determined based on the node's assigned startup time t. For example, the heuristic weight of the jth node is ηj = 1 / tj.

[0030] It's important to note that the pheromone weight is a dynamic parameter used in the ant colony algorithm to measure the likelihood of node j being selected. It reflects the frequency and effectiveness of service j as part of the startup sequence in past optimization iterations and serves as an important basis for the algorithm to remember historical optimal paths and guide future search directions.

[0031] Step S204: Based on the ant colony algorithm, M ants perform N iterative operations according to the directed acyclic graph to obtain a target service startup sequence, wherein the i-th iterative operation of the N iterative operations includes: based on the ant colony algorithm, each of the M ants constructs a service startup sequence according to the directed acyclic graph, and determines the total server startup time corresponding to the constructed service startup sequence; after each iterative operation is executed, the pheromone weight value of each node in the directed acyclic graph is updated, and the target service startup sequence is the service startup sequence with the smallest total server startup time among the service startup sequences constructed by each ant in the N iterative operations. The service startup sequence is used to indicate the startup order of services or processes in the server, M and N are both positive integers, and i is a positive integer not greater than N.

[0032] It's important to note that in each iteration (denoted as the i-th, where i is a positive integer and i ≤ N), each ant independently explores a service startup path from the source node to all visited nodes. This path represents a potential startup sequence. When exploring this path, the ant not only considers the dependencies between services but also comprehensively evaluates the startup time of each service to construct a sequence that is most likely to shorten the total server startup time.

[0033] Optionally, after constructing a path, the ants adjust the pheromone weights of the corresponding nodes based on the total service startup time along that path. These optimized weights guide future ants in making choices that are more conducive to shortening the total startup time. After N iterations, this dynamic adjustment mechanism encourages the ant colony to continuously learn and improve, ultimately achieving the target service startup sequence that minimizes the total server startup time among all explored attempts. This effectively addresses the inefficiency caused by traditional predefined startup sequences.

[0034] The above steps propose a method for dynamically determining the service startup sequence. By constructing a directed acyclic graph to intuitively display the dependency relationships between services or processes, the dynamic optimization of the ant colony algorithm is introduced. M "ants" perform N rounds of iterations on the directed acyclic graph, simulating the behavior of ants in nature in exploring the optimal path. In each round of iteration, the ants construct the service startup sequence based on the pheromone weights and calculate the total startup time. After the iteration is completed, the pheromone weights are updated to reflect the historical preferences of service selection, guiding subsequent iterations to be more inclined to choose paths with shorter total startup times. Through the above method, the shackles of static pre-definition are broken, and dynamic optimization of the service startup sequence is achieved, ensuring that the startup time is minimized as much as possible while satisfying the dependency relationships, thereby improving server startup efficiency. This solves the problem that the existing service startup sequence is determined by a predefined static method, resulting in low server startup efficiency and lengthy startup time.

[0035] It should be noted that the present application is particularly suitable for scenarios where resource competition is fierce or hardware configuration changes frequently. It can effectively shorten the startup process, improve resource utilization, and solve the problems of fixed startup sequence and low efficiency in the prior art.

[0036] In an exemplary embodiment, based on an ant colony algorithm, M ants perform N iterative operations according to a directed acyclic graph to obtain a target service startup sequence, including: looping through the following steps S11-S13 until the loop is exited when i equals N+1, and determining the reference service startup sequence at the time of exiting the loop as the target service startup sequence, wherein, when the following operations are started, the reference service startup sequence is empty, the total startup time of the reference server is infinite, and i equals 1:

[0037] Step S11: Based on the ant colony algorithm, each of the M ants constructs a service startup sequence according to the target parameter set and the directed acyclic graph, thereby obtaining M service startup sequences and the corresponding total startup time of the M servers, wherein the target parameter set includes: a first weight coefficient corresponding to the pheromone weight value of the node, a second weight coefficient corresponding to the heuristic weight value of the node, and parallelism; the parallelism is used to indicate the maximum number of services or processes allowed to be started in parallel each time; the heuristic weight value of the node is determined according to the startup time of the service or process corresponding to the node;

[0038] Step S12: If the minimum server startup total duration among the M server startup total durations is less than the reference server startup total duration, the reference server startup total duration is updated to the minimum server startup total duration, and the reference service startup sequence is updated to the service startup sequence corresponding to the minimum server startup total duration;

[0039] It's important to note that after the current iteration, the algorithm analyzes all service startup sequences constructed by the M ants and their corresponding total server startup durations, selecting the service startup sequence with the shortest total startup duration. If the total startup duration of this sequence is less than the currently recorded reference startup duration (initialized to infinity), the reference startup duration is updated to the minimum total startup duration found, and the reference service startup sequence is updated to this optimal sequence. In this way, as the number of iterations increases, the optimal service startup sequence found becomes the global optimal solution.

[0040] Step S13: Update the pheromone weight value of each node in the directed acyclic graph and update the target parameter set; update i to i+1.

[0041] Optionally, after each iteration, the algorithm updates the pheromone weights of each node in the directed acyclic graph. This update is based on the effectiveness of the paths constructed by the ants in the current iteration. Specifically, shorter server startup times result in larger increases in the corresponding pheromone weights, thereby adjusting future ant selection preferences and promoting the exploration of more optimal paths. Furthermore, the target parameter set is adjusted based on the algorithm's convergence state and system resource availability, ensuring a good balance between exploration and exploitation, adapting to dynamically changing environments, and optimizing parallel startup strategies.

[0042] It should be noted that by looping through steps S11 to S13, dynamic optimization of the service startup sequence is achieved, significantly reducing server startup time and improving resource utilization efficiency. The final target service startup sequence is the one with the shortest total startup time, while satisfying all service or process dependencies. This effectively addresses the inefficiency of traditional predefined startup sequences and enhances the intelligence level of server management and operation. This method is particularly suitable for large-scale data center environments, significantly improving the startup response speed of server clusters, reducing waiting times, and enhancing the overall stability and availability of the system.

[0043] In an exemplary embodiment, the above-mentioned ant colony algorithm-based method, wherein each of M ants constructs a service startup sequence according to a target parameter set and a directed acyclic graph, includes: the mth ant among the M ants constructs a corresponding service startup sequence according to the target parameter set and the directed acyclic graph through the following steps S21-S22, where m is 1, 2, ...M-1, M in sequence:

[0044] Step S21: Initialize the target sequence and target duration, where the target sequence is empty and the target duration is zero:

[0045] Step S22: cyclically execute the following steps S221-S222 until no node exists in the directed acyclic graph, and determine the target sequence at the end of the loop as the service startup sequence, and the target duration is the total server startup duration corresponding to the service startup sequence:

[0046] Step S221: selecting K nodes from the directed acyclic graph according to the pheromone weight value of each node in the directed acyclic graph, the first weight coefficient, the heuristic weight value of each node, and the second weight coefficient, adding the K nodes to the target sequence, and deleting the K nodes from the directed acyclic graph, where K is the degree of parallelism and the K nodes meet the dependency condition;

[0047] It should be noted that the K nodes satisfying the dependency condition include: when selecting a node, the node has no directly preceding dependent services that are not started.

[0048] It should be noted that these nodes are added to the target sequence and removed from the directed acyclic graph to ensure that they are not repeatedly selected in subsequent iterations.

[0049] Step S222: Determine the parallel startup durations of the services or processes corresponding to the K nodes, and update the target duration using the sum of the parallel startup duration and the target duration.

[0050] It should be noted that the parallel startup duration of the services or processes corresponding to the K nodes is the duration of the service with the longest startup time among the K nodes.

[0051] It should be noted that in this embodiment, the server system supports parallel startup, but is limited by resources (such as the number of CPU cores K). A maximum of K services can be started simultaneously in each batch. The total server time is the accumulation of the startup time of each batch, where the time of each batch is the maximum value of the service startup time in the batch.

[0052] It should be noted that this application significantly improves the server startup efficiency by starting services in parallel, especially in situations where multiple service dependencies and resource competition are complex. It can flexibly balance resource allocation and reduce the total startup time, thereby greatly improving the server's response speed and user experience.

[0053] In an exemplary embodiment, the above step S221 can be implemented by looping through the following steps S31-S32 until K nodes are selected:

[0054] Step S31: determining a set of candidate nodes in a directed acyclic graph, wherein no edge in the directed acyclic graph points to a node in the set of candidate nodes;

[0055] It's important to note that step S31 determines which nodes are candidates for parallel startup in the current batch. This is accomplished by checking that no nodes in the directed acyclic graph have other edges pointing to them. This means that the services or processes on these nodes have no unmet dependencies and can be started immediately, thus forming a set of candidate nodes. This step ensures that the algorithm only considers services that can be started at any given time, avoiding inefficient computations.

[0056] Step S32: Determine the selection probability of each node in the candidate node set using the following formula 1; select a node with the highest selection probability from the candidate node set, add the node to the target sequence, and delete the node from the directed acyclic graph;

[0057] Formula 1;

[0058] in, is the selection probability of the jth node in the candidate node set, is the pheromone weight value of the jth node, is the heuristic weight value of the j-th node, is the first weight coefficient, is the second weight coefficient, is the candidate node set.

[0059] It's important to note that the first weighting factor controls the importance of historical experience. A larger α value results in a greater reliance on historically high-quality paths (exploitation bias). When α = 0, the algorithm completely ignores pheromones and relies solely on heuristic information. The second weighting factor controls the importance of prior knowledge. A larger β value results in a greater tendency for the algorithm to select services with shorter startup times (exploration bias). When β = 0, reliance solely on pheromones can lead to local optima.

[0060] In this embodiment, due to the adoption of a hybrid guidance strategy of pheromone weights and heuristic weights, the algorithm can intelligently find the path with the shortest startup time among many possible service startup sequences, and maintain high flexibility and efficiency even under complex dependencies and dynamically changing resource conditions.

[0061] In one exemplary embodiment, under the premise that dependencies are met, shortest-running services are prioritized to fill the current batch, for example, by selecting min(K, the number of remaining parallelizable services) with the shortest running times. It should be noted that the batch size (i.e., the number of selected services) is allowed to be ≤ K to avoid wasting resources.

[0062] It should be noted that, in order to better understand the above process, the following is an explanation of ant path construction: (1) Initialization: The ant starts from a set of all non-dependent services. (2) Batch selection: 1. Select up to K services in each step to ensure that their dependencies are satisfied. 2. Calculate the selection probability of each candidate service node using the above formula 1, and select the node with the highest selection probability from the candidate node set each time. 3. Record the batch startup time (the maximum startup time of this batch of services). 4. Update status: Mark the selected service as started, releasing the dependencies of its subsequent services. 5. Repeat until all services are started.

[0063] In an exemplary embodiment, updating the pheromone weight value of each node in the directed acyclic graph includes: updating the pheromone weight value of the j-th node in the directed acyclic graph using the following formula 2 to update the pheromone weight value of each node:

[0064] Formula 2;

[0065] in, is the pheromone weight value of the jth node, is the weighted volatilization rate of pheromone.

[0066] In an exemplary embodiment, after updating the pheromone weight value of the j-th node in the directed acyclic graph using Formula 2, the method further includes: looping and executing the following operations until exiting the loop when m equals M+1, wherein m equals 1 when the following operations are executed for the first time:

[0067] Use the following formula 3 to update the pheromone weight value of the j-th node in the directed acyclic graph, and after updating the pheromone weight value of each node, update the value of m to m+1:

[0068] Formula 3;

[0069] Where Q is a preset constant, and T is the total server startup time corresponding to the service startup sequence constructed by the mth ant.

[0070] It should be noted that in the ant colony algorithm, the dynamic update of pheromone weight values ​​is one of the core strategies. It imitates the behavior of ants in nature in finding the shortest path, and through continuous exploration and learning, it finds the optimal sequence for service startup. In the above description, the update of pheromone weights is divided into two parts:

[0071] 1. Volatility of pheromone weight value (Formula 2):

[0072] Pheromones naturally evaporate after each iteration, and the pheromone weight of each node is updated using Formula 2, where the pheromone weight volatility (ρ) determines the degree of pheromone retention. This mechanism simulates the gradual disappearance of pheromones over time in a natural environment, helping to prevent the algorithm from falling into local optimality and maintaining the diversity of the search process and global exploration capabilities.

[0073] 2. Incremental update of pheromone weight based on path quality (Formula 3):

[0074] After each ant m (m = 1 to M) completes the construction of the service startup sequence, it updates the pheromone weights of all nodes using Formula 3 based on the actual total server startup time T of the sequence and the preset constant Q. The denominator T in Formula 3 reflects the quality of the service startup sequence. The shorter the total startup time, the smaller the denominator value, and the greater the incremental pheromone update.

[0075] It should be noted that in this embodiment, the natural volatility of pheromone weight values ​​helps break the rigidity of path selection and prevents the algorithm from prematurely locking onto a service startup sequence that may not be globally optimal. By evaluating path quality (such as the total startup duration T), the pheromone weights on high-quality paths are enhanced, guiding subsequent ants to be more likely to choose these paths, thereby accelerating the algorithm's convergence to the optimal solution. With the combined effect of the above mechanisms, this application can intelligently identify and optimize the startup sequence between services, significantly shortening the overall server startup time while satisfying all dependencies, improving startup efficiency, reducing resource conflicts, and enhancing user experience and system stability.

[0076] In an exemplary embodiment, the updating of the target parameter set includes the following steps S41-S43:

[0077] Step S41: When i is less than or equal to the first preset threshold, the first weight coefficient and the second weight coefficient are updated using the following formula 4:

[0078] Formula 4;

[0079] in, is the first weight coefficient before updating, is the first weight coefficient after update, is the second weight coefficient before updating, is the updated second weight coefficient;

[0080] Step S42: When i is greater than the first preset threshold, the first weight coefficient and the second weight coefficient are updated using the following formula 5:

[0081] Formula 5;

[0082] It should be noted that, in the process of optimizing the service startup sequence using the ant colony algorithm, the above steps S41 and S42 are dedicated to dynamically adjusting the first weight coefficient (α) and the second weight coefficient (β) in the target parameter set to adapt to different stages of iteration and achieve an intelligent balance between exploration (finding new paths) and development (improving known paths) in the algorithm.

[0083] When the number of iterations, i, does not exceed the pre-set first threshold, the algorithm enters the exploration phase. During this phase, the weight coefficients are adjusted using Formula 4, where N is the total number of iterations. Formula 4 shows that in the early stages of iteration, the algorithm prioritizes heuristic information (such as service startup time), encouraging ants to explore different startup paths. This increases the breadth and diversity of the search, prevents premature regression into local optimal solutions, and increases the likelihood of finding the global optimal solution.

[0084] Once the number of iterations i exceeds a first preset threshold, the algorithm enters the development phase, where the weight coefficients are updated using Formula 5. Compared to step S41, in this phase, the α coefficient begins to increase, while the β coefficient decreases accordingly. This means that the algorithm begins to rely more heavily on pheromone concentration (i.e., records of past paths), encouraging ants to conduct deeper searches around already discovered potential optimal paths. This increases the depth of the search, speeds up the algorithm's convergence to the optimal solution, reduces unnecessary iterations, and significantly improves the efficiency of service startup sequence optimization.

[0085] It should be noted that by dynamically adjusting the first weight coefficient α and the second weight coefficient β, it is possible to encourage the exploration of more service startup paths in the early stage of the algorithm operation, and gradually shift to the optimization of existing paths in the later stage, achieving an intelligent balance between exploration and development.

[0086] Step S43: updating the degree of parallelism using the target number of cores and the current resource utilization of the server, wherein the target number of cores is the number of cores currently allowed to be used by the central processing unit of the server.

[0087] It should be noted that there is no particular order in which step S43 and steps S41 - S42 are performed.

[0088] In an exemplary embodiment, the above step S43 can be implemented in the following manner:

[0089] When the current resource utilization is greater than or equal to the preset utilization, a conservative strategy is used to update the parallelism, that is, parallelism = , when the current resource utilization is less than the preset utilization, an aggressive strategy is used to update the parallelism, that is, parallelism = ,in, is the target number of cores, and δ is the reserved resource buffer (e.g., δ=1).

[0090] It's important to note that step S43 is designed to dynamically adjust the degree of parallelism to adapt to the server's current central processing unit (CPU) resource utilization, ensuring efficient and secure service startup. Whether in the exploration or development phase, the algorithm determines the number of services to launch in parallel based on real-time resource utilization, demonstrating its flexible response to dynamic environments.

[0091] Specifically, when resources are tight (i.e., current resource utilization ≥ preset utilization), a conservative strategy is adopted, setting the degree of parallelism to the target number of cores minus the reserved resource buffer (e.g., δ = 1). This aims to avoid excessive server resource usage, ensuring stable system operation while moderately launching services in parallel, achieving a balance between resource utilization and service startup speed. Conversely, when resources are loose (i.e., current resource utilization < preset utilization), an aggressive strategy is adopted, directly setting the degree of parallelism to the target number of cores. This fully utilizes idle CPU cores, greatly accelerating the service startup process, significantly shortening overall startup time, and improving the user experience.

[0092] Through this mechanism, the present invention optimizes service startup while ensuring server stability and responsiveness. On the one hand, it intelligently adjusts parallelism based on real-time resource availability, avoiding startup delays and system instability caused by resource competition; on the other hand, it fully utilizes idle resources, significantly improving service startup efficiency.

[0093] In an exemplary embodiment, after updating the target parameter set, the method further includes: updating the pheromone weight volatility rate using the following methods 1 to 3, wherein the pheromone weight volatility rate is used when updating the pheromone weight value of each node in the directed acyclic graph:

[0094] Method 1: When the reference service startup sequence is not updated in L consecutive iterations, the pheromone weight volatility rate is updated using the following formula: ,in, is the weighted volatilization rate of pheromone, is the maximum value of the preset pheromone weighted volatility rate, is the preset adjustment step;

[0095] It should be noted that, in this embodiment, the first method is applicable to the case where no starting sequence better than the existing reference sequence is found during the L consecutive iterations. At this time, the algorithm may fall into a local optimum. In order to stimulate the enthusiasm of ants to explore new paths, the pheromone weight volatility rate is calculated by the formula Moderate increase. A higher pheromone volatilization rate causes the pheromone to dissipate faster, encouraging ants to explore untried starting paths and increasing the chances of the algorithm escaping the local optimal solution.

[0096] Method 2: When the reference service startup sequence has been updated in L consecutive iterations and the reference service startup sequence has been updated in the current iteration, the pheromone weight volatility rate is updated using the following formula: ,in, is the minimum value of the preset pheromone weighted volatilization rate;

[0097] It should be noted that, in this embodiment, in the process of L consecutive iterations, the current iteration finds a more optimal service start sequence, and the pheromone weight volatility rate is calculated by the formula A moderate reduction and a lower pheromone volatilization rate help to retain and strengthen the pheromones on these high-quality paths, guiding ants in subsequent iterations to be more likely to choose this path, and accelerating the algorithm's convergence to the global optimal solution.

[0098] Method 3: When the reference service startup sequence is updated in L consecutive iterations and the reference service startup sequence is not updated in the current iteration, the pheromone weight volatility rate is not updated.

[0099] It should be noted that in this embodiment, method three updates the reference sequence in the L consecutive iterations, but the current iteration is not further optimized and the pheromone weight volatility rate remains unchanged. In this case, the algorithm believes that the current path exploration and optimization strategy is reasonable and no additional adjustment is required.

[0100] It's important to note that the dynamic adjustment strategy described above intelligently balances the ant colony algorithm's exploration and exploitation, preventing the algorithm from prematurely stalling at suboptimal solutions and delaying convergence due to excessive exploration. This approach ensures algorithm flexibility and efficiency, significantly improving the optimization of service startup sequences, shortening server startup time, and reducing resource conflicts, thereby increasing system startup efficiency and stability.

[0101] In an exemplary embodiment, after updating the target parameter set, the method further includes the following steps S51-S54:

[0102] Step S51: Calculate the mean Hamming distance between the paths corresponding to the M service startup sequences according to the M service startup sequences, and calculate the variance between the total startup durations of the M servers;

[0103] It should be noted that the mean Hamming distance between the paths corresponding to the M service startup sequences can be calculated using the following formula, where Diversity is the mean Hamming distance:

[0104] ;

[0105] It should be noted that the Hamming distance between the paths corresponding to two service startup sequences is equal to the number of inconsistent services at the same location.

[0106] Step S52: When the mean Hamming distance is less than the second preset threshold, increase the value of M using the following formula: ,in, is the maximum number of ants, is the update step size;

[0107] It should be noted that when the mean Hamming distance is less than the second preset threshold, it means that the differences between service startup sequences are small and the search space is underexplored. In this case, it is necessary to increase the number of ants M to introduce more explorers, expand the search range, discover more potential startup sequences, and increase the probability of the algorithm finding a better solution.

[0108] Step S53: When the variance is less than the third preset threshold and the mean Hamming distance is greater than or equal to the second preset threshold, the value of M is reduced using the following formula: ,in, is the minimum number of ants;

[0109] It's important to note that if the variance of the total startup duration is less than the third preset threshold and the mean Hamming distance is greater than or equal to the second preset threshold, this indicates that the service startup time is highly consistent, but path diversity remains. This may indicate that the algorithm has discovered several high-quality startup sequences. In this case, reducing the number of ants M helps focus resources on optimizing these paths, accelerating the algorithm's convergence to the optimal solution.

[0110] Step S54: when the mean of the Hamming distance is greater than or equal to the second preset threshold and the variance is greater than or equal to the third preset threshold, the value of M is not updated.

[0111] It should be noted that when both the mean Hamming distance and the variance of the total startup duration are greater than or equal to their respective preset thresholds, the current search strategy is sufficiently diverse and startup time consistency is maintained. In this case, the algorithm chooses not to update the number of ants M and maintains the current configuration to ensure the stability and effectiveness of the search strategy.

[0112] It's important to note that steps S51 through S54 above describe a mechanism for dynamically adjusting the number of ants, M, to maintain diversity in the algorithm's search process and avoid premature convergence or insufficient exploration. By calculating the mean Hamming distance between service startup sequences and the variance of their total startup duration, the algorithm intelligently adjusts the value of M to ensure a comprehensive and efficient search.

[0113] In an exemplary embodiment, the method further includes: during the execution of the i-th iteration, when the server is restarted, obtaining the actual startup time of each service or process during the server restart process; and updating the heuristic weight value of each node according to the actual startup time of each service or process.

[0114] It should be noted that in this embodiment, during the i-th iteration of the ant colony algorithm, if an unexpected server restart occurs, the actual startup times of all services or processes during the restart process can be immediately collected. Subsequently, the heuristic weights of each node in the directed acyclic graph are adjusted based on the collected actual startup times. Adjusting the heuristic weights ensures that when selecting service startup paths, the ant colony algorithm prioritizes services with shorter startup times and lower resource consumption, thereby dynamically optimizing the service startup sequence while satisfying service dependencies.

[0115] In an exemplary embodiment, updating the heuristic weight value of each node in the directed acyclic graph according to the actual startup time of each service or process includes: updating the heuristic weight value of the j-th node in the directed acyclic graph by the following formula 6 to update the heuristic weight value of each node:

[0116] Formula 6;

[0117] is the heuristic weight value of the j-th node, is the preset smoothing factor, ∈[0,1], is the estimated startup time of the service or process corresponding to the jth node, is the actual startup time of the service or process corresponding to the j-th node.

[0118] It should be noted that, by combining the predicted startup time and the actual startup time, Formula 6 can dynamically adjust the heuristic weight of each node, ensuring that the algorithm makes decisions based on data closest to reality, thereby improving the prediction accuracy of the service startup sequence.

[0119] In an exemplary embodiment, the method further includes: during the execution of the i-th iteration, if there is a target node in the directed acyclic graph, updating the heuristic weight value of the target node using the following formula, where the target node is a node where the number of times the target phenomenon occurs is greater than a preset number, and the target phenomenon is the node with the slowest startup speed among the corresponding K nodes:

[0120] ;

[0121] in, is the heuristic weight value of the target node, is the pre-amplification coefficient, and C is the number of times the target phenomenon occurs.

[0122] It's important to note that during the algorithm iteration process, especially when it detects that certain service nodes frequently become bottlenecks in the batch startup process (i.e., the slowest startup service nodes), the heuristic weights of these target nodes are dynamically adjusted. This update strategy aims to lower the priority of the target node in future startup paths, incentivizing the algorithm to select service nodes with faster startup times, thereby avoiding critical nodes that may cause startup delays.

[0123] In an exemplary embodiment, the method further includes: when the simulation program (in which the method of the present application is executed) is interrupted or restarted, updating the pheromone weight value of each node in the directed acyclic graph by:

[0124] Determine the pheromone weight of each node in the directed acyclic graph corresponding to the last determined optimal path, and calculate the pheromone weight of each node in the new directed acyclic graph based on the following formula:

[0125] ;

[0126] in, is the pheromone weight value of the jth node in the directed acyclic graph corresponding to the last determined optimal path, is the corresponding updated pheromone weight value, is the preset initial pheromone weight value, μ is the retention coefficient, which can be 0.8.

[0127] It should be noted that in this embodiment, when the simulation program is interrupted or restarted, the subsequent solution process can be accelerated by memorizing and reusing the optimal path information found in the previous iteration. Specifically, the algorithm retains the pheromone weight value of each node in the previously determined optimal path. After the program is restarted, it mixes and updates the initial pheromone weight value of the current node based on the retention coefficient μ (set to 0.8, for example) to generate a new pheromone weight value. This avoids repeated calculations caused by simulation program interruptions or restarts, saving a significant amount of computing resources and time, ensuring that the algorithm does not lose previous optimization results, and maintaining the continuity and stability of the system optimization strategy.

[0128] In an exemplary embodiment, when the simulation program is interrupted or restarted, if the directed acyclic graph changes, that is, the service dependency is updated, the pheromone weight values ​​of the affected nodes are reset.

[0129] Obviously, the embodiments described above are only part of the embodiments of the present application, rather than all the embodiments. In order to better understand the above method, the above process is described below in conjunction with the embodiments, but it is not intended to limit the technical solutions of the embodiments of the present application. Specifically:

[0130] For better understanding, Figure 4 The overall flow chart of a method for determining a service startup sequence is shown. Figure 4 As shown, the main process of the method for determining the service startup sequence of this application is as follows:

[0131] Step S1001: Initialize the dependency graph (DAG) and algorithm parameters (α, β, ρ, Q, K, M).

[0132] Step S1002: Initialize pheromone (τj=τ0).

[0133] Step S1003: Set the initial value of the global optimal solution (best_sequence=[], best_time=∞).

[0134] Step S1004: Enter an iterative optimization loop (total number of iterations N), and execute step S1005.

[0135] Step S1005: Process the current iteration, traverse all ants (a total of M ants), and perform path construction for each ant (call the ant path construction sub-process).

[0136] Step S1006: Update the global optimal solution. If the total time generated by the current iteration is better, overwrite the original optimal solution (best_sequence, best_time).

[0137] Step S1007: Perform pheromone evaporation and incremental update (invoke the pheromone update sub - process).

[0138] Step S1008: Dynamically adjust parameters (evaporation rate ρ, heuristic weights α / β, parallelism K) (invoke the dynamic parameter adjustment process).

[0139] Step S1009: Determine whether the maximum number of iterations N is reached. If not, return to Step S1004 to continue the iteration; if so, execute Step S1010.

[0140] Step S1010: Output the optimal service start sequence (best_sequence) and the total time (best_time).

[0141] It should be noted that Figure 5 The flowchart of the ant path construction sub - process is shown. In combination with Figure 5, the ant path construction sub - process of the present application is described. Specifically, it includes:

[0142] Step S2001: Start the ant path construction process.

[0143] Step S2002: Initialize the sequence (sequence = []) and the batch time set (batches = []).

[0144] Step S2003: Obtain the current list of services that can be started (current_services), and determine whether there are unstarted services. If so, execute Step S2004; if not, execute Step S2007.

[0145] Step S2004: Select at most K services with probability (based on the pheromone weight value and the heuristic weight value).

[0146] Step S2005: Calculate the batch time for this batch (batch_time = max(start times of the selected services)).

[0147] Step S2006: Record the batch time (batches.append(batch_time)), mark the selected services as started, and update the dependency relationship.

[0148] Step S2007: Calculate the total time (total_time = sum(batches)).

[0149] Step S2008: Determine whether the total time is better than the global optimal time (total_time < best_time?). If so, execute Step S2009; if not, execute Step S2010.

[0150] Step S2009: Update the global optimal solution (best_sequence, best_time = current path).

[0151] Step S2010: End the current ant's path construction process.

[0152] It should be noted that Figure 6 The schematic diagram of the process of updating the pheromone weight value is shown, combined with the following Figure 6 The sub-process for updating the pheromone weight value of this application is described, specifically including:

[0153] Step S3001: Start the pheromone weight value update process.

[0154] Step S3002: Initialize the volatilization cycle variable (j=0).

[0155] Step S3003: Determine whether the current node index j is less than the total number of services. If yes, execute step S3004; if not, execute step S3005.

[0156] Step S3004: perform a pheromone weight value volatilization operation on node j (τj=(1-ρ)*τj), increment j by 1, and return to step S3003.

[0157] Step S3005: Initialize the ant loop variable (m=0).

[0158] Step S3006: Determine whether the current ant index m is less than the total number of ants. If yes, execute step S3007; if not, execute step S3011.

[0159] Step S3007: Initialize the path loop variable (k=0).

[0160] Step S3008: Determine whether the current path node index k is less than the path length (ie, the total number of services). If yes, execute step S3009; if not, execute step S3010.

[0161] Step S3009: perform incremental update of the pheromone weight value of node k in the path (τk+=Q / total time), increase k by 1, and return to step S3008.

[0162] Step S3010: Increment the ant index m by 1 and return to step S3006.

[0163] Step S3011: End the pheromone weight value update process.

[0164] It should be noted that Figure 7 The flow chart of the dynamic parameter adjustment process is shown in Figure 2. Figure 7 The dynamic parameter adjustment process of this application is described, specifically including:

[0165] Step S4001: Enter the dynamic parameter adjustment process.

[0166] Step S4002: Determine whether the global optimal solution has not been optimized for L consecutive times. If yes, execute step S4003; if not, execute step S4004.

[0167] Step S4003: Increase the volatility, such as , then execute step S4006.

[0168] Step S4004: Determine whether a new optimal solution is found in the current iteration. If yes, execute step S4005; if not, execute step S4006.

[0169] Step S4005: Reduce the volatility, as shown in formula , then execute step S4006.

[0170] Step S4006: Adjust the heuristic weight (α / β) according to the iteration stage. If it is an early iteration, increase the β weight, as shown in Formula 4; if it is a late iteration, increase the α weight, as shown in Formula 5.

[0171] Step S4007: Monitor system resources (such as the number of CPU cores) and dynamically adjust the parallelism K value.

[0172] Step S4008: Exit the dynamic adjustment process and return to the main loop.

[0173] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0174] The embodiment of the present application also provides a device for determining a service startup sequence. Figure 8 This is a structural block diagram of a device for determining a service startup sequence according to an embodiment of the present application. Figure 8 As shown, the device includes:

[0175] A construction module 802 is configured to construct a directed acyclic graph based on dependency relationships between services and / or processes in the server, wherein each node in the directed acyclic graph is a service or process in the server, and directed edges in the directed acyclic graph are used to represent dependency relationships between nodes;

[0176] The determination module 804 is used to obtain a target service startup sequence by performing N iterative operations according to a directed acyclic graph by M ants based on an ant colony algorithm, wherein the i-th iterative operation of the N iterative operations includes: constructing a service startup sequence according to the directed acyclic graph by each of the M ants based on the ant colony algorithm, and determining the total server startup time corresponding to the constructed service startup sequence; after each iterative operation is executed, the pheromone weight value of each node in the directed acyclic graph is updated, and the target service startup sequence is the service startup sequence with the shortest total server startup time among the service startup sequences constructed by each ant in the N iterative operations. The service startup sequence is used to indicate the startup order of services or processes in the server, M and N are both positive integers, and i is a positive integer not greater than N.

[0177] The above-mentioned device proposes a method for dynamically determining the service startup sequence. By constructing a directed acyclic graph to intuitively display the dependency relationship between services or processes, it then introduces the dynamic optimization of the ant colony algorithm. M "ants" perform N rounds of iterations on the directed acyclic graph, simulating the behavior of ants in nature exploring the optimal path. In each round of iteration, the ants construct the service startup sequence based on the pheromone weight and calculate the total startup time. After the iteration is completed, the pheromone weight is updated to reflect the historical preference of service selection, guiding subsequent iterations to be more inclined to choose the path with the shorter total startup time. Through the above-mentioned method, the shackles of static pre-definition are broken, and the dynamic optimization of the service startup sequence is realized, ensuring that the startup time is reduced as much as possible while satisfying the dependency relationship, thereby improving the server startup efficiency. It solves the problem that the existing service startup sequence is determined by a predefined static method, resulting in low server startup efficiency and lengthy startup time.

[0178] In an exemplary embodiment, the determination module 804 is further configured to loop through the following operations until the loop is exited when i is equal to N+1, and determine the reference service startup sequence when the loop is exited as the target service startup sequence, wherein, when the following operations are started, the reference service startup sequence is empty, the reference server startup total duration is infinite, and i is equal to 1: Based on the ant colony algorithm, each of the M ants constructs a service startup sequence according to the target parameter set and the directed acyclic graph, and obtains M service startup sequences and corresponding M server startup total durations, wherein the target parameter set includes: a first weight coefficient corresponding to the pheromone weight value of the node , the second weight coefficient corresponding to the heuristic weight value of the node, parallelism; parallelism is used to indicate the maximum number of services or processes allowed to be started in parallel each time; the heuristic weight value of the node is determined according to the startup time of the service or process corresponding to the node; when the minimum server startup total time among the M server startup total times is less than the reference server startup total time, the reference server startup total time is updated to the minimum server startup total time, and the reference service startup sequence is updated to the service startup sequence corresponding to the minimum server startup total time; update the pheromone weight value of each node in the directed acyclic graph, and update the target parameter set; update i to i+1.

[0179] In an exemplary embodiment, the determination module 804 is also used to construct a corresponding service startup sequence according to the target parameter set and the directed acyclic graph through the mth ant among M ants in the following manner, where m is 1, 2,...M-1, M in sequence: initialize the target sequence and target duration, where the target sequence is empty and the target duration is zero: loop the following operations until there are no nodes in the directed acyclic graph, and determine the target sequence at the end of the loop as the service startup sequence, and the target duration is the total server startup duration corresponding to the service startup sequence: select K nodes from the directed acyclic graph according to the pheromone weight value, first weight coefficient, heuristic weight value and second weight coefficient of each node in the directed acyclic graph, add the K nodes to the target sequence, and delete the K nodes from the directed acyclic graph, where K is the parallelism and the K nodes meet the dependency conditions; determine the parallel startup duration of the services or processes corresponding to the K nodes, and update the target duration using the sum of the parallel startup duration and the target duration.

[0180] In an exemplary embodiment, the determination module 804 is further configured to loop through the following operations until K nodes are selected: determining a set of candidate nodes in a directed acyclic graph, wherein no edge in the directed acyclic graph points to a node in the candidate node set; determining a selection probability of each node in the candidate node set using the following formula; selecting a node with the highest selection probability from the candidate node set, adding the node to the target sequence, and deleting the node from the directed acyclic graph;

[0181] ;

[0182] in, is the selection probability of the jth node in the candidate node set, is the pheromone weight value of the jth node, is the heuristic weight value of the j-th node, is the first weight coefficient, is the second weight coefficient, is the candidate node set.

[0183] In an exemplary embodiment, the determination module 804 is further configured to update the pheromone weight value of the j-th node in the directed acyclic graph using the following formula to update the pheromone weight value of each node:

[0184] ;

[0185] in, is the pheromone weight value of the jth node, is the weighted volatilization rate of pheromone.

[0186] In an exemplary embodiment, the determination module is further configured to, after updating the pheromone weight value of the j-th node in the directed acyclic graph using the following formula, loop through the following operations until exiting the loop when m is equal to M+1, wherein m is equal to 1 when the following operations are performed for the first time: update the pheromone weight value of the j-th node in the directed acyclic graph using the following formula, and after updating the pheromone weight value of each node, update the value of m to m+1:

[0187] ;

[0188] Where Q is a preset constant, and T is the total server startup time corresponding to the service startup sequence constructed by the mth ant.

[0189] In an exemplary embodiment, the determination module 804 is further configured to update the first weight coefficient and the second weight coefficient using the following formula when i is less than or equal to a first preset threshold:

[0190] ;

[0191] in, is the first weight coefficient before updating, is the first weight coefficient after update, is the second weight coefficient before updating, is the updated second weight coefficient;

[0192] When i is greater than the first preset threshold, the first weight coefficient and the second weight coefficient are updated using the following formula:

[0193] ;

[0194] The parallelism is updated using the target number of cores and the current resource utilization of the server, where the target number of cores is the number of cores currently allowed to be used by the central processing unit of the server.

[0195] In an exemplary embodiment, the determination module 804 is further configured to update the pheromone weight volatility rate in the following manner after updating the target parameter set, wherein the pheromone weight volatility rate is used when updating the pheromone weight value of each node in the directed acyclic graph: if the reference service startup sequence is not updated in L consecutive iterations, the pheromone weight volatility rate is updated using the following formula: ,in, is the weighted volatilization rate of pheromone, is the maximum value of the preset pheromone weighted volatility rate, is the preset adjustment step size; when the reference service startup sequence is updated in L consecutive iterations and the reference service startup sequence is updated in the current iteration, the pheromone weight volatility rate is updated using the following formula: ,in, is the minimum value of the preset pheromone weight volatility rate; if the reference service startup sequence is updated in L consecutive iterations and the reference service startup sequence is not updated in the current iteration, the pheromone weight volatility rate is not updated.

[0196] In an exemplary embodiment, the determination module 804 is further configured to, after updating the target parameter set, calculate, based on the M service startup sequences, the mean Hamming distances between the paths corresponding to the M service startup sequences, and calculate the variances between the total startup times of the M servers; if the mean Hamming distance is less than a second preset threshold, increase the value of M using the following formula: ,in, is the maximum number of ants, is the update step size; when the variance is less than the third preset threshold and the mean Hamming distance is greater than or equal to the second preset threshold, the value of M is reduced using the following formula: ,in, is the minimum number of ants; when the mean of the Hamming distance is greater than or equal to the second preset threshold and the variance is greater than or equal to the third preset threshold, the value of M is not updated.

[0197] In an exemplary embodiment, the determination module 804 is also used to obtain the actual startup time of each service or process during the server restart process when the server is restarted during the execution of the i-th iteration; and update the heuristic weight value of each node according to the actual startup time of each service or process.

[0198] In an exemplary embodiment, the determination module 804 is further configured to update the heuristic weight value of the j-th node in the directed acyclic graph by using the following formula to update the heuristic weight value of each node:

[0199] ;

[0200] is the heuristic weight value of the j-th node, is the preset smoothing factor, ∈[0,1], is the estimated startup time of the service or process corresponding to the jth node, is the actual startup time of the service or process corresponding to the j-th node.

[0201] In an exemplary embodiment, the determination module 804 is further configured to, during the i-th iteration, if a target node exists in the directed acyclic graph, update the heuristic weight value of the target node using the following formula, where the target node is a node where the target phenomenon occurs more than a preset number of times, and the target phenomenon is the node with the slowest startup speed among the corresponding K nodes:

[0202] ;

[0203] in, is the heuristic weight value of the target node, is the pre-amplification coefficient, and C is the number of times the target phenomenon occurs.

[0204] For the description of the features in the embodiment corresponding to the device for determining a service startup sequence, reference can be made to the relevant description of the embodiment corresponding to the method for determining a service startup sequence, which will not be repeated here.

[0205] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned service startup sequence determination method embodiments.

[0206] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned service startup sequence determination method embodiments when running.

[0207] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0208] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned service startup sequence determination method embodiments are implemented.

[0209] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned service startup sequence determination method embodiments.

[0210] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0211] The above is a detailed introduction to the method and device for determining a service startup sequence, electronic device, storage medium, and computer program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A method for determining a service startup sequence, characterized in that: include: Constructing a directed acyclic graph based on dependency relationships between services and / or processes in the server, wherein each node in the directed acyclic graph is a service or process in the server, and directed edges in the directed acyclic graph are used to represent dependency relationships between nodes; Based on an ant colony algorithm, M ants perform N iterative operations according to the directed acyclic graph to obtain a target service startup sequence, wherein the i-th iterative operation of the N iterative operations includes: based on the ant colony algorithm, each of the M ants constructs a service startup sequence according to the directed acyclic graph, and determines the total server startup time corresponding to the constructed service startup sequence; after each iterative operation is performed, the pheromone weight value of each node in the directed acyclic graph is updated, and the target service startup sequence is a service startup sequence with the shortest total server startup time among the service startup sequences constructed by each ant in the N iterative operations, and the service startup sequence is used to indicate the startup order of services or processes in the server, M and N are both positive integers, and i is a positive integer not greater than N; Wherein, based on the ant colony algorithm, M ants perform N iterative operations according to the directed acyclic graph to obtain a target service startup sequence, including: The following operations are performed in a loop until the loop is exited when i equals N+1, and the reference service startup sequence at the time of exiting the loop is determined as the target service startup sequence. When the following operations are started, the reference service startup sequence is empty, the total startup time of the reference server is infinite, and i equals 1: Based on an ant colony algorithm, each of the M ants constructs a service startup sequence according to a target parameter set and the directed acyclic graph, thereby obtaining M service startup sequences and corresponding total startup times of the M servers, wherein the target parameter set includes: a first weight coefficient corresponding to a pheromone weight value of a node, a second weight coefficient corresponding to a heuristic weight value of the node, and a degree of parallelism; the degree of parallelism is used to indicate the maximum number of services or processes allowed to be started in parallel each time; the heuristic weight value of a node is determined according to the startup time of the service or process corresponding to the node; If the minimum server startup total duration among the M server startup total durations is less than the reference server startup total duration, updating the reference server startup total duration to the minimum server startup total duration, and updating the reference service startup sequence to the service startup sequence corresponding to the minimum server startup total duration; Update the pheromone weight value of each node in the directed acyclic graph and update the target parameter set; update i to i+1; Wherein, updating the target parameter set includes: When i is less than or equal to a first preset threshold, the first weight coefficient and the second weight coefficient are updated using the following formula: ; in, is the first weight coefficient before updating, is the first weight coefficient after update, is the second weight coefficient before updating, is the updated second weight coefficient; When i is greater than the first preset threshold, the first weight coefficient and the second weight coefficient are updated using the following formula: ; The degree of parallelism is updated using a target number of cores and a current resource utilization rate of the server, wherein the target number of cores is the number of cores currently allowed to be used by a central processing unit of the server.

2. The method for determining a service startup sequence according to claim 1, wherein: Based on the ant colony algorithm, each of the M ants constructs a service startup sequence according to the target parameter set and the directed acyclic graph, including: The mth ant among the M ants constructs a corresponding service startup sequence according to the target parameter set and the directed acyclic graph in the following manner, where m is 1, 2, ..., M-1, M in sequence: Initialize the target sequence and target duration, where the target sequence is empty and the target duration is zero: The following operations are performed in a loop until no nodes exist in the directed acyclic graph, and the target sequence at the end of the loop is determined to be the service startup sequence, and the target duration is the total server startup duration corresponding to the service startup sequence: Selecting K nodes from the directed acyclic graph according to the pheromone weight value of each node in the directed acyclic graph, the first weight coefficient, the heuristic weight value of each node, and the second weight coefficient, adding the K nodes to the target sequence, and deleting the K nodes from the directed acyclic graph, wherein K is the parallelism and the K nodes meet the dependency condition; The parallel startup durations of the services or processes corresponding to the K nodes are determined, and the target duration is updated using the sum of the parallel startup duration and the target duration.

3. The method for determining a service startup sequence according to claim 2, wherein: Selecting K nodes from the directed acyclic graph according to the pheromone weight value of each node in the directed acyclic graph, the first weight coefficient, the heuristic weight value of each node, and the second weight coefficient, adding the K nodes to the target sequence, and deleting the K nodes from the directed acyclic graph, including: Loop through the following steps until K nodes are selected: Determining a set of candidate nodes in the directed acyclic graph, wherein no edge in the directed acyclic graph points to a node in the set of candidate nodes; Determine the selection probability of each node in the candidate node set by the following formula; select a node with the highest selection probability from the candidate node set, add the node to the target sequence, and delete the node from the directed acyclic graph; ; in, is the selection probability of the jth node in the candidate node set, is the pheromone weight value of the j-th node, is the heuristic weight value of the j-th node, is the first weight coefficient, is the second weight coefficient, is the candidate node set.

4. The method for determining a service startup sequence according to claim 1, wherein: Updating the pheromone weight value of each node in the directed acyclic graph includes: The pheromone weight value of the jth node in the directed acyclic graph is updated using the following formula to update the pheromone weight value of each node: ; in, is the pheromone weight value of the j-th node, is the weighted volatilization rate of pheromone.

5. The method for determining a service startup sequence according to claim 4, wherein: After updating the pheromone weight value of the j-th node in the directed acyclic graph, the method further includes: The loop performs the following operations until m equals M+1 and exits the loop, where m equals 1 during the first execution of the following operations: The pheromone weight value of the j-th node in the directed acyclic graph is updated using the following formula, and after updating the pheromone weight value of each node, the value of m is updated to m+1: ; Where Q is a preset constant, and T is the total server startup time corresponding to the service startup sequence constructed by the mth ant.

6. The method for determining a service startup sequence according to claim 1, wherein: After updating the target parameter set, the method further includes: The pheromone weight volatility is updated in the following manner, wherein the pheromone weight volatility is used when updating the pheromone weight value of each node in the directed acyclic graph: If the reference service startup sequence is not updated during L consecutive iterations, the pheromone weighted volatility rate is updated using the following formula: ,in, is the weighted volatilization rate of the pheromone, is the maximum value of the preset pheromone weighted volatility rate, is the preset adjustment step; When the reference service startup sequence is updated in L consecutive iterations and the reference service startup sequence is updated in the current iteration, the pheromone weighted volatility rate is updated using the following formula: ,in, is the minimum value of the preset pheromone weighted volatilization rate; In a case where the reference service startup sequence is updated in L consecutive iterations and the reference service startup sequence is not updated in the current iteration, the pheromone weighted volatility rate is not updated.

7. The method for determining a service startup sequence according to claim 1, wherein: After updating the target parameter set, the method further includes: Calculate the mean Hamming distance between the paths corresponding to the M service startup sequences according to the M service startup sequences, and calculate the variance between the total startup durations of the M servers; When the mean Hamming distance is less than the second preset threshold, the value of M is increased using the following formula: ,in, is the maximum number of ants, is the update step size; When the variance is less than the third preset threshold and the mean Hamming distance is greater than or equal to the second preset threshold, the value of M is reduced using the following formula: ,in, is the minimum number of ants; When the mean of the Hamming distance is greater than or equal to the second preset threshold and the variance is greater than or equal to the third preset threshold, the value of M is not updated.

8. The method for determining a service startup sequence according to claim 1, wherein: The method further comprises: During the execution of the i-th iteration, when the server is restarted, obtaining the actual startup time of each service or process during the server restart process; The heuristic weight value of each node is updated according to the actual startup time of each service or process.

9. The method for determining a service startup sequence according to claim 8, wherein: Updating the heuristic weight value of each node according to the actual startup time of each service or process, including: The heuristic weight value of the j-th node in the directed acyclic graph is updated by the following formula to update the heuristic weight value of each node: ; is the heuristic weight value of the j-th node, is the preset smoothing factor, ∈[0,1], is the estimated startup time of the service or process corresponding to the j-th node, is the actual startup time of the service or process corresponding to the j-th node.

10. The method for determining a service startup sequence according to claim 2, wherein: The method further comprises: During the i-th iteration, if there is a target node in the directed acyclic graph, the heuristic weight value of the target node is updated using the following formula, wherein the target node is a node where the number of times the target phenomenon occurs is greater than a preset number, and the target phenomenon is the node with the slowest startup speed among the corresponding K nodes: ; in, is the heuristic weight value of the target node, is the pre-amplification coefficient, and C is the number of times the target phenomenon occurs.

11. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for determining a service startup sequence according to any one of claims 1 to 10 when executing the computer program.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for determining a service startup sequence according to any one of claims 1 to 10.

13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for determining a service startup sequence according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Improved ant colony algorithm integrating Kalman filtering prediction thought and suitable for mobile robot navigation

    CN114237252A

  • Super-computing Internet multi-target workflow optimization method and system based on ant colony algorithm

    CN117670005A