Disclosure of Invention
The invention aims to provide a computing resource allocation method and related components thereof, which can ensure that part of background tasks can be normally executed on the premise of ensuring that the execution speed of foreground resources is not influenced, so that the overall performance of a storage array is improved, each background task can be independently controlled, the problem of blocking of the foreground tasks is avoided, and the usability of the storage array is improved.
In order to solve the above technical problems, the present invention provides a computing resource allocation method, including:
When a foreground task is executed, distributing computing resources required by full-speed execution of the foreground task for the foreground task;
determining the preset influence degree of each background task currently being executed on the foreground task;
determining control factors of the background tasks according to the preset task priority and the preset influence degree of the background tasks;
judging whether the sum of the number of the computing resources used by the foreground tasks and the sum of the number of the computing resources used by all the background tasks is smaller than a preset sum;
And if the control factor is smaller than the preset number sum, distributing computing resources required by full-speed execution of each background task for each background task of which the control factor is smaller than the preset factor.
Preferably, before determining the control factor of each background task according to the preset task priority and the preset influence degree of each background task, the method further includes:
Determining a task execution environment at the current moment, wherein the task execution environment at least comprises a common environment and a priority foreground task environment;
Determining control factors of the background tasks according to the preset task priority and the preset influence degree of the background tasks, wherein the control factors comprise:
and determining control factors of the background tasks according to the influence parameters of the background tasks corresponding to the task execution environment, the preset task priority and the preset influence degree.
Preferably, determining whether the sum of the number of computing resources of the foreground task and the number of computing resources of all the background tasks is smaller than a preset sum of the number of computing resources comprises:
judging whether the sum of the computing resources of the foreground task and the computing resources of all the background tasks is smaller than the sum of the preset numbers corresponding to the task execution environments;
if the number of the task execution environments is smaller than the preset number sum corresponding to the task execution environments, judging that the number of the task execution environments is smaller than the preset number sum;
and if the number of the task execution environments is not smaller than the preset number sum corresponding to the task execution environments, judging that the number of the task execution environments is not smaller than the preset number sum.
Preferably, the method further comprises:
and if the sum of the preset numbers is not smaller than the sum of the preset numbers, distributing computing resources of a preset limit corresponding to each background task.
Preferably, after allocating the computing resources required for the foreground task to execute at full speed to the foreground task, the method further includes:
judging whether the data interaction speed between the foreground task and the storage module is smaller than a preset speed or not;
And if the speed is smaller than the preset speed, generating alarm information.
Preferably, the background task comprises each background task body and a preset background task group consisting of a plurality of background task bodies;
allocating computing resources required by full-speed execution of each background task for each background task of which the control factor is smaller than a preset factor, wherein the computing resources comprise:
and distributing computing resources required by full-speed execution of each background task body for each background task body of which the control factor is smaller than a preset factor and all the background task bodies in each preset background task group.
Preferably, determining the control factor of each background task according to the preset task priority and the preset influence degree of each background task includes:
Determining the preset task priority of each background task and the preset first weight corresponding to the preset task priority;
determining a preset second weight corresponding to the preset influence degree of each background task;
For any one of the background tasks, determining the sum of products between the preset task priority and the preset first weight and the sum of products between the preset influence degree and the second weight and serving as a control factor of the background task.
The present invention also provides a computing resource allocation apparatus, comprising:
A memory for storing a computer program;
And a processor for implementing the steps of the computing resource allocation method as described above when executing the computer program.
The invention also provides a storage array, which comprises a storage array body and the computing resource distribution device;
The storage array body is connected with the computing resource distribution device.
The present invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of a computing resource allocation method as described above.
The invention provides a computing resource allocation method and related components thereof, which relate to the field of computing resource allocation, when a foreground task is executed, computing resources required by full-speed execution of the foreground task are allocated to the foreground task, then the preset influence degree of each background task currently being executed on the foreground task is determined, the control factors of each background task are determined according to the preset task priority and the preset influence degree of each background task, then the sum of the number of computing resources used by the foreground task and all the background tasks is judged to be smaller than the sum of the preset number, and if the sum of the number of computing resources is smaller than the sum of the preset number, the computing resources required by full-speed execution of each background task are allocated to each background task of which the control factors are smaller than the preset factors. The different background tasks have different influence degrees on the foreground tasks, and the smaller the control factors are, the smaller the influence degree of the corresponding background tasks on the foreground tasks is or the higher the task priority is, so that computing resources required by full-speed execution of the background tasks with the control factors smaller than the preset factors are allocated to the background tasks, the normal execution of part of the background tasks can be ensured on the premise of ensuring that the execution speed of the foreground resources is not influenced, the overall performance of the storage array is improved, each background task can be independently controlled, the problem of blockage of the foreground tasks is avoided, and the usability of the storage array is improved.
Detailed Description
The core of the invention is to provide a computing resource allocation method and related components thereof, which can ensure that part of background tasks can be normally executed on the premise of ensuring that the execution speed of foreground resources is not influenced, thus not only improving the overall performance of a storage array, but also independently controlling each background task, avoiding the problem of blocking the foreground tasks and improving the usability of the storage array.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a computing resource allocation method according to the present application, which includes:
s11: when a foreground task is executed, computing resources required by full-speed execution of the foreground task are allocated for the foreground task;
In order to ensure the user experience, in the application, when a foreground task is executed, such as executing a foreground task including a large-block data sequential reading, a small-block data random writing or an OLTP (Online Transaction Processing, online transaction process) \olap (Online Analytical Processing, online analysis processing) model related task, computing resources required by full-speed execution of the task need to be allocated to the foreground task, for example, if the foreground task needs to use 4G cache resources, 1G video memory resources, 10 CPU (central processing unit ) process resources and other computing resources to implement full-speed execution, computing resources with corresponding quota are allocated to the foreground task so that the foreground task can be executed at full speed, and the user experience is ensured.
S12: determining the preset influence degree of each background task currently being executed on a foreground task;
In consideration of the fact that the degrees of influence of different background tasks on foreground tasks are different, in the method, the preset influence degree of each background task on the foreground task can be preset, and the larger the preset influence degree is, the larger the influence of the corresponding background task on the execution speed of the foreground task is, for example, the larger the preset influence degree of some background tasks which can be executed at full speed only by using more computing resources is, because the background tasks use more computing resources, the fact that the computing resources which can be used by the foreground tasks are insufficient can be caused if the background tasks are not controlled is explained.
S13: determining control factors of the background tasks according to the preset task priority and the preset influence degree of the background tasks;
Considering that different background tasks have different priorities, for example, the priorities of the background tasks of a control function of an equipment foundation, the background tasks of each hardware firmware and other tasks are higher than the priorities of the background tasks of entertainment software, in the application, the task priorities of each background task can be preset, then the control factors of the background tasks are determined according to the preset task priorities and the preset influence degrees, the size of the control factors can show the influence degrees of the background tasks on the foreground tasks and whether the control factors are important or not, for example, the control factors can be set to be larger as the influence degrees of the background tasks on the foreground tasks are larger; the lower the task priority of the background task, the greater the control factor.
S14: judging whether the sum of the number of computing resources used by the foreground tasks and the sum of the number of computing resources used by all the background tasks is smaller than a preset sum;
Since the total amount of computing resources is limited, the more computing resources that are used in total by all tasks, the more likely various problems will occur, such as the device heating, the task execution speed decreasing, and the memory overflow, in order to reasonably control the usage amount of computing resources, in the present application, a sum of numbers may be preset, for example, the sum of numbers may be a computing resource threshold value indicating when the device has the above problem, or may be a percentage representing the total usage amount of computing resources that are used in total by all tasks, when the sum of numbers representing the total usage amount of computing resources that are used in total by all tasks is a percentage representing the total usage amount of computing resources that are used by all tasks, if the sum of numbers of computing resources that are used by a front-end task and the sum of numbers that are used by all back-end tasks is smaller than the sum of numbers that are preset, if the sum of numbers that are not smaller than the sum of numbers, the total usage amount of computing resources that are used by all tasks may be indicated as excessive, and in order to avoid the various problems described above, the total usage amount of computing resources that are used by all tasks that are allocated to each back-end task may be reduced. For example, the preset number and the sum may be defined as 60% of the total amount of the computing resources, and if the sum of the computing resources used by the foreground task and the computing resources used by all the background tasks is less than 60%, it is indicated that the computing resources are still in a receivable range at this time, and if the sum is greater than 60%, it is indicated that the computing resources are too much, and it is necessary to control the background task.
S15: and if the control factor is smaller than the preset factor, distributing computing resources required by full-speed execution of each background task for each background task of which the control factor is smaller than the preset factor.
If the sum of the number of the computing resources used by the foreground task and the sum of the number of the computing resources used by all the background tasks is smaller than the preset sum, the total usage of the computing resources used by all the tasks is within a receivable range, and in order to ensure that part of the background tasks can be successfully executed so as to further ensure the foreground task supporting capability of the equipment, in the application, the control factor is smaller than the preset factor, which means that the corresponding background task has little influence on the execution speed of the foreground task, or the task priority of the background task is higher, so that when the sum of the number is smaller than the preset sum, namely the total usage of the computing resources used by all the tasks is within the receivable range, the computing resources required by full-speed execution of each background task with the control factor smaller than the preset factor can be allocated to each background task with the control factor, and the partial background tasks can be smoothly executed so as to further ensure the foreground task supporting capability of the equipment.
It should be further noted that, in the present application, the computing resource allocation method may be applied to various processors on a device, such as an ARM (ADVANCED RISC MACHINES, advanced reduced instruction set processor), where the processors are connected to other modules in the device, please refer to fig. 2, fig. 2 is a schematic structural diagram of a storage array provided by the present application, where the processors are respectively connected to all other modules in the storage array, an OS (operating system module) provides information such as a preset task priority and a preset influence degree for the processors, a cache module provides information related to computing resources for the processors, and execution of a foreground task and a background task all require participation of the disk array module, and a user controls the processors and obtains related information through an instruction module or a wireless module via a serial port module.
In summary, when a foreground task is executed, computing resources required by full-speed execution of the foreground task are allocated to the foreground task, then the preset influence degree of each currently executing background task on the foreground task is determined, the control factors of each background task are determined according to the preset task priority and the preset influence degree of each background task, then the sum of the numbers of computing resources used by the foreground task and all the background tasks is judged to be smaller than the preset sum, and if the sum of the numbers of computing resources is smaller than the preset sum, computing resources required by full-speed execution of each background task are allocated to each background task with the control factors smaller than the preset factors. The different background tasks have different influence degrees on the foreground tasks, and the smaller the control factors are, the smaller the influence degree of the corresponding background tasks on the foreground tasks is or the higher the task priority is, so that computing resources required by full-speed execution of the background tasks with the control factors smaller than the preset factors are allocated to the background tasks, the normal execution of part of the background tasks can be ensured on the premise of ensuring that the execution speed of the foreground resources is not influenced, the overall performance of the storage array is improved, each background task can be independently controlled, the problem of blockage of the foreground tasks is avoided, and the usability of the storage array is improved.
Based on the above embodiments:
As a preferred embodiment, before determining the control factor of each background task according to the preset task priority and the preset influence degree of each background task, the method further comprises:
determining a task execution environment at the current moment, wherein the task execution environment at least comprises a common environment and a priority foreground task environment;
Determining control factors of the background tasks according to the preset task priority and the preset influence degree of the background tasks, wherein the control factors comprise:
and determining control factors of the background tasks according to the influence parameters, the preset task priorities and the preset influence degrees of the background tasks corresponding to the task execution environments.
In order to control the background task under different task execution environments, in the application, the corresponding task execution environments are established according to the user demands in consideration of different demands of different users, for example, the tasks such as video watching, webpage watching and the like are generally simpler with different computing resources required by different users and the difficulty of the foreground task executed by different users is different; and modeling, operation and other tasks are generally difficult, and more computing resources are required. Based on the method, a common environment and a priority foreground task environment can be established, under the common environment, the foreground task can be allocated with less computing resources in consideration of the fact that the foreground task needs less computing resources, so that more computing resources are reserved for the background task to use, and the overall performance of the device is improved; in the environment of the priority foreground task, more computing resources are allocated to the foreground task, so that the foreground task can be guaranteed to be executed at full speed under any condition. In different task execution environments, since the total amount of usable computing resources of all the background tasks is different, in order to control the background tasks according to the actual amount of usable computing resources, the influence parameters of the background tasks in different task execution environments are set for each background task. For example, the influence parameters may be execution weights of the background tasks, and when determining the control factor, in addition to the preset influence degree of the background task on the foreground task and the preset task priority thereof, the influence parameters of the background task in the current task execution environment need to be considered, so that the background task can be flexibly controlled in different task execution environments.
As a preferred embodiment, determining whether the sum of the number of computing resources of the foreground task and the computing resources of all the background tasks is less than a preset sum of numbers includes:
judging whether the sum of the computing resources of the foreground task and the computing resources of all the background tasks is smaller than the corresponding preset sum of task execution environments or not;
if the number sum is smaller than the preset number sum corresponding to the task execution environment, judging that the number sum is smaller than the preset number sum;
And if the number sum is not smaller than the preset number sum corresponding to the task execution environment, judging that the number sum is not smaller than the preset number sum.
In order to flexibly allocate computing resources to the background task, in the application, the fact that a plurality of task execution environments exist is considered, and the allocation amount of the computing resources is different in each task execution environment, for example, in a common environment, when the foreground task is simpler, the computing resources can be used for executing at full speed, so the amount of the computing resources allocated to the foreground task is less; in the environment of the priority foreground task, the foreground task needs to be guaranteed to execute at full speed under various conditions, so that more computing resources are allocated to the foreground task. Based on this, it is known that, when the foreground task and the background task to be executed are unchanged, if the normal environment is switched to the priority foreground task environment, the amount of the computing resources used by the background task is unchanged, but the amount of the computing resources used by the foreground task is increased, so that the sum of the computing resources of the foreground task and the computing resources of all the background tasks is increased, and therefore, different preset amounts and sums are set for different task execution environments. For example, in a common environment, the preset number sum is 60% of the total amount of computing resources, and since the foreground task uses fewer computing resources, the preset number sum can be set to be fewer to prevent the background task from using excessive computing resources; in the context of the prioritized foreground tasks, the sum of the preset numbers may be 70% of the total amount of computing resources, based on which computing resources may be flexibly allocated to each background task according to the preset number of sums.
As a preferred embodiment, further comprising:
And if the sum of the numbers is not smaller than the preset sum, distributing computing resources of preset quota corresponding to each background task for each background task.
In order to ensure that the foreground task can be executed at full speed under the condition of high load, in the application, when the sum of the computing resources of the current foreground task and the computing resources of all the background tasks is not less than the sum of the preset number, the fact that the quantity of the computing resources used by all the tasks is excessive at the moment is indicated, various problems such as equipment heating, task execution speed reduction, memory overflow and the like are easily caused, and at the moment, the execution speed of the foreground task is also easily influenced, so that the foreground task cannot be executed at full speed. Therefore, in order to ensure that the foreground task can execute at full speed, the computing resources allocated to the background task can be reduced, namely, corresponding computing resources are allocated to each background task according to the limit preset for each background task, so that the purpose of reducing the total amount of computing resources used by all the tasks is realized, and the foreground task can execute at full speed.
As a preferred embodiment, after allocating computing resources required for full-speed execution of the foreground task to the foreground task, the method further comprises:
judging whether the data interaction speed between the foreground task and the storage module is smaller than a preset speed or not;
If the speed is smaller than the preset speed, generating alarm information.
In the application, in order to enable a user to perceive the situation, whether the data interaction speed between the foreground task and the storage module is smaller than the preset speed is judged, because the data in the storage module is usually required to be called for use by the foreground task when the user executes various foreground tasks, namely, the data interaction speed between the foreground task and the storage module is included in the foreground task, for example, the data interaction speed can be the data landing speed of the data in the participation of the cache module, the preset speed can be 70% of the fastest execution speed of the foreground task, and when the data landing speed is detected to be smaller than the preset speed, namely, lower than 70% of the fastest speed, alarm information is generated so as to prompt the user that the execution speed of the foreground task is too slow.
As a preferred embodiment, the background task includes each background task body and a preset background task group formed by a plurality of background task bodies;
allocating computing resources required by full-speed execution of each background task for each background task with a control factor less than a preset factor, including:
and distributing computing resources required by full-speed execution of each background task body for each background task body with the control factor smaller than the preset factor and all the background task bodies in each preset background task group.
In order to more accurately allocate computing resources to each background task, in the application, considering that besides the influence of a background task body on a foreground task, a task group formed by a plurality of background tasks may have additional influence on the foreground task, for example, the influence of an A background task on the foreground task is larger, the influence of a B background task on the foreground task is smaller, but the influence of the B background task on the A background task is larger, and therefore, the influence of the B background task on the foreground task cannot be considered, and the influence of the B background task on the A background task needs to be considered, when computing resources are allocated to the background task, if the tasks in a certain preset background task group are all executing, the whole preset background task group needs to be allocated, otherwise, each background task is independently allocated, so that computing resources are more accurately allocated to each background task.
As a preferred embodiment, determining the control factor of each background task according to the preset task priority and the preset influence degree of each background task includes:
Determining preset task priorities of all background tasks and preset first weights corresponding to the preset task priorities;
determining a preset second weight corresponding to the preset influence degree of each background task;
For any background task, the sum of the product between the priority of the preset task and the preset first weight and the product between the preset influence degree and the second weight is determined and used as a control factor of the background task.
In order to accurately determine the control factors of the background tasks, the preset task priority and the preset influence degree of the background tasks are weighted correspondingly, so that the control factors of the background tasks are determined according to actual working conditions. For example, in a default situation, the preset first weight and the preset second weight may be set to be 50%, that is, in a default situation, the influence of the preset task priority and the preset influence degree on the control factor is consistent; if the background task with high priority of the preset task needs to be normally executed to ensure the supporting capability of the equipment, the preset first weight can be set to be larger, for example, 75%, and the preset second weight can be set to be smaller, for example, 25%, so that the background task with high priority of the preset task can be smoothly executed; if the foreground task needs to be guaranteed to be capable of executing at full speed, the preset first weight can be set to be smaller, for example, 25%, and the preset second weight can be set to be larger, for example, 75%, so that the background task with large preset influence degree is limited, the foreground task is guaranteed to be capable of executing at full speed, and based on the control factors of the background tasks can be accurately determined.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a computing resource allocation device according to the present application, including:
a memory 21 for storing a computer program;
a processor 22 for implementing the steps of the computing resource allocation method as described above when executing a computer program.
For a detailed description of a computing resource allocation apparatus provided in the present application, please refer to an embodiment of a computing resource allocation method described above, and the detailed description thereof is omitted herein.
Referring to fig. 4, fig. 4 is a schematic structural diagram of another storage array according to the present application, which includes a storage array body 31 and the above-mentioned computing resource allocation device 32;
The storage array body 31 is connected to a computing resource allocation device 32.
For a detailed description of a memory array provided in the present application, please refer to the above-mentioned embodiment of the computing resource allocation method, and the detailed description thereof is omitted herein.
The present application also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of the computing resource allocation method when being executed by a processor.
For a detailed description of a computer-readable storage medium, please refer to the above-mentioned embodiments of the computing resource allocation method, and the detailed description is omitted herein.
In the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.