Resource scheduling method and device for job chain

By building data sets and cost functions in the database system and combining with the particle swarm algorithm, the waste caused by resource preemption in the database system is solved, and the resource utilization rate and the execution efficiency of the job chain are improved.

CN114896063BActive Publication Date: 2025-02-11AGRICULTURAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210504318.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2025-02-11
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

In the era of big data, when multiple job chains are executed on the database system, resource waste is caused by mutual seizing resources, reducing the execution efficiency of the job chain.

Method used

By constructing a data set that represents the resource allocation of each job chain on the database cluster, a cost function is established when each job chain is allocated for database resources, and a fitness function is established based on these data and cost functions. Then, the particle swarm algorithm is used to solve the minimum value of the fitness function to determine the resource allocation scheme for each job chain and allocate the database resources according to the scheme.

Benefits of technology

It effectively avoids the waste of resource seizing between job chains, improves the utilization rate of database resources, improves the overall execution efficiency of the job chain, and reduces the overall execution time of the job chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896063B_ABST
    Figure CN114896063B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a resource scheduling method and device for a job chain, which constructs a data set for representing the resource allocation of each job chain on a database cluster; establishes a cost function for each job chain to allocate database resources; establishes a fitness function based on the data set and the cost function; solves the minimum value of the fitness function through a particle swarm algorithm, and determines the resource allocation plan corresponding to each job chain according to the minimum value; and allocates database resources to each job chain according to the resource allocation plan. In the embodiment of the present invention, the optimal job chain resource allocation plan is solved through a particle swarm algorithm to avoid the waste of database resources caused by job chains competing for resources, which can greatly improve the utilization rate of database resources. Moreover, each job chain can be allocated appropriate database resources, thereby improving the overall execution efficiency of the job chain and reducing the overall execution time of the job chain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of resource scheduling, and more specifically, to a resource scheduling method and device for a job chain. Background Art

[0002] In the era of big data, processing massive data has become an essential business requirement. In order to complete the processing of massive data, it is necessary to organize many data processing operations into multiple operation chains. At present, when multiple operation chains are executed on the database system, different operation chains compete for resources with each other, which easily causes a waste of database system resources and greatly reduces the efficiency of operation chain execution. Summary of the invention

[0003] In view of this, an embodiment of the present invention discloses a resource scheduling method and device for a job chain, which realizes reasonable allocation of database resources required for each job chain and improves the overall work efficiency when multiple job chains are executed simultaneously.

[0004] The technical solution provided by the embodiment of the present invention is as follows:

[0005] A first aspect of an embodiment of the present invention provides a resource scheduling method for a job chain, the method comprising:

[0006] Construct a data set for representing resource allocation of each job chain on the database cluster;

[0007] Establishing a cost function for each job chain when performing database resource allocation;

[0008] Establishing a fitness function according to the data set and the cost function;

[0009] Solving the minimum value of the fitness function by using a particle swarm algorithm, and determining the resource allocation scheme corresponding to each job chain according to the minimum value;

[0010] Database resources are allocated to each of the job chains according to the resource allocation scheme.

[0011] In a possible implementation, solving the minimum value of the fitness function by a particle swarm algorithm, and determining the resource allocation scheme corresponding to each job chain according to the minimum value, includes:

[0012] Obtaining an initialized job chain resource request matrix and particle swarm algorithm parameters, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme;

[0013] Traversing each particle in the population according to the particle swarm algorithm parameters, and calculating the fitness value of each particle according to the fitness function;

[0014] Determine individual extreme value positions according to the fitness values;

[0015] Determine the global extreme value position according to the individual extreme value position;

[0016] Update the velocity and position of each particle;

[0017] Determine whether the particle swarm algorithm has reached a maximum number of iterations;

[0018] If the particle swarm algorithm has not reached the maximum number of iterations, then return to re-execute the following steps: traverse each particle in the population according to the particle swarm algorithm parameters, and calculate the fitness value of each particle according to the fitness function;

[0019] If the particle swarm algorithm reaches the maximum number of iterations, the particle swarm algorithm is terminated, the global extreme value position is mapped to the initialized job chain resource request matrix to obtain the optimal job chain resource allocation matrix, and the resource allocation scheme corresponding to each job chain is obtained according to the optimal job chain resource allocation matrix.

