CN111026546A - Task scheduling method and device, storage medium and electronic device - Google Patents
- ️Fri Apr 17 2020
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present application provides a task scheduling method, device, storage medium, and electronic device.
According to an aspect of an embodiment of the present application, there is provided a task scheduling method, including:
acquiring a task scheduling curve, wherein the task scheduling curve is used for indicating the utilization rate of a server cluster in a target time period;
determining a target server cluster computing power according to the task scheduling curve, wherein the target server cluster computing power is used for indicating the computing power of the server cluster in a target sub-time period, the target time period comprises one or more sub-time periods, and the one or more sub-time periods comprise the target sub-time period;
and scheduling a target task with target task computing power matched with the target server cluster computing power to the server cluster from a task set in the target sub-time period, wherein the target task computing power is used for indicating the computing power of the server cluster occupied by the target task.
Optionally, determining the computation power of the target server cluster according to the task scheduling curve includes:
acquiring a reference utilization rate and a target utilization rate corresponding to the target sub-time period from the scheduling curve;
determining a ratio between the target usage rate and the reference usage rate;
determining a product value between the ratio and the maximum computing power of the server cluster as the target server cluster computing power.
Optionally, the obtaining a reference usage rate and a target usage rate corresponding to the target sub-time period from the scheduling curve includes:
fitting the scheduling curve to a scheduling function, wherein a variable of the scheduling function is a time point included in the target time period, and a function value of the scheduling function is the utilization rate of the server cluster;
and acquiring the reference utilization rate from the scheduling function and determining a function value corresponding to the target sub-time period as the target utilization rate.
Optionally, the obtaining the reference usage rate from the scheduling function includes:
determining a maximum function value of the scheduling function as the reference usage rate; or,
and determining a function value corresponding to a preset reference time point as the reference utilization rate.
Optionally, scheduling, in the target sub-period, a target task whose target task power matches the target server cluster power from a task set to the server cluster includes:
acquiring task computing power corresponding to each task included in the task set, wherein the task computing power is used for indicating the computing capacity of the server cluster occupied by executing each task;
one or more tasks with the total task computing power smaller than or equal to the computing power of the target server cluster are obtained from the task set and serve as the target tasks;
and scheduling the target task to the server cluster in the target sub-time period.
Optionally, the obtaining task computing power corresponding to each task included in the task set includes:
acquiring an execution time corresponding to each task, wherein the execution time is used for indicating the time used for executing each task;
and determining the ratio of the execution time length to a target unit time as the task computing power corresponding to each task, wherein the server cluster computing power of the server cluster is used for indicating the computing power of the server cluster in the target unit time.
According to another aspect of the embodiments of the present application, there is also provided a task scheduling apparatus, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a task scheduling curve, and the task scheduling curve is used for indicating the utilization rate of a server cluster in a target time period;
a determining module, configured to determine a target server cluster computing power according to the task scheduling curve, where the target server cluster computing power is used to indicate a computing power of the server cluster in a target sub-time period, the target time period includes one or more sub-time periods, and the one or more sub-time periods include the target sub-time period;
and the scheduling module is used for scheduling a target task with target task computing power matched with the target server cluster computing power to the server cluster from a task set in the target sub-time period, wherein the target task computing power is used for indicating the computing power of the server cluster occupied by the target task.
Optionally, the determining module includes:
a first obtaining unit, configured to obtain a reference utilization rate and a target utilization rate corresponding to the target sub-time period from the scheduling curve;
a first determination unit configured to determine a ratio between the target usage rate and the reference usage rate;
a second determining unit, configured to determine a product value between the ratio and the maximum computing power of the server cluster as the target server cluster computing power.
Optionally, the first obtaining unit includes:
a fitting subunit, configured to fit the scheduling curve to a scheduling function, where a variable of the scheduling function is a time point included in the target time period, and a function value of the scheduling function is a utilization rate of the server cluster;
and the first obtaining subunit is configured to obtain the reference utilization rate from the scheduling function and determine a function value corresponding to the target sub-time period as the target utilization rate.
Optionally, the first obtaining subunit is configured to:
determining a maximum function value of the scheduling function as the reference usage rate; or,
and determining a function value corresponding to a preset reference time point as the reference utilization rate.
Optionally, the scheduling module includes:
a second obtaining unit, configured to obtain a task computing power corresponding to each task included in the task set, where the task computing power is used to indicate a computing power of the server cluster occupied by executing each task;
a third obtaining unit, configured to obtain, from the task set, one or more tasks whose total task computing power is less than or equal to the target server cluster computing power as the target task;
and the scheduling unit is used for scheduling the target task to the server cluster in the target sub-time period.
Optionally, the second obtaining unit includes:
a second obtaining subunit, configured to obtain an execution duration corresponding to each task, where the execution duration is used to indicate a time used for executing each task;
and the determining submodule is used for determining the ratio of the execution time length to a target unit time as the task computing power corresponding to each task, wherein the server cluster computing power of the server cluster is used for indicating the computing power of the server cluster in the target unit time.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program which, when executed, performs the above-described method.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the above method through the computer program.
In the embodiment of the application, a task scheduling curve is obtained, wherein the task scheduling curve is used for indicating the utilization rate of a server cluster in a target time period; determining the calculation power of a target server cluster according to the task scheduling curve, wherein the calculation power of the target server cluster is used for indicating the calculation power of the server cluster in a target sub-time period; scheduling the target tasks with the target task computing power matched with the target server cluster computing power from the task set to the server cluster in the target sub-time period, wherein the target task computing power is used to indicate the manner in which the computing power of the server cluster is occupied by the target task, determining the target server cluster computing power corresponding to the target sub-time period through a task scheduling curve capable of indicating the utilization rate of the server cluster in the target time period, thereby obtaining the computing power of the server cluster in the target sub-time period, then scheduling the target tasks matched with the computing power of the server cluster to the server cluster for execution according to the computing power of the target server cluster and the computing power of the tasks in the task set, achieving the purpose of reasonably utilizing the resources of the server cluster, therefore, the technical effect of improving the service efficiency of the server cluster is achieved, and the technical problem that the service efficiency of the server cluster is low is solved.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of embodiments of the present application, an embodiment of a method for scheduling a task is provided.
Alternatively, in this embodiment, the task scheduling method described above may be applied to a hardware environment formed by the
scheduling device101 and the
server cluster103 as shown in fig. 1. As shown in fig. 1, a
server cluster103 is connected to the
scheduling apparatus101 through a network, and the
server cluster103 may be used to provide services (such as game services, application services, etc.) for terminals or clients installed on terminals, and a database may be provided on or independent of the server for providing data storage services for the
server cluster103, where the network includes but is not limited to: the terminal is not limited to a PC, a mobile phone, a tablet computer, an intelligent device, and the like. The task scheduling method in the embodiment of the present application may be executed by the
scheduling device101, and the
scheduling device101 may be deployed on the
server cluster103, or may be deployed independently from the
server cluster103. The scheduling method for the
scheduling apparatus101 to execute the task according to the embodiment of the present application may be executed by a client installed thereon.
Fig. 2 is a flowchart of an alternative task scheduling method according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
step S202, a task scheduling curve is obtained, wherein the task scheduling curve is used for indicating the utilization rate of the server cluster in a target time period;
step S204, determining a target server cluster computing power according to the task scheduling curve, wherein the target server cluster computing power is used for indicating the computing power of the server cluster in a target sub-time period, the target time period comprises one or more sub-time periods, and the one or more sub-time periods comprise the target sub-time period;
step S206, scheduling a target task with target task computing power matched with the target server cluster computing power to the server cluster from a task set in the target sub-time period, wherein the target task computing power is used for indicating the computing power of the server cluster occupied by the target task.
Through the steps S202 to S206, the calculation power of the target server cluster corresponding to the target sub-time period is determined by the task scheduling curve capable of indicating the utilization rate of the server cluster in the target time period, so as to obtain the calculation power of the server cluster in the target sub-time period, and then the target task matched with the calculation power of the server cluster is scheduled to the server cluster for execution according to the calculation power of the target server cluster and the calculation power of the tasks in the task set, thereby achieving the purpose of reasonably utilizing the resources of the server cluster, achieving the technical effect of improving the service efficiency of the server cluster, and further solving the technical problem of low service efficiency of the server cluster.
In the technical solution provided in step S202, the task scheduling curve is used to indicate the utilization rate of the server cluster in the target time period, a curve may be formed in a two-dimensional coordinate system, the horizontal axis of the coordinate system is time, and the target time period corresponding to the curve may be, but is not limited to, one or more days, one or more hours, one or more weeks, one or more months, one or more years, and the like. In an actual production environment, a public cloud environment, the utilization rate of the server cluster has a peak and a valley, the target time period is one day, data collection is accurate to every minute, for example, if the utilization rate of the cluster in every minute is marked as a point, a smooth curve is formed from 0 point to 24 points every day, namely the task scheduling curve is used for indicating the utilization rate of the server cluster in one day.
In the technical solution provided in step S204, the calculation power of the target server cluster is used to indicate the calculation power of the server cluster in the target sub-time period. The target time period comprises one or more sub-time periods, the one or more sub-time periods comprising the target sub-time period. The target sub-period may be, but is not limited to, any period of time for which scheduling of tasks is required.
Optionally, in this embodiment, the target server cluster computing power corresponding to the target sub-time period may be, but is not limited to, represented by using the server cluster computing power corresponding to one time node in the target sub-time period. Or the target server cluster computing power corresponding to the target sub-time period can be represented by using the average value of the server cluster computing power in the target sub-time period.
For example: 0-24 points in a day are divided by taking hours as units, 0-1 point is a sub-time period, 1-2 points are a sub-time period, and the rest is done in the same way, and 23-24 points are a sub-time period. The server cluster computing power corresponding to each time period can be represented by the server cluster computing power corresponding to the starting time point of each sub-time period, that is, the server cluster computing power corresponding to 0-1 point is the server cluster computing power corresponding to 0 point, the server cluster computing power corresponding to 1-2 points is the server cluster computing power corresponding to 1 point, and so on, the server cluster computing power corresponding to 23-24 points is the server cluster computing power corresponding to 23 points.
In the technical solution provided in step S206, the target task may be selected in a random manner. Alternatively, the tasks may be selected in sequence according to the order of the tasks in the task set.
Such as: a target task whose target task computing power matches the target server cluster computing power may be randomly extracted from the task set. Or, a target task with target task computing power matched with the target server cluster computing power can be determined from the first task in the task set.
Optionally, in the present embodiment, the number of target tasks may be, but is not limited to, one or more.
Optionally, in this embodiment, the tasks included in the task set may be, but are not limited to, tasks that are not very sensitive to execution time. Such as: the time sensitivity of the tasks can be measured according to the attribute information, the execution information and the like of the tasks, the tasks with the time sensitivity lower than the preset sensitivity threshold are determined as the tasks which are not very sensitive to the execution duration, and the tasks are added into the task set for executing time scheduling.
In the technical solution provided in step S206, the target task computing power is used to indicate the computing power of the server cluster occupied by the target task. The target task effort may be determined, but is not limited to, based on the execution duration of the target task.
As an alternative embodiment, the determining the target server cluster computing power according to the task scheduling curve includes:
s1, acquiring a reference utilization rate and a target utilization rate corresponding to the target sub-time period from the scheduling curve;
s2, determining the ratio of the target utilization rate to the reference utilization rate;
and S3, determining the product value between the ratio and the maximum computing power of the server cluster as the computing power of the target server cluster.
Optionally, in this embodiment, the ratio of the computing power that needs to be provided by the server cluster in the target sub-time period to the computing power that can be provided by the server cluster may be determined by calculating the ratio between the target utilization rate corresponding to the target sub-time period and the reference utilization rate. And multiplying the ratio by the maximum computing power of the server cluster to obtain the computing power of the target server cluster corresponding to the target sub-time period.
Optionally, in this embodiment, the maximum computing power of the server cluster may be, but is not limited to, a maximum value of an actual overall computing power of the server cluster, or may also be a maximum value of a computing power that can be provided by the server cluster to an external service. Such as: the overall computing power of the server cluster is M, the idle state of a machine is ensured to be about N% in normal service, and the maximum computing power of the server cluster to external service is M multiplied by N%. The maximum computing power of the server cluster may be M, or M × N%.
As an optional embodiment, the obtaining a reference usage rate and a target usage rate corresponding to the target sub-period from the scheduling curve includes:
s1, fitting the scheduling curve to a scheduling function, wherein the variable of the scheduling function is the time point included in the target time period, and the function value of the scheduling function is the utilization rate of the server cluster;
s2, obtaining the reference usage rate from the scheduling function, and determining the function value corresponding to the target sub-time segment as the target usage rate.
Optionally, in this embodiment, the usage rate of the server cluster at any time point or in any time period may be determined by, but not limited to, function curve fitting and function value calculation.
Optionally, in this embodiment, a scheduling curve is fitted to the scheduling function, such as: the scheduling function may be represented by y ═ f (x), and the x axis represents time, which may be as accurate as hours, minutes, or seconds, as desired. The y-axis represents usage of the server cluster. Each time a specific time point x1 is given, a corresponding usage value y1 is obtained.
Optionally, in this embodiment, a y value is selected from the task scheduling curve arbitrarily or according to a certain rule as the reference utilization rate, and a function value corresponding to the target sub-period can be calculated from the scheduling function as the target utilization rate.
As an alternative embodiment, the obtaining the reference usage rate from the scheduling function includes:
s1, determining the maximum function value of the scheduling function as the reference usage rate; or,
and S2, determining a function value corresponding to a preset reference time point as the reference utilization rate.
Alternatively, in this embodiment, the maximum function value of the scheduling function may be used as the reference usage rate. Such as: and acquiring a ymax value from the scheduling function as a reference utilization rate y 0.
Alternatively, in this embodiment, a function value of the scheduling function at a certain preset reference time point may be used as the reference utilization rate. Such as: the value of f (x0) is obtained from the above scheduling function as the reference usage y 0.
It should be noted that the above manner of determining the reference usage rate is only an example, and the manner of determining the reference usage rate in the embodiment is not limited to this.
As an optional embodiment, scheduling, in the target sub-period, a target task whose target task power matches the target server cluster power from a task set to the server cluster includes:
s1, acquiring task computing power corresponding to each task included in the task set, wherein the task computing power is used for indicating the computing power of the server cluster occupied by executing each task;
s2, acquiring one or more tasks with total task computing power less than or equal to the computing power of the target server cluster from the task set as the target tasks;
s3, the target task is dispatched to the server cluster in the target sub-time period.
Optionally, in this embodiment, the target task may be determined according to, but not limited to, a relationship between task computing power corresponding to the task and target server cluster computing power.
Optionally, in this embodiment, one or more tasks whose total task computing power is less than or equal to (i.e., does not exceed) the target server cluster computing power may be determined as target tasks whose target task computing power matches the target server cluster computing power, but is not limited to.
As an optional embodiment, the obtaining task computing power corresponding to each task included in the task set includes:
s1, obtaining an execution time length corresponding to each task, wherein the execution time length is used for indicating the time used for executing each task;
and S2, determining the ratio of the execution time length to a target unit time as the task computing power corresponding to each task, wherein the server cluster computing power of the server cluster is used for indicating the computing power of the server cluster in the target unit time.
Optionally, in this embodiment, the task computing power corresponding to each task may be determined according to the execution duration of each task, but is not limited thereto.
For example: the server cluster computation power is a, which represents that a cpu-intensive task can be provided for 100 × 60 seconds per hour, then the task in the dispatch pool needs to execute Bmin, and the computation power required by the task is (B × 60 × 100)/(100 × 60) computation power, and the computation process of the task computation power is equivalent to a process of normalizing the computation power required by each task.
The application further provides an optional embodiment, which provides a general task scheduling method, and the method can trigger scheduling of the server cluster machine or other program behaviors according to a given task scheduling curve.
In this optional embodiment, a scheduling function of a given task scheduling curve is obtained, then, a ratio R of values of each time point to a highest point is sequentially calculated with the highest point of the scheduling curve as a reference, and assuming that the service capacity of the whole cluster is 100, 100 × R is the service capacity of the server cluster that can be provided at this time point, and then, the corresponding number of tasks is taken out from the task pool to be executed.
In an actual production environment, such as a public cloud environment, the cluster usage rate itself has peaks and valleys, and if the cluster usage rate per minute is marked as a point, a smooth curve is formed from 0 to 24 points per day. In order to improve the utilization efficiency of the server cluster, the curve can be utilized reversely by the method to schedule tasks which are not very sensitive at certain time, namely, more tasks are scheduled to be executed at the valley of the curve, and less tasks are scheduled to be executed at the peak. The peak clipping and valley filling are realized, the service capability of the cluster is better exerted, and the resources are saved.
Fig. 3 is a flowchart of an alternative task scheduling method according to an alternative embodiment of the present application, and as shown in fig. 3, the flowchart includes the following steps:
step 1, fitting a scheduling curve: and fitting a given scheduling curve into a scheduling function y ═ f (x), wherein the x axis is time and can be accurate to hours, minutes or seconds as required, and y represents a numerical value and can be used for expressing the utilization rate of the server cluster. Thus, each time a particular point in time x1 is given, a corresponding value y1 is obtained.
Step 2, obtaining a calculation force proportion: and selecting the highest point value ymax of the scheduling curve as a reference value, and calculating the y value of each time node between 0 and 24 points. For example, taking hour as the minimum unit, y0 represents 0-1 point, y1 represents 1-2 points, and so on, y23 represents the value of 23-24 points, and y 0-y 23 are divided by ymax respectively to obtain a percentage R0-R23, wherein the percentage is between 0-1.
Step 3, determining the computing power of the server cluster: assuming that the total computing power of the server cluster is 100, and the idle of the machine is guaranteed to be about 40% during normal service, the maximum computing power of the external service is 60, the maximum computing power of the service scheduling is 60, that is, at the moment of ymax, the computing power that the cluster can output externally is 60, and at any moment yn from y0 to y23, the corresponding server cluster computing power Cn is equal to Rn 60.
And 4, calculating the calculation force used by the task: tasks in the task pool to be scheduled are also divided according to machine computation power, such as the cluster computation power 100, which represents a cpu-intensive task that can provide 100 × 60 seconds per hour, that is, a task with an execution time of 100 hours can be processed per hour, and then for a task that needs to be executed for 5min in the task pool, the computation power needed is (5 × 60 × 100)/(100 × 60) ═ 0.083 computation power, that is, the computation power needed to provide 0.083 hour per hour for the cluster. And calculating the calculation power required by each task according to a statistical mode of the cluster calculation power, so that the calculation power required by each task in the task pool can be standardized to obtain the cluster calculation power Tn required by each task.
Step 5, task scheduling: and (4) determining which tasks can be scheduled at each time point by combining the server cluster computing power Cn calculated in the step (3) and the computing power Tn required by the tasks in the task pool calculated in the step (4), so that peak clipping and valley filling are realized, and server cluster resources are utilized to the maximum extent.
The existing service scheduling is generally based on a timing scheduling task or a trigger time filled when a terminal user submits, and the scheduling cannot be performed according to a specified more flexible function scheduling strategy. The optional embodiment provides a general scheme, which can realize the scheduling of tasks and machines according to a specified scheduling function strategy, realize peak clipping and valley filling, and use machine resources to the maximum extent. The use efficiency of the machine is effectively improved, and the calculation resources of the cluster are saved.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
According to another aspect of the embodiment of the present application, there is also provided a task scheduling apparatus for implementing the task scheduling method. Fig. 4 is a schematic diagram of an alternative task scheduling apparatus according to an embodiment of the present application, and as shown in fig. 4, the apparatus may include:
an obtaining module 42, configured to obtain a task scheduling curve, where the task scheduling curve is used to indicate a usage rate of a server cluster in a target time period;
a determining module 44, configured to determine a target server cluster computing power according to the task scheduling curve, where the target server cluster computing power is used to indicate a computing power of the server cluster in a target sub-time period, and the target time period includes one or more sub-time periods, and the one or more sub-time periods include the target sub-time period;
and a scheduling module 46, configured to schedule, from a task set in the target sub-period, a target task whose target task computing power matches the target server cluster computing power to the server cluster, where the target task computing power is used to indicate a computing power of the server cluster occupied by the target task.
It should be noted that the obtaining module 42 in this embodiment may be configured to execute step S202 in this embodiment, the determining module 44 in this embodiment may be configured to execute step S204 in this embodiment, and the scheduling module 46 in this embodiment may be configured to execute step S206 in this embodiment.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.
Through the module, the calculation capacity of the target server cluster corresponding to the target sub-time period is determined through the task scheduling curve capable of indicating the utilization rate of the server cluster in the target time period, so that the calculation capacity of the server cluster in the target sub-time period is obtained, and then the target tasks matched with the calculation capacity of the server cluster are scheduled to the server cluster for execution according to the calculation capacity of the target server cluster and the calculation capacity of the tasks in the task set, so that the purpose of reasonably utilizing the resources of the server cluster is achieved, the technical effect of improving the service efficiency of the server cluster is achieved, and the technical problem that the service efficiency of the server cluster is low is solved.
Optionally, the determining module includes:
a first obtaining unit, configured to obtain a reference utilization rate and a target utilization rate corresponding to the target sub-time period from the scheduling curve;
a first determination unit configured to determine a ratio between the target usage rate and the reference usage rate;
a second determining unit, configured to determine a product value between the ratio and the maximum computing power of the server cluster as the target server cluster computing power.
Optionally, the first obtaining unit includes:
a fitting subunit, configured to fit the scheduling curve to a scheduling function, where a variable of the scheduling function is a time point included in the target time period, and a function value of the scheduling function is a utilization rate of the server cluster;
and the first obtaining subunit is configured to obtain the reference utilization rate from the scheduling function and determine a function value corresponding to the target sub-time period as the target utilization rate.
Optionally, the first obtaining subunit is configured to:
determining a maximum function value of the scheduling function as the reference usage rate; or,
and determining a function value corresponding to a preset reference time point as the reference utilization rate.
Optionally, the scheduling module includes:
a second obtaining unit, configured to obtain a task computing power corresponding to each task included in the task set, where the task computing power is used to indicate a computing power of the server cluster occupied by executing each task;
a third obtaining unit, configured to obtain, from the task set, one or more tasks whose total task computing power is less than or equal to the target server cluster computing power as the target task;
and the scheduling unit is used for scheduling the target task to the server cluster in the target sub-time period.
Optionally, the second obtaining unit includes:
a second obtaining subunit, configured to obtain an execution duration corresponding to each task, where the execution duration is used to indicate a time used for executing each task;
and the determining submodule is used for determining the ratio of the execution time length to a target unit time as the task computing power corresponding to each task, wherein the server cluster computing power of the server cluster is used for indicating the computing power of the server cluster in the target unit time.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the present application, there is also provided a server or a terminal for implementing the scheduling method of the task.
Fig. 5 is a block diagram of a terminal according to an embodiment of the present application, and as shown in fig. 5, the terminal may include: one or more processors 501 (only one of which is shown), a
memory503, and a transmission means 505. as shown in fig. 5, the terminal may further include an input/output device 507.
The
memory503 may be used to store software programs and modules, such as program instructions/modules corresponding to the task scheduling method and apparatus in the embodiments of the present application, and the processor 501 executes various functional applications and data processing by running the software programs and modules stored in the
memory503, that is, implements the task scheduling method described above. The
memory503 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the
memory503 may further include memory located remotely from the processor 501, which may be connected to the terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 505 is used for receiving or sending data via a network, and may also be used for data transmission between the processor and the memory. Examples of the network may include a wired network and a wireless network. In one example, the
transmission device505 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the
transmission device505 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Among them, the
memory503 is used to store an application program in particular.
The processor 501 may call the application stored in the
memory503 through the transmission means 505 to perform the following steps:
s1, acquiring a task scheduling curve, wherein the task scheduling curve is used for indicating the utilization rate of the server cluster in a target time period;
s2, determining a target server cluster computing power according to the task scheduling curve, wherein the target server cluster computing power is used for indicating the computing power of the server cluster in a target sub-time period, the target time period comprises one or more sub-time periods, and the one or more sub-time periods comprise the target sub-time period;
s3, scheduling a target task with target task computing power matched with the target server cluster computing power to the server cluster from a task set in the target sub-time period, wherein the target task computing power is used for indicating the computing power of the server cluster occupied by the target task.
The processor 501 is further configured to perform the following steps:
acquiring a reference utilization rate and a target utilization rate corresponding to the target sub-time period from the scheduling curve;
determining a ratio between the target usage rate and the reference usage rate;
determining a product value between the ratio and the maximum computing power of the server cluster as the target server cluster computing power.
By adopting the embodiment of the application, a task scheduling scheme is provided. The computing power of the target server cluster corresponding to the target sub-time period is determined through a task scheduling curve capable of indicating the utilization rate of the server cluster in the target time period, so that the computing power of the server cluster in the target sub-time period is obtained, and then the target task matched with the computing power of the server cluster is scheduled to the server cluster for execution according to the computing power of the target server cluster and the computing power of the tasks in the task set, so that the purpose of reasonably utilizing the resources of the server cluster is achieved, the technical effect of improving the service efficiency of the server cluster is achieved, and the technical problem that the service efficiency of the server cluster is low is solved.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 5 is only an illustration, and the terminal may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a Mobile Internet Device (MID), a PAD, etc. Fig. 5 is a diagram illustrating a structure of the electronic device. For example, the terminal may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 5, or have a different configuration than shown in FIG. 5.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Embodiments of the present application also provide a storage medium. Alternatively, in this embodiment, the storage medium may be a program code for executing a scheduling method of a task.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, acquiring a task scheduling curve, wherein the task scheduling curve is used for indicating the utilization rate of the server cluster in a target time period;
s2, determining a target server cluster computing power according to the task scheduling curve, wherein the target server cluster computing power is used for indicating the computing power of the server cluster in a target sub-time period, the target time period comprises one or more sub-time periods, and the one or more sub-time periods comprise the target sub-time period;
s3, scheduling a target task with target task computing power matched with the target server cluster computing power to the server cluster from a task set in the target sub-time period, wherein the target task computing power is used for indicating the computing power of the server cluster occupied by the target task.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.