CN113568754A - Resource allocation method and device, computing equipment and storage medium - Google Patents

Resource allocation method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN113568754A
CN113568754A CN202110887072.2A CN202110887072A CN113568754A CN 113568754 A CN113568754 A CN 113568754A CN 202110887072 A CN202110887072 A CN 202110887072A CN 113568754 A CN113568754 A CN 113568754A
Authority
CN
China
Prior art keywords
computing
period
amount
resource
change rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110887072.2A
Other languages
Chinese (zh)
Inventor
梁冰
宋成伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Antiy Technology Group Co Ltd
Original Assignee
Antiy Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Antiy Technology Group Co Ltd filed Critical Antiy Technology Group Co Ltd
Priority to CN202110887072.2A priority Critical patent/CN113568754A/en
Publication of CN113568754A publication Critical patent/CN113568754A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a resource allocation method, a resource allocation device, a computing device and a storage medium, wherein the method comprises the following steps: determining a first computing resource amount actually used by a target process in a current operation period; determining the change rate of the computing resources corresponding to the target process; determining a theoretical computing resource amount required in a future target operation period based on the first computing resource amount and the computing resource change rate; and distributing the computing resources of the target process in the target operation time period according to the theoretical computing resource amount. According to the scheme, the waste of computing resources can be reduced.

Description