[0020] In a possible implementation, obtaining the initialized job chain resource request matrix includes:

[0021] Counting the average database resources required by each operation chain in a preset historical time period as initial resources;

[0022] An initialized job chain resource request matrix is ​​obtained according to the initial resources.

[0023] In a possible implementation, the cost function is expressed as:

[0024]

[0025] Wherein, c represents a cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant.

[0026] In a possible implementation, the database resources include: central processing unit CPU resources, memory resources and input and output IO resources;

[0027] The expression of the fitness function is:

[0028]

[0029] Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, Represents the cost function of CPU resources, Represents the cost function of memory resources, Represents the cost function of IO resources.

[0030] A second aspect of the present application provides a resource scheduling device for a job chain, the device comprising:

[0031] A construction unit, used for constructing a data set for representing resource allocation of each job chain on the database cluster;

[0032] A first establishing unit, used for establishing a cost function when each job chain performs database resource allocation;

[0033] A second establishing unit, used to establish a fitness function according to the data set and the cost function;

[0034] A solving unit, used for solving the minimum value of the fitness function by using a particle swarm algorithm, and determining a resource allocation scheme corresponding to each job chain according to the minimum value;

[0035] The allocation unit is used to allocate database resources to each job chain according to the resource allocation scheme.

[0036] In a possible implementation, the solving unit includes:

[0037] An acquisition unit, used to acquire an initialized job chain resource request matrix and particle swarm algorithm parameters, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme;

[0038] A calculation unit, used for traversing each particle in the population according to the particle swarm algorithm parameters, and calculating the fitness value of each particle according to the fitness function;

[0039] A first determining unit, configured to determine an individual extreme value position according to the fitness value;

[0040] A second determining unit, configured to determine a global extreme value position according to the individual extreme value position;

[0041] An updating unit, used for updating the speed and position of each particle;

[0042] A judging unit, used to judge whether the particle swarm algorithm has reached a maximum number of iterations;

[0043] The first judgment execution unit is used to return to re-execute the following steps if the particle swarm algorithm has not reached the maximum number of iterations: traverse each particle in the population according to the particle swarm algorithm parameters, and calculate the fitness value of each particle according to the fitness function;

[0044] The second judgment execution unit is used to end the particle swarm algorithm if the particle swarm algorithm reaches the maximum number of iterations, map the global extreme value position to the initialized job chain resource request matrix to obtain the optimal job chain resource allocation matrix, and obtain the resource allocation plan corresponding to each job chain according to the optimal job chain resource allocation matrix.

[0045] In a possible implementation, the acquiring unit includes:

[0046] A statistical unit, used to count the average database resources required by each operation chain in a preset historical time period as initial resources;

[0047] The acquisition subunit is used to acquire an initialized job chain resource request matrix according to the initial resources.

[0048] In a possible implementation, the cost function is expressed as:

[0049]

[0050] Wherein, c represents a cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant.

[0051] In a possible implementation, the database resources include: central processing unit CPU resources, memory resources and input and output IO resources;

[0052] The expression of the fitness function is:

[0053]

[0054] Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, represents the cost function of the CPU resources of the job chain, represents the cost function of the job chain memory resources, Represents the cost function of the job chain IO resources.

[0055] From the above technical solution, it can be seen that the embodiment of the present invention discloses a resource scheduling method and device for a job chain, constructs a data set for representing the resource allocation of each job chain on a database cluster; establishes a cost function for each job chain to allocate database resources; establishes a fitness function based on the data set and the cost function; solves the minimum value of the fitness function through a particle swarm algorithm, and determines the resource allocation scheme corresponding to each job chain based on the minimum value; and allocates database resources to each job chain based on the resource allocation scheme. In the embodiment of the present invention, the optimal job chain resource allocation scheme is solved through a particle swarm algorithm to avoid the waste of database resources caused by job chains competing for resources, which can greatly improve the utilization rate of database resources. Moreover, each job chain can be allocated appropriate database resources, thereby improving the overall execution efficiency of the job chain and reducing the overall execution time of the job chain. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without paying creative work.

[0057] Figure 1 The overall architecture of a resource scheduling method for a job chain disclosed in an embodiment of the present invention;

[0058] Figure 2 A flowchart of a resource scheduling method for a job chain disclosed in an embodiment of the present invention;

[0059] Figure 3 A flowchart of a method for determining a job chain resource allocation scheme by using a particle swarm algorithm disclosed in an embodiment of the present invention;

[0060] Figure 4 A schematic diagram of the structure of a resource scheduling device for a job chain disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0062] The embodiment of the present invention discloses a resource scheduling method and device for a job chain, which constructs a data set for representing the resource allocation of each job chain on a database cluster; establishes a cost function for each job chain to allocate database resources; establishes a fitness function based on the data set and the cost function; solves the minimum value of the fitness function through a particle swarm algorithm, and determines the resource allocation plan corresponding to each job chain according to the minimum value; and allocates database resources to each job chain according to the resource allocation plan. In the embodiment of the present invention, the optimal job chain resource allocation plan is solved through a particle swarm algorithm to avoid the waste of database resources caused by job chains competing for resources, which can greatly improve the utilization rate of database resources. Moreover, each job chain can be allocated appropriate database resources, thereby improving the overall execution efficiency of the job chain and reducing the overall execution time of the job chain.

[0063] See also Figure 1 , which is the overall architecture of a resource scheduling method for a job chain disclosed in an embodiment of the present invention. The job chain is uploaded to the database cluster, and the resource allocation scheme of each job chain is calculated by the particle swarm algorithm. Database resources are allocated to each job chain according to the calculated resource allocation scheme, and the job chain is executed according to the allocated database resources.

[0064] See also Figure 2 , a flow chart of a resource scheduling method for a job chain disclosed in an embodiment of the present invention, the method comprising:

[0065] Step S201: construct a data set for representing resource allocation of each job chain on the database cluster;

[0066] It should be noted that the data set can be expressed as S = {1, 2, ..., s}, where s∈S represents the sth job chain.

[0067] It can be understood that a job chain is a chain of interconnected job activities. When processing data, multiple jobs are required to form a job chain to meet the database processing requirements.

[0068] Step S202, establishing a cost function for each job chain when performing database resource allocation;

[0069] It should be noted that the expression of the cost function in the embodiment of the present invention is:

[0070]

[0071] Among them, c represents the cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant.

[0072] It is understandable that σ in the embodiment of the present invention can be designed to be a very small positive integer, so as to avoid the situation where the denominator is 0 when y=0.

[0073] It should be noted that the database resources in the embodiment of the present invention may include: central processing unit CPU resources, memory resources and input and output IO resources, etc., which are not specifically limited.

[0074] Step S203: establishing a fitness function according to the data set and the cost function;

[0075] It should be noted that the expression of the fitness function in the embodiment of the present invention is:

[0076]

[0077] Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, represents the cost function of the CPU resources of the job chain, represents the cost function of the job chain memory resources, Represents the cost function of the job chain IO resources.

[0078] It should be noted that in the embodiment of the present invention, an objective function is also established according to the data set and the cost function, and the expression of the objective function is:

[0079]

[0080] Wherein, cost(x, y) represents the cost function when the job chain performs database resource allocation, S is used to represent all job chains on the database cluster, S={1,2,...,s}, and s∈S represents the sth job chain.

[0081] It is understandable that in the embodiment of the present invention, objective functions can be established for the job chain CPU resources, job chain memory resources, and job chain IO resources respectively. The objective function is the desired optimization result, which is the resource allocation scheme of the three resources of CPU resources, memory resources, and IO resources. When the fitness function is minimum, the three objective functions obtained are the resource allocation schemes of the corresponding job chain CPU resources, job chain memory resources, and job chain IO resources.

[0082] Step S204: solving the minimum value of the fitness function by using a particle swarm algorithm, and determining a resource allocation scheme corresponding to each job chain according to the minimum value;

[0083] It should be noted that the particle swarm algorithm is a random search algorithm based on group collaboration developed by simulating the foraging behavior of bird flocks. The particle swarm algorithm used in the embodiment of the present invention is an optimization algorithm based on iteration. By iteratively searching for the optimal value, the algorithm is simple, converges quickly, and is highly efficient. It can quickly find the optimal solution, that is, it can quickly find the optimal job chain resource allocation plan. In this way, the job chain can be quickly scheduled according to the optimal job chain resource allocation plan, thereby improving the overall execution efficiency of the job chain and reducing the overall running time of the job chain.

[0084] Step S205: Allocate database resources to each job chain according to the resource allocation plan.

[0085] The embodiment of the present invention discloses a resource scheduling method for a job chain, which constructs a data set for representing the resource allocation of each job chain on a database cluster; establishes a cost function for each job chain to allocate database resources; establishes a fitness function based on the data set and the cost function; solves the minimum value of the fitness function through a particle swarm algorithm, and determines the resource allocation scheme corresponding to each job chain based on the minimum value; and allocates database resources to each job chain based on the resource allocation scheme. In the embodiment of the present invention, the optimal job chain resource allocation scheme is solved through a particle swarm algorithm to avoid the waste of database resources caused by job chains competing for resources, which can greatly improve the utilization rate of database resources. Moreover, each job chain can be allocated appropriate database resources, thereby improving the overall execution efficiency of the job chain and reducing the overall execution time of the job chain.

[0086] See also Figure 3 , is a flow chart of a method for determining a job chain resource allocation scheme by a particle swarm algorithm disclosed in an embodiment of the present invention. To further optimize the above embodiment, the resource scheduling method for a job chain in an embodiment of the present invention, wherein the minimum value of the fitness function is solved by a particle swarm algorithm, and the resource allocation scheme corresponding to each job chain is determined according to the minimum value, includes:

[0087] Step S301, obtaining an initialized job chain resource request matrix and particle swarm algorithm parameters, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme;

[0088] It should be noted that the particle swarm algorithm parameters refer to the group size, inertia weight, acceleration constant, etc.

[0089] It should be noted that, in the embodiment of the present invention, obtaining the initialized job chain resource request matrix includes:

[0090] Step S3011, counting the average database resources required by each job chain in a preset historical time period as initial resources;

[0091] It is understandable that the preset historical time period can be the most recent month or the most recent two months, etc., and is not specifically limited and can be set according to actual needs.

[0092] Step S3012: Obtain an initialized job chain resource request matrix according to the initial resources.

[0093] In an embodiment of the present invention, a set of random solutions is initialized as the job chain resource request matrix, so that the job chain resource scheduling problem is transformed into a combinatorial optimization problem of solving the optimal job chain resource allocation matrix. By iteratively searching for the optimal value, the algorithm is simple, converges quickly, and is highly efficient, and the optimal job chain resource allocation plan can be quickly obtained.

[0094] Step S302, traversing each particle in the population according to the particle swarm algorithm parameters, and calculating the fitness value of each particle according to the fitness function;

[0095] It can be understood that the fitness value refers to a specific value calculated according to the fitness function.

[0096] Step S303, determining the individual extreme value position according to the fitness value;

[0097] It should be noted that the individual extreme value position refers to the optimal allocation plan for a single resource.

[0098] Step S304, determining the global extreme value position according to the individual extreme value position;

[0099] It should be noted that the global extreme value position refers to the global optimal allocation plan of the three resources: CPU resources, memory resources, and IO resources.

[0100] Step S305, updating the speed and position of each particle;

[0101] Step S306, determining whether the particle swarm algorithm has reached the maximum number of iterations; if the particle swarm algorithm has not reached the maximum number of iterations, returning to re-execute step S302, if the particle swarm algorithm has reached the maximum number of iterations, executing step S307;

[0102] Step S307, ending the particle swarm algorithm, mapping the global extreme value position to the initialized job chain resource request matrix to obtain an optimal job chain resource allocation matrix, and obtaining a resource allocation scheme corresponding to each job chain according to the optimal job chain resource allocation matrix.

[0103] In an embodiment of the present invention, the job chain resource scheduling problem is transformed into a combinatorial optimization problem of solving the optimal job chain resource allocation matrix. The optimal job chain resource allocation plan can be quickly solved through the particle swarm algorithm, avoiding the waste of database system resources caused by job chains competing for resources, and can greatly improve the utilization rate of database system resources.

[0104] See also Figure 4 , an embodiment of the present invention discloses a resource scheduling device for a job chain, the device comprising:

[0105] A construction unit 401 is used to construct a data set for representing resource allocation of each job chain on the database cluster;

[0106] A first establishing unit 402 is used to establish a cost function when each job chain performs database resource allocation;

[0107] A second establishing unit 403, configured to establish a fitness function according to the data set and the cost function;

[0108] A solving unit 404 is used to solve the minimum value of the fitness function by using a particle swarm algorithm, and determine the resource allocation scheme corresponding to each job chain according to the minimum value;

[0109] The allocation unit 405 is configured to allocate database resources to each job chain according to the resource allocation scheme.

[0110] The embodiment of the present invention discloses a resource scheduling device for a job chain, which constructs a data set for representing the resource allocation of each job chain on a database cluster; establishes a cost function for each job chain to allocate database resources; establishes a fitness function based on the data set and the cost function; solves the minimum value of the fitness function through a particle swarm algorithm, and determines the resource allocation plan corresponding to each job chain based on the minimum value; and allocates database resources to each job chain based on the resource allocation plan. In the embodiment of the present invention, the optimal job chain resource allocation plan is solved through a particle swarm algorithm to avoid the waste of database resources caused by job chains competing for resources, which can greatly improve the utilization rate of database resources. Moreover, each job chain can be allocated appropriate database resources, thereby improving the overall execution efficiency of the job chain and reducing the overall execution time of the job chain.

[0111] To further optimize the above embodiment, in the resource scheduling device for the job chain in the embodiment of the present invention, the solving unit 404 includes:

[0112] An acquisition unit, used to acquire an initialized job chain resource request matrix and particle swarm algorithm parameters, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme;

[0113] A calculation unit, used for traversing each particle in the population according to the particle swarm algorithm parameters, and calculating the fitness value of each particle according to the fitness function;

[0114] A first determining unit, configured to determine an individual extreme value position according to the fitness value;

[0115] A second determining unit, configured to determine a global extreme value position according to the individual extreme value position;

[0116] An updating unit, used for updating the speed and position of each particle;

[0117] A judging unit, used to judge whether the particle swarm algorithm has reached a maximum number of iterations;

[0118] The first judgment execution unit is used to return to re-execute the following steps if the particle swarm algorithm has not reached the maximum number of iterations: traverse each particle in the population according to the particle swarm algorithm parameters, and calculate the fitness value of each particle according to the fitness function;

[0119] The second judgment execution unit is used to end the particle swarm algorithm if the particle swarm algorithm reaches the maximum number of iterations, map the global extreme value position to the initialized job chain resource request matrix to obtain the optimal job chain resource allocation matrix, and obtain the resource allocation plan corresponding to each job chain according to the optimal job chain resource allocation matrix.

[0120] To further optimize the above embodiment, in the resource scheduling device for a job chain in the embodiment of the present invention, the acquisition unit includes:

[0121] A statistical unit, used to count the average database resources required by each operation chain in a preset historical time period as initial resources;

[0122] The acquisition subunit is used to acquire an initialized job chain resource request matrix according to the initial resources.

[0123] To further optimize the above embodiment, in the resource scheduling device for the job chain in the embodiment of the present invention, the expression of the cost function is:

[0124]

[0125] Wherein, c represents a cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant.

[0126] To further optimize the above embodiment, in the resource scheduling device for the job chain in the embodiment of the present invention, the database resources include: central processing unit CPU resources, memory resources and input and output IO resources;

[0127] The expression of the fitness function is:

[0128]

[0129] Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, represents the cost function of the CPU resources of the job chain, represents the cost function of the job chain memory resources, Represents the cost function of the job chain IO resources.

[0130] It should be noted that the specific working principles of each component in the device embodiment can be found in the corresponding part of the method embodiment, which will not be repeated here.

[0131] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0132] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0133] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A resource scheduling method for a job chain, characterized in that: The method comprises: Construct a data set for representing resource allocation of each job chain on the database cluster; Establishing a cost function for each job chain when performing database resource allocation; Establishing a fitness function according to the data set and the cost function; Solving the minimum value of the fitness function by using a particle swarm algorithm, and determining the resource allocation scheme corresponding to each job chain according to the minimum value; Allocate database resources to each of the job chains according to the resource allocation scheme; The method of solving the minimum value of the fitness function by using a particle swarm algorithm and determining the resource allocation scheme corresponding to each job chain according to the minimum value includes: obtaining an initialized job chain resource request matrix and a particle swarm algorithm parameter, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme; traversing each particle in the population according to the particle swarm algorithm parameter, and calculating the fitness value of each particle according to the fitness function; determining the individual extreme value position according to the fitness value; determining the global extreme value position according to the individual extreme value position; updating the speed and position of each particle; judging whether the particle swarm algorithm has reached a maximum number of iterations; if the particle swarm algorithm has not reached the maximum number of iterations, returning to re-execute the following steps: traversing each particle in the population according to the particle swarm algorithm parameter, and calculating the fitness value of each particle according to the fitness function; if the particle swarm algorithm has reached the maximum number of iterations, terminating the particle swarm algorithm, mapping the global extreme value position to the initialized job chain resource request matrix to obtain an optimal job chain resource allocation matrix, and obtaining the resource allocation scheme corresponding to each job chain according to the optimal job chain resource allocation matrix; The expression of the cost function is: Wherein, c represents a cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant; The database resources include: CPU resources, memory resources and input and output IO resources; The expression of the fitness function is: Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, Represents the cost function of CPU resources, Represents the cost function of memory resources, Represents the cost function of IO resources.

2. The method according to claim 1, characterized in that The step of obtaining the initialized job chain resource request matrix includes: Counting the average database resources required by each operation chain in a preset historical time period as initial resources; An initialized job chain resource request matrix is ​​obtained according to the initial resources.

3. A resource scheduling device for a job chain, characterized in that: The device comprises: A construction unit, used for constructing a data set for representing resource allocation of each job chain on the database cluster; A first establishing unit, used for establishing a cost function when each job chain performs database resource allocation; A second establishing unit, used to establish a fitness function according to the data set and the cost function; A solving unit, used for solving the minimum value of the fitness function by using a particle swarm algorithm, and determining a resource allocation scheme corresponding to each job chain according to the minimum value; an allocation unit, configured to allocate database resources to each of the job chains according to the resource allocation scheme; The solution unit includes: an acquisition unit, used to acquire an initialized job chain resource request matrix and a particle swarm algorithm parameter, wherein the initialized job chain resource request matrix is ​​used to indicate an initial resource allocation scheme; a calculation unit, used to traverse each particle in the population according to the particle swarm algorithm parameter, and calculate the fitness value of each particle according to the fitness function; a first determination unit, used to determine the individual extreme value position according to the fitness value; a second determination unit, used to determine the global extreme value position according to the individual extreme value position; an update unit, used to update the speed and position of each particle; a judgment unit, used to judge whether the particle swarm algorithm whether the maximum number of iterations has been reached; a first judgment execution unit, used to return and re-execute the following steps if the particle swarm algorithm has not reached the maximum number of iterations: traverse each particle in the population according to the particle swarm algorithm parameters, and calculate the fitness value of each particle according to the fitness function; a second judgment execution unit, used to end the particle swarm algorithm if the particle swarm algorithm has reached the maximum number of iterations, map the global extreme value position to the initialized job chain resource request matrix to obtain the optimal job chain resource allocation matrix, and obtain the resource allocation plan corresponding to each job chain according to the optimal job chain resource allocation matrix; The expression of the cost function is: Wherein, c represents a cost function, x represents the database resource demand of the job chain, y represents the remaining resources of the database cluster, and σ represents a constant; The database resources include: CPU resources, memory resources and input and output IO resources; The expression of the fitness function is: Wherein, fit represents the fitness function, S is used to represent all job chains on the database cluster, S = {1, 2, ..., s}, s∈S represents the sth job chain, represents the cost function of the CPU resources of the job chain, represents the cost function of the job chain memory resources, Represents the cost function of the job chain IO resources.

4. The device according to claim 3, characterized in that The acquisition unit comprises: A statistical unit, used to count the average database resources required by each operation chain in a preset historical time period as initial resources; The acquisition subunit is used to acquire an initialized job chain resource request matrix according to the initial resources.

Citation Information

Patent Citations

  • Cloud computing resource scheduling realization method based on improved genetic algorithm

    CN105740051A