Resource allocation method and device, computing equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of cloud services, in particular to a resource allocation method and device, computing equipment and a storage medium.
Background
With the rapid development of big data technology, the application of the cloud computing platform is more and more extensive, a user can request to perform data processing on the cloud computing platform, the cloud computing platform creates a data processing process for the user requesting to perform the data processing, and computing resources are allocated for the data processing process.
In the prior art, a fixed resource amount threshold is usually set, and computing resources are allocated to data processing processes according to the resource amount threshold, so that the computing resources allocated to each process are not greater than the resource amount threshold, thereby preventing excessive computing resources from being allocated to a single process.
Disclosure of Invention
Based on the problem of computing resource waste caused by a resource allocation mode in the prior art, embodiments of the present invention provide a resource allocation method, apparatus, computing device, and storage medium, which can reduce the waste of computing resources.
In a first aspect, an embodiment of the present invention provides a resource allocation method, including:
determining a first computing resource amount actually used by a target process in a current operation period;
determining the change rate of the computing resources corresponding to the target process;
determining a theoretical computing resource amount required in a future target operation period based on the first computing resource amount and the computing resource change rate;
and distributing the computing resources of the target process in the target operation time period according to the theoretical computing resource amount.
Preferably, the determining a change rate of the computing resource corresponding to the target process includes:
acquiring second computing resource quantities respectively and actually used by the target process in at least one historical operating period;
calculating the computational resource change rate using at least one second amount of computational resources and the first amount of computational resources.
Preferably, the at least one historical operating period is an operating period adjacent to the current operating period.
Preferably, each of the historical operating periods and the current operating period are respectively in different operating cycles, and the positions of the operating periods in the corresponding operating cycles are the same.
Preferably, said calculating said rate of change of computing resources using said at least one second amount of computing resources and said first amount of computing resources comprises:
according to the sequence of the operation time periods, calculating by using adjacent second calculation resource quantity with set quantity to obtain a plurality of basic change rates;
and selecting from the plurality of basic change rates according to the sequence of the operation time periods, calculating an average change rate based on the selected basic change rate, and determining the average change rate as the calculation resource change rate.
Preferably, the determining the theoretical amount of computing resources required for a target operating period in the future includes:
determining a distance between the target operational period and the current operational period;
and calculating the theoretical calculation resource amount required in the target operation time period based on the first calculation resource amount, the calculation resource change rate and the distance.
Preferably, the computing resources include: at least one of CPU occupancy rate, memory occupancy, disk IO read rate and disk IO write rate.
In a second aspect, an embodiment of the present invention further provides a resource allocation apparatus, including:
the computing resource amount determining unit is used for determining a first computing resource amount actually used by the target process in the current operation time period;
the change rate determining unit is used for determining the change rate of the computing resources corresponding to the target process;
a prediction unit, configured to determine a theoretical amount of computing resources required in a future target operating period based on the first amount of computing resources and the rate of change of computing resources;
and the resource allocation unit is used for allocating the computing resources of the target process in the target running time period according to the theoretical computing resource amount.
In a third aspect, an embodiment of the present invention further provides a computing device, including a memory and a processor, where the memory stores a computer program, and the processor, when executing the computer program, implements the method described in any embodiment of this specification.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed in a computer, the computer program causes the computer to execute the method described in any embodiment of the present specification.
The embodiment of the invention provides a resource allocation method, a device, a computing device and a storage medium, wherein if the computing resource used by a target process is in an increasing or decreasing trend, the computing resource change rate of the target process can be determined, the theoretical computing resource amount required in a future operating period can be predicted by utilizing the computing resource change rate and a first computing resource amount actually used by the target process in the current operating period, and the computing resource can be allocated to the target process in the future operating period by utilizing the theoretical computing resource amount.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a resource allocation method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for determining a change rate of a computing resource according to an embodiment of the present invention;
FIG. 3 is a diagram of a hardware architecture of a computing device according to an embodiment of the present invention;
fig. 4 is a structural diagram of a resource allocation apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As previously described, by setting a fixed threshold for the amount of resources, computing resources are allocated to processes based on the threshold for the amount of resources. Given that the data processing tasks performed by different data processing processes may differ, the computing resources required by different data processing processes may also differ. In order to ensure that most data processing processes can work normally, the resource amount threshold value is generally set to a larger value, and in practical application, the resource amount of the computing resource required by some data processing processes is far smaller than the resource amount threshold value. Therefore, the computing resources are allocated to the data processing processes based on the fixed resource amount threshold, which easily causes the waste of computing resources. Based on this, it may be considered to allocate different computing resources for different processes, and since the computing resources required by the processes are not constant, the computing resources allocated to the same process in different running periods may also vary.
Specific implementations of the above concepts are described below.
Referring to fig. 1, an embodiment of the present invention provides a method for allocating resources, including:
step 100, determining a first amount of computing resources actually used by the target process in the current running period.
And 102, determining the change rate of the computing resources corresponding to the target process.
And 104, determining a theoretical computing resource amount required in a future target operation period based on the first computing resource amount and the computing resource change rate.
And 106, distributing the computing resources of the target process in the target running time period according to the theoretical computing resource amount.
In the embodiment of the invention, if the computing resource used by the target process is in an increasing or decreasing trend, the computing resource change rate of the target process can be determined, the theoretical computing resource amount required in a future operating period can be predicted by utilizing the computing resource change rate and the first computing resource amount actually used by the target process in the current operating period, and the computing resource is distributed to the target process in the future operating period by utilizing the theoretical computing resource amount.
The manner in which the various steps shown in fig. 1 are performed is described below.
First, with respect to step 100, a first amount of computing resources actually used by the target process during the current run period is determined.
In one embodiment of the invention, a run period of the target process may be one hour, one day, one week, one month, etc.
In one embodiment of the invention, the computing resources may include: at least one of CPU occupancy rate, memory occupancy, disk IO read rate and disk IO write rate.
The following describes each of the above-mentioned computing resources actually used by the target process in the current running period.
First, the computing resource is the CPU occupancy.
When the CPU occupancy rate of the target process in the current operating period is determined, if the system is a Linux system, the CPU occupancy rate may be determined according to field information in a system file. Specifically, the method comprises the following steps: determining the process number pid of the target process, then obtaining a "/proc/+ pid +/stat" file in the Linux system, and reading a time field (the time of the target process running in the user mode is in units of jiffies), a static field (the time of the target process running in the kernel mode is in units of jiffies), a time field (the accumulated time of all the waiting-for processes of the task running in the user mode is in units of jiffies) and a cstime field (the accumulated time of all the waiting-for processes of the task running in the kernel mode is in units of jiffies) in the file. The sum of the values of the four fields is determined as the CPU usage of the target process at the current time and is recorded asa1. Meanwhile, reading a user field (CPU time of a user state), a nice field (CPU time of the user state occupied by a low-priority program), a system field (CPU time of the system state) and an idle field (CPU idle time) in the/proc/stat file, determining the sum of the numerical values of the four fields as the total usage of the current system CPU, and marking the sum as A1
In order to improve the accuracy of determining the CPU occupancy rate of the target process in the current operating period, an acquisition cycle may be set in advance, for example, the acquisition cycle is 3 seconds. Every other acquisition period, the method is used for acquiring the CPU usage of the target process and the total CPU usage of the current system once, for example, the CPU usage a of the target process is acquired after the second acquisition2The total CPU usage of the current system2. Then, the CPU occupancy rate of the service process in one acquisition period can be calculated by using the following formula (1):
P1=(a2-a1)/(A2-A1) (1)
in the current operation period, the CPU occupancy of the target process may be counted n times, and then the CPU occupancy P of the target process in the current operation period may be calculated by using the following formula (2):
P=(P1+P2+P3+……+Pn)/n (2)
secondly, the computing resources are the memory occupation amount.
When the memory occupation amount of the target process in the current operation time period is determined, if the system is a Linux system, the memory occupation amount can be determined according to field information in a system file. Specifically, the method comprises the following steps: determining the process number pid of the target process, then acquiring a "/proc/+ pid +/status" file in the Linux system, reading a vmRSS field in the file, determining the value of the vmRSS field as the memory occupation amount of the target process, and recording as M1. Similarly, an acquisition cycle may be preset, for example, the acquisition cycle is 3 seconds, the memory occupation amount of the target process is acquired once every other acquisition cycle by using the above method, and n memory occupation amounts may be acquired in the current operation time periodAnd (3) the usage amount, namely calculating the memory occupation amount of the target process in the current operation time period by using the following formula:
M=(M1+M2+M3+……+Mn)/n (3)
and thirdly, calculating the resource as the disk IO read rate or the disk IO write rate.
When determining the disk IO read rate or the disk IO write rate of the target process in the current running period, if the system is a Linux system, the determination may be performed according to field information in a system file. Specifically, the method comprises the following steps: determining the process number pid of the target process, then acquiring a "/proc/+ pid +/io" file in the Linux system, reading a read _ bytes field and a write _ bytes field in the file, determining the numerical value of the read _ bytes field as the total bytes read and written by the target process, and respectively recording the numerical value as R1、W1. Similarly, an acquisition period may be preset, for example, the acquisition period is 3 seconds, the total bytes read and total bytes written of the target process are acquired once every other acquisition period in the manner described above, and after an interval of 3 seconds, the total bytes read and total bytes written of the next acquisition period are acquired continuously in the same manner, and the total bytes read and total bytes written are denoted as R2、W2. At this time, the following formula can be used to calculate the average disk IO read rate R of the target process in one acquisition period01Average disk IO write Rate W01
R01=(R2-R1)/T (4)
W01=(W2-W1)/T (5)
Where T is used to characterize the acquisition period.
In the current running period, counting n times aiming at the average disk IO read rate and the average disk IO write rate of the target process, and calculating the disk IO read rate R and the disk IO write rate W of the target process in the current running period by using the following formulas:
R=(R01+R02+R03+……+R0n)/n (6)
W=(W01+W02+W03+……+W0n)/n (7)
the amount of computing resources of each computing resource actually used by the target process in the current running period is determined above.
Then, in step 102, the change rate of the computing resource corresponding to the target process is determined.
In an embodiment of the present invention, when the amount of computing resources actually used by the target process in a period of time is in an increasing or decreasing trend, then the target process may correspond to a computing resource change rate, and in order to determine the computing resource change rate corresponding to the target process, please refer to fig. 2, this step 102 may be determined at least by one of the following manners:
step 200, obtaining second computing resource amounts actually used by the target process in at least one historical operating period respectively.
In one embodiment of the invention, at least one of the at least one historical operating period is separated from the current operating period by at least one operating period. Taking the at least one historical operating period as an operating period, and taking one operating period as one day as an example, the operating periods corresponding to the target process are respectively day 1, day 2, day 3, … …, day n-1, and day n, where day n is the current operating period, and n is an integer not less than 3, and if a second computing resource amount actually used in one historical operating period is obtained, the historical operating period may be day i, and i is not greater than (n-2).
In one embodiment of the invention, the at least one historical operating period is an operating period adjacent to the current operating period. If the amount of the computing resources actually used by the target process is in the condition of increasing or decreasing, the more the number of the historical operating periods is, the higher the prediction accuracy of the theoretical computing resource amount used by the target process in a future operating period is; if the amount of the computing resources actually used by the target process is in a constantly changing increasing or decreasing condition, the more the historical operating period and the current operating period are adjacent to each other, the higher the prediction accuracy of the theoretical computing resource amount of the future operating period is, in order to improve the prediction accuracy. Further, if the number of the historical operating periods is a set first number, for example, the first number is 10, the obtained historical operating periods may be the nth-1 day, the nth-2 day, … …, and the nth-10 day.
Considering that the amount of computing resources that may be used by the target process in the adjacent operating periods varies greatly, for example, due to the operating characteristics of the service, there may be different amounts of computing resources used by several operating periods in one operating cycle, and taking e-commerce service as an example, the amounts of computing resources used by the processes corresponding to the service are different between 0 and 8 points, between 8 and 12 points, and between 12 and 24 points in the operating period. Thus, different computing resources may be allocated for different periods of operation. Specifically, in an embodiment of the present invention, each of the historical operating periods and the current operating period are respectively in different operating cycles, and positions of the operating periods in the corresponding operating cycles are the same. Among other things, the operational characteristics may include, but are not limited to: user access volume, service pressure.
For example, one monitoring cycle is one day, the monitoring cycle is divided into a plurality of operation periods according to service operation characteristics, for example, the monitoring cycle is divided into three operation periods, namely, 0-8 points, 8-12 points and 12-24 points, taking an operation period of 8-12 points as an example, 8-12 points of the nth day are determined as the current operation period, and since the operation periods at the same position in different monitoring cycles have the same operation characteristics, the historical operation periods are all the operation periods of 8-12 points of different operation cycles, for example, the historical operation periods are 8-12 points of the nth-1 day, 8-12 points of the nth-2 day and the like.
The operation cycle is divided into a plurality of operation time intervals, and different computing resources are allocated to the target process in different operation time intervals in the same operation cycle, so that the utilization rate of the computing resources can be further improved, and the waste of the computing resources is reduced.
Step 202, calculating the calculation resource change rate by using at least one second calculation resource amount and the first calculation resource amount.
In one embodiment of the present invention, the calculating the calculation resource change rate in step 202 can be implemented at least in the following ways:
the first way is to calculate by using the first amount of computing resources and a second amount of computing resources.
And secondly, calculating the average calculation resource change rate.
And thirdly, calculating by using a second calculation resource amount corresponding to the historical operation time period adjacent to the current operation time period.
The following describes the implementation processes of the above three modes, respectively.
In the first mode, at least one operating period is separated between the historical operating period corresponding to the one second computing resource amount and the current operating period. For example, if the current operating period is the nth day or 8-12 points of the nth day, then the historical operating period is at least 8-12 points of the nth day or the nth day 2.
In the first method, the calculation resource change rate may be calculated by using the following formula:
Figure BDA0003194534470000081
wherein d isnA first amount of computing resources corresponding to the nth operating period (current operating period), djAnd a second computing resource amount corresponding to the jth operation period (historical operation period), wherein j is a positive integer not greater than (n-2), and n is an integer greater than or equal to 3.
By the method, only the second calculation resource amount of one historical operation period can be obtained, so that the second calculation resource amount is substituted into the formula to quickly calculate the change rate of the calculation resource, and the prediction speed of the theoretical calculation resource of the future operation period is improved.
For the second mode, a plurality of second computing resource amounts may be obtained, for example, the second computing resource amounts respectively corresponding to day 1, day 2, day 3, … …, and day n-1, then the second mode may calculate the average computing resource change rate by using at least the following formula, and determine the average computing resource change rate as the computing resource change rate δ of the target process:
Figure BDA0003194534470000091
wherein i is an integer of 1 or more, and n is an integer of 3 or more.
Because the amount of the computing resources actually used by the target process in each operating period is constantly changed, the average computing resource change rate is used as the computing resource change rate of the target computing, and compared with the first mode, the obtained computing resource change rate is more accurate, so that the prediction accuracy of the theoretical computing resource amount in the future operating period can be improved.
As for the third mode, this step 202 may specifically include: according to the sequence of the operation time periods, calculating by using adjacent second calculation resource quantity with set quantity to obtain a plurality of basic change rates; and selecting from the plurality of basic change rates according to the sequence of the operation time periods, calculating an average change rate based on the selected basic change rate, and determining the average change rate as the calculation resource change rate.
For example, the historical operating periods are day 1, day 2, day 3, … …, and n-1 respectively, if the set number is 3, the historical operating periods of the adjacent set number of second calculation resource amounts may be day 1, day 2, and day 3, the second calculation resource amount of the 3 days is used to calculate the basic change rate, for example, using the calculation formula in the first embodiment, the second calculation resource amount of the 3 days and the calculation resource amount of the 1 day are substituted into the calculation formula to calculate the 1 st basic change rate, the second calculation resource amount of the 4 th day and the calculation resource amount of the 2 nd day are substituted into the calculation formula to calculate the 2 nd basic change rate, … …, so that n-2 basic change rates can be obtained by using n-1 second calculation resource amounts and 1 first calculation resource amounts, then, a selection is made from n-2 basic change rates, for example, a second number of basic change rates is selected, an average change rate can be calculated by using the second number of basic change rates, and the basic change rates calculated from a second amount of computing resources close to the current operating period are preferably selected, for example, the second number is 5, then the n-2, the n-3, the n-4, the n-5, and the n-6 basic change rates are selected for calculation to obtain an average change rate, and the average change rate is determined as the computing resource change rate, so that the obtained computing resource change rate can be ensured to be more accurate.
Next, with respect to step 104, a theoretical amount of computing resources needed for a target future operational period is determined based on the first amount of computing resources and the rate of change of computing resources.
In one embodiment of the present invention, this step 104 can be determined at least by one of the following ways: determining a distance between the target operational period and the current operational period; and calculating the theoretical calculation resource amount required in the target operation time period based on the first calculation resource amount, the calculation resource change rate and the distance.
If the current operation time interval is the nth day and the target operation time interval is the (n + r) th day (wherein r is the positive whole), the distance between the target operation time interval and the current operation time interval is r; if the current operation time interval is 8-12 points of the nth day and the target operation time interval is 8-12 points of the nth + r day, the distance between the target operation time interval and the current operation time interval is still r.
In this step 104, based on the first calculation resource amount, the calculation resource change rate, and the distance, the theoretical calculation resource amount required in the target operation period may be calculated by the following formula:
dn+r=dn·(1+δ)r (10)
it should be noted that, the closer the distance between the target operation time period and the current operation time period is, the closer the determination result of the theoretical calculation resource amount required by the target process in the target operation time period is to the actual situation. Preferably, r is 1.
Finally, referring to step 106, the computing resources of the target process in the target running time period are allocated according to the theoretical computing resource amount.
In an embodiment of the present invention, when allocating computing resources to a target process, the cloud platform may directly allocate the calculated theoretical computing resource amount to the target process in the target operation period. Considering the floating condition of the computing resource used by the target process in the actual situation, the product of the sum of 1 and the floating threshold and the theoretical computing resource amount may also be determined as the computing resource amount allocated to the target process in the target running period according to a set floating threshold, for example, 10%, so as to ensure the running of the target process.
As shown in fig. 3 and 4, an embodiment of the present invention provides a resource allocation apparatus. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. From a hardware aspect, as shown in fig. 3, for a hardware architecture diagram of a computing device in which a resource allocation apparatus according to an embodiment of the present invention is located, in addition to the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 3, the computing device in which the apparatus is located in the embodiment may also generally include other hardware, such as a forwarding chip responsible for processing a packet, and the like. Taking a software implementation as an example, as shown in fig. 4, as a logical apparatus, a CPU of a computing device in which the apparatus is located reads a corresponding computer program in a non-volatile memory into a memory to run. The present embodiment provides a resource allocation apparatus, including:
a calculation resource amount determination unit 401, configured to determine a first calculation resource amount actually used by the target process in the current operation period;
a change rate determining unit 402, configured to determine a change rate of a computing resource corresponding to the target process;
a prediction unit 403, configured to determine a theoretical amount of computing resources required in a future target operating period based on the first amount of computing resources and the rate of change of computing resources;
a resource allocating unit 404, configured to allocate, according to the theoretical amount of computing resources, computing resources of the target process in the target running time period.
In an embodiment of the present invention, the change rate determining unit 402 is specifically configured to obtain second computing resource amounts that are respectively and actually used by the target process in at least one historical operating period; calculating the computational resource change rate using at least one second amount of computational resources and the first amount of computational resources.
In one embodiment of the invention, the at least one historical operating period is an operating period adjacent to the current operating period.
In an embodiment of the present invention, each of the historical operating periods and the current operating period are respectively in different operating cycles, and the positions of the operating periods in the corresponding operating cycles are the same.
In an embodiment of the present invention, when the calculating resource change rate is calculated by using at least one second calculating resource amount and the first calculating resource amount, the change rate determining unit 402 is specifically configured to calculate, according to the sequence of the operating time periods, a plurality of basic change rates by using adjacent second calculating resource amounts with a set number; and selecting from the plurality of basic change rates according to the sequence of the operation time periods, calculating an average change rate based on the selected basic change rate, and determining the average change rate as the calculation resource change rate.
In an embodiment of the present invention, the prediction unit 403 is specifically configured to determine a distance between the target operation period and the current operation period; and calculating the theoretical calculation resource amount required in the target operation time period based on the first calculation resource amount, the calculation resource change rate and the distance.
In one embodiment of the invention, the computing resources include: at least one of CPU occupancy rate, memory occupancy, disk IO read rate and disk IO write rate.
It should be understood that the illustrated structure of the embodiment of the present invention does not specifically limit a resource allocation apparatus. In other embodiments of the invention, a resource allocation apparatus may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Because the content of information interaction, execution process, and the like among the modules in the device is based on the same concept as the method embodiment of the present invention, specific content can be referred to the description in the method embodiment of the present invention, and is not described herein again.
The embodiment of the present invention further provides a computing device, which includes a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the resource allocation method in any embodiment of the present invention is implemented.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, causes the processor to execute a resource allocation method in any embodiment of the present invention.
Specifically, a system or an apparatus equipped with a storage medium on which software program codes that realize the functions of any of the above-described embodiments are stored may be provided, and a computer (or a CPU or MPU) of the system or the apparatus is caused to read out and execute the program codes stored in the storage medium.
In this case, the program code itself read from the storage medium can realize the functions of any of the above-described embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
Examples of the storage medium for supplying the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (e.g., CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD + RW), a magnetic tape, a nonvolatile memory card, and a ROM. Alternatively, the program code may be downloaded from a server computer via a communications network.
Further, it should be clear that the functions of any one of the above-described embodiments may be implemented not only by executing the program code read out by the computer, but also by causing an operating system or the like operating on the computer to perform a part or all of the actual operations based on instructions of the program code.
Further, it is to be understood that the program code read out from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then causes a CPU or the like mounted on the expansion board or the expansion module to perform part or all of the actual operations based on instructions of the program code, thereby realizing the functions of any of the above-described embodiments.
The embodiments of the invention have at least the following beneficial effects:
1. in an embodiment of the present invention, if the computing resource used by the target process is in an increasing or decreasing trend, the computing resource change rate of the target process may be determined, and the theoretical computing resource amount required in a future operating period may be predicted by using the computing resource change rate and the first computing resource amount actually used by the target process in the current operating period, and the computing resource may be allocated to the target process in the future operating period by using the theoretical computing resource amount.
2. In an embodiment of the present invention, when the operating system is a Linux system, the amount of computing resources actually used by the target process in each running period may be obtained by reading corresponding field information in a system file in the Linux system. The calculation resource amount is obtained in a system file reading mode, so that the calculation resource amount is convenient to obtain and is more accurate.
3. In an embodiment of the present invention, if the amount of the computing resource actually used by the target process is in an increasing or decreasing condition, the more the number of the historical operating periods is, the higher the prediction accuracy of the theoretical computing resource amount used by the target process in a future operating period is; if the amount of the computing resources actually used by the target process is in a constantly changing increasing or decreasing condition, the more the historical operating period and the current operating period are adjacent to each other, the higher the prediction accuracy of the theoretical computing resource amount of the future operating period is, in order to improve the prediction accuracy.
4. In one embodiment of the present invention, the operation cycle is divided into a plurality of operation periods, and different operation periods in the same operation cycle allocate different computing resources to the target process, so that the utilization rate of the computing resources can be further improved, and the waste of the computing resources can be reduced.
5. In one embodiment of the invention, the second calculation resource amount of one historical operation period is obtained by a mode, so that the change rate of the calculation resources can be quickly calculated by substituting the formula, and the prediction speed of the theoretical calculation resources in the future operation period is improved.
6. In an embodiment of the present invention, since the amount of the computing resource actually used by the target process in each operating period is constantly changing, the average computing resource change rate is used as the computing resource change rate of the target computing, and compared to the first method, the obtained computing resource change rate is more accurate, so that the accuracy of predicting the theoretical computing resource amount in the future operating period can be improved.
7. In an embodiment of the present invention, the closer the distance between the target running period and the current running period is, the closer the determination result of the theoretical calculation resource amount required by the target process in the target running period is to the actual situation, so that preferably, r is 1, and each running period determines the theoretical calculation resource amount in the next running period, thereby ensuring that each running period can be allocated with more appropriate calculation resources, and further reducing the waste of calculation resources.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an …" does not exclude the presence of other similar elements in a process, method, article, or apparatus that comprises the element.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for resource allocation, comprising:
determining a first computing resource amount actually used by a target process in a current operation period;
determining the change rate of the computing resources corresponding to the target process;
determining a theoretical computing resource amount required in a future target operation period based on the first computing resource amount and the computing resource change rate;
and distributing the computing resources of the target process in the target operation time period according to the theoretical computing resource amount.
2. The method of claim 1, wherein the determining the rate of change of the computing resource corresponding to the target process comprises:
acquiring second computing resource quantities respectively and actually used by the target process in at least one historical operating period;
calculating the computational resource change rate using at least one second amount of computational resources and the first amount of computational resources.
3. The method of claim 2, wherein the at least one historical period of operation is a period of operation proximate to the current period of operation.
4. The method of claim 2, wherein each of the historical operating periods and the current operating period are in different operating cycles, and the operating periods are located at the same position in the corresponding operating cycles.
5. The method of claim 2, wherein said calculating the rate of change of computing resources using the at least one second amount of computing resources and the first amount of computing resources comprises:
according to the sequence of the operation time periods, calculating by using adjacent second calculation resource quantity with set quantity to obtain a plurality of basic change rates;
and selecting from the plurality of basic change rates according to the sequence of the operation time periods, calculating an average change rate based on the selected basic change rate, and determining the average change rate as the calculation resource change rate.
6. The method of claim 1, wherein determining the theoretical amount of computing resources required for a future target operating period comprises:
determining a distance between the target operational period and the current operational period;
and calculating the theoretical calculation resource amount required in the target operation time period based on the first calculation resource amount, the calculation resource change rate and the distance.
7. The method of any of claims 1-6, wherein the computing resources comprise: at least one of CPU occupancy rate, memory occupancy, disk IO read rate and disk IO write rate.
8. A resource allocation apparatus, comprising:
the computing resource amount determining unit is used for determining a first computing resource amount actually used by the target process in the current operation time period;
the change rate determining unit is used for determining the change rate of the computing resources corresponding to the target process;
a prediction unit, configured to determine a theoretical amount of computing resources required in a future target operating period based on the first amount of computing resources and the rate of change of computing resources;
and the resource allocation unit is used for allocating the computing resources of the target process in the target running time period according to the theoretical computing resource amount.
9. A computing device comprising a memory having stored therein a computer program and a processor that, when executing the computer program, implements the method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when executed in a computer, causes the computer to carry out the method of any one of claims 1-7.
CN202110887072.2A 2021-08-03 2021-08-03 Resource allocation method and device, computing equipment and storage medium Pending CN113568754A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110887072.2A CN113568754A (en) 2021-08-03 2021-08-03 Resource allocation method and device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110887072.2A CN113568754A (en) 2021-08-03 2021-08-03 Resource allocation method and device, computing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113568754A true CN113568754A (en) 2021-10-29

Family

ID=78170096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110887072.2A Pending CN113568754A (en) 2021-08-03 2021-08-03 Resource allocation method and device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113568754A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090271A (en) * 2022-01-24 2022-02-25 中诚华隆计算机技术有限公司 Cloud computing resource allocation method and device, computing equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209967A (en) * 2016-06-16 2016-12-07 北京邮电大学 A kind of video monitoring cloud resource prediction method and system
CN112860403A (en) * 2021-02-22 2021-05-28 中国联合网络通信集团有限公司 Cluster load resource scheduling method, device, equipment, medium and product

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209967A (en) * 2016-06-16 2016-12-07 北京邮电大学 A kind of video monitoring cloud resource prediction method and system
CN112860403A (en) * 2021-02-22 2021-05-28 中国联合网络通信集团有限公司 Cluster load resource scheduling method, device, equipment, medium and product

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张春田: "《现代企业统计》", 哈尔滨:哈尔滨船舶工程学院出版社, pages: 116 - 122 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090271A (en) * 2022-01-24 2022-02-25 中诚华隆计算机技术有限公司 Cloud computing resource allocation method and device, computing equipment and storage medium

Similar Documents

Publication Publication Date Title
JP6240309B2 (en) Method and device for scheduling I / O ports of virtual disks
US5487168A (en) Method and system for global optimization of device allocation
JP5068099B2 (en) Method and system for performing fair share scheduling based on resource usage of individual users and tracking of the usage
US9021200B1 (en) Data storage system with predictive management of physical storage use by virtual disks
CN100538661C (en) The method and apparatus of memory allocation in the multinode computer
US9600343B2 (en) System and method for analyzing computing system resources
CN114090271B (en) Cloud computing resource allocation method and device, computing equipment and storage medium
US10754551B2 (en) Workload-aware storage-allocation system
CN108243032B (en) Method, device and equipment for acquiring service level information
FR3091769A1 (en) A method and system for managing computing resources of a cloud computing platform
CN108459905B (en) Resource pool capacity planning method and server
CN114265679A (en) Data processing method and device and server
CN113946552A (en) Data processing method and electronic device
CN113568754A (en) Resource allocation method and device, computing equipment and storage medium
CN108228679B (en) Time series data metering method and time series data metering device
CN110020954B (en) Revenue distribution method and device and computer equipment
IL301738A (en) Predictive block storage size provisioning for cloud storage volumes
CN108536759B (en) Sample playback data access method and device
US10230664B1 (en) Strategic resource allocation in a web-based computing system
CN111047435A (en) Credit data processing method, credit allocation method, credit data processing device, credit allocation device and electronic equipment
CN110928649A (en) Resource scheduling method and device
CN113468398A (en) Book level determination method, computing device and computer storage medium
CN113626162A (en) Data center task hybrid deployment method and system based on dynamic resource sharing
CN113468442A (en) Resource bit flow distribution method, computing device and computer storage medium
CN113568822B (en) Service resource monitoring method, device, computing equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination