Summary of the invention
In view of this, the object of the present invention is to provide a kind of expansion method of cloud computing, the method can reduce scheduling of resource granularity, reduces the wasting of resources.
For achieving the above object, technical scheme provided by the invention is:
An expansion method for cloud computing, the computational resource of described cloud computing is by graduation to multiple computing unit, and the computational resource of each computing unit is less than the computational resource that virtual machine takies; The method comprises:
Each computational resource utilization rate being applied in top n time point in the cloud platform of sampling cloud computing place;
Take time as abscissa, computational resource utilization rate is ordinate, calculate the slope of the straight line of the N number of coordinate points matching be made up of described N number of time point and this computational resource utilization rate being applied in described N number of time point and cut a square;
The computational resource utilization rate that this is applied in N+1 time point is calculated according to described slope and intercept, if this computational resource utilization rate being applied in N+1 time point is greater than the first predetermined threshold value, then determine according to described first predetermined threshold value, this computational resource utilization rate being applied in N+1 time point the computing unit number needing dilatation;
The computing unit number of dilatation carries out dilatation to this application as required.
A flash chamber for cloud computing, the computational resource of described cloud computing is by graduation to multiple computing unit, and the computational resource of each computing unit is less than the computational resource that virtual machine takies; This device comprises: sampling unit, fitting unit, computing unit, dilatation unit;
Described sampling unit, for each computational resource utilization rate being applied in top n time point in described cloud computing place cloud platform of sampling;
Described fitting unit, for take time as abscissa, computational resource utilization rate is ordinate, calculate the slope of the straight line of the N number of coordinate points matching be made up of described N number of time point and this computational resource utilization rate being applied in described N number of time point and cut a square;
Described computing unit, for calculating according to described slope and intercept the computational resource utilization rate that this is applied in N+1 time point, if this computational resource utilization rate being applied in N+1 time point is greater than the first predetermined threshold value, then determine according to described first predetermined threshold value, this computational resource utilization rate being applied in N+1 time point the computing unit number needing dilatation;
Described dilatation unit, the computing unit number for dilatation as required carries out dilatation to this application.
In sum, the present invention passes through the computational resource graduation of cloud computing to multiple computing unit, and determine that this is applied in the computational resource utilization rate of N+1 time point according to a certain computational resource utilization rate being applied in top n time point obtained of sampling, when this is applied in that the computational resource utilization rate of N+1 time point is too high needs dilatation, be that basic dilatation unit carries out dilatation with computing unit.The computational resource had due to computing unit is less, thus can reduce scheduling of resource granularity, reduces the wasting of resources.
Embodiment
For making object of the present invention, technical scheme and advantage clearly understand, to develop simultaneously embodiment referring to accompanying drawing, scheme of the present invention is described in further detail.
In the embodiment of the present invention, in order to reduce scheduling of resource granularity, reduce the wasting of resources, by the computational resource graduation of cloud computing to multiple computing unit, the computational resource that each computing unit has is less than computational resource that virtual machine takies (computational resource that virtual machine takies for: the summation of the computational resource needed for the computational resource for application all in virtual machine of virtual machine configuration and virtual machine self-operating).When transporting a certain application calculated on the cloud platform of place and needing dilatation, be that basic dilatation unit carries out dilatation with computing unit, compare relative to the automatic capacity-enlargement technology of Amazon being basic dilatation unit with virtual machine of the prior art, because the resource transfer granularity of computing unit is less, thus the wasting of resources can be reduced.
The number of the computational resource that above-mentioned computing unit has can preset, such as be less than the computational resource that virtual machine self-operating needs take, after setting computational resource that a computing unit has and be how many, just can determine to determine how many computing units can be divided, such as, suppose that the computational resource of cloud computing is 10, the computational resource that each computing unit has is set as 2, then can by the computational resource graduation of cloud computing to (computational resource that computational resource/each computing unit of computing unit number=cloud computing has) in 5 computing units.
See the expansion method flow chart that Fig. 1, Fig. 1 are embodiment of the present invention cloud computings, wherein, the computational resource of cloud computing by graduation to multiple computing unit, the computational resource that each computing unit has is less than the computational resource of virtual machine, and as shown in Figure 1, the method mainly comprises the following steps:
Each computational resource utilization rate being applied in top n time point in step 101, sampling cloud computing place cloud platform.
Every one section of Preset Time, to the computational resource utilization rate of this application, sampling should be carried out, finally can obtain the computational resource utilization rate that this is applied in the 1st time point, the 2nd time point ... and N number of time point.
Step 102, be abscissa with time, computational resource utilization rate is ordinate, calculate the slope of the straight line of the N number of coordinate points matching be made up of described N number of time point and this computational resource utilization rate being applied in described N number of time point and cut a square.
In the present embodiment, when with time be abscissa, computational resource utilization rate for ordinate time, the computational resource utilization rate of top n time point can be applied according to this sampling, obtain (T
1, C
1), (T
2, C
2) ..., (T
i, C
i) ..., (T
n, C
n) be total to N number of coordinate points, wherein, T
irepresent i-th time point in top n time point, C
irepresent that this is applied in time point T
icomputational resource utilization rate.
Sampling obtains after this is applied in the computational resource utilization rate of top n time point, in order to predict the computational resource utilization rate of this N+1 time, straight line can be simulated according to above-mentioned N number of coordinate points, and calculate slope and the intercept of this straight line, predict that this is applied in the computational resource utilization rate of N+1 time point according to the slope of this straight line and intercept.
Wherein, the slope calculating the straight line of the N number of coordinate points matching be made up of top n time point and this computational resource utilization rate being applied in top n time point is as follows with the method for cutting square:
First calculate the mean value Tavg of top n time point, and this is applied in the mean value Cavg of the computational resource utilization rate of top n time point;
Then slope k described in following formulae discovery is adopted:
Wherein, i=1,2 ..., N;
Finally adopt intercept b described in following formulae discovery:
b=Cavg-k×Tavg。
Step 103, calculate according to described slope and intercept the computational resource utilization rate that this is applied in N+1 time point, if this computational resource utilization rate being applied in N+1 time point is greater than the first predetermined threshold value, then determine to need the computing unit number of dilatation according to described first predetermined threshold value, this computational resource utilization rate being applied in N number of time point and N+1 time point.
Calculate the straight line of the N number of coordinate points matching be made up of top n time point and this computational resource utilization rate being applied in top n time point slope and after cutting square, can calculate according to described slope and intercept the computational resource utilization rate that this is applied in N+1 time point, concrete grammar is for adopting following formula:
C
n+1=k × T
n+1+ b, wherein, T
n+1represent N+1 time point, C
n+1represent that this is applied in the computational resource utilization rate of N+1 time point, k is the slope of straight line described in step 102, and b is the intercept of straight line described in step 102.
In actual applications, when the computational resource utilization rate of this application is too high, just need to carry out dilatation, for this reason, a threshold value (being assumed to be the first predetermined threshold value Co) can be preset, when then only having computational resource utilization rate to N+1 time point higher than this first predetermined threshold value, just need to calculate the computing unit number needing dilatation.
Can determine to need according to described first predetermined threshold value, this computational resource utilization rate being applied in N number of time point and N+1 time point the computing unit number of dilatation, concrete grammar is for adopting following formula:
Wherein, U is the computing unit number needing dilatation; Cb is the second predetermined threshold value, represents the optimal computed resource utilization of this application, can rule of thumb preset; Num represents the current computing unit number taken of this application.
The computing unit number of step 104, as required dilatation carries out dilatation to this application.
After calculating this application and needing the computing unit number of dilatation, just can perform dilatation to this application according to the computing unit data calculated, this application can normally be run.
In the embodiment of the present invention shown in Fig. 1, described computational resource is: CPU and/or storage resources.
Above the expansion method of embodiment of the present invention cloud computing is described in detail, has present invention also offers a kind of flash chamber of cloud computing, be described below in conjunction with Fig. 2.
Be the structural representation of the flash chamber of embodiment of the present invention cloud computing see Fig. 2, Fig. 2, wherein, the computational resource of described cloud computing is by graduation to multiple computing unit, and the computational resource that each computing unit has is less than the computational resource of virtual machine; As shown in Figure 2, this device comprises: sampling unit 201, fitting unit 202, computing unit 203, dilatation unit 204; Wherein,
Sampling unit 201, for each computational resource utilization rate being applied in top n time point in described cloud computing place cloud platform of sampling;
Fitting unit 202, for take time as abscissa, computational resource utilization rate is ordinate, calculate the slope of the straight line of the N number of coordinate points matching be made up of described N number of time point and this computational resource utilization rate being applied in described N number of time point and cut a square;
Computing unit 203, for calculating according to described slope and intercept the computational resource utilization rate that this is applied in N+1 time point, if this computational resource utilization rate being applied in N+1 time point is greater than the first predetermined threshold value, then determine according to described first predetermined threshold value, this computational resource utilization rate being applied in N+1 time point the computing unit number needing dilatation;
Dilatation unit 204, the computing unit number for dilatation as required carries out dilatation to this application.
In Fig. 2 shown device, described fitting unit 202 when calculating the slope of straight line and the intercept of the N number of coordinate points matching be made up of described N number of time point and this computational resource utilization rate being applied in described N number of time point, for:
Calculate the mean value Tavg of described N number of time point, and this is applied in the mean value Cavg of the computational resource utilization rate of described N number of time point;
Adopt slope k described in following formulae discovery:
wherein, i=1,2 ..., N, T
irepresent the computational resource utilization rate of i-th time point; C
irepresent that this is applied in the computational resource utilization rate of i-th time point;
Adopt intercept b described in following formulae discovery:
b=Cavg-k×Tavg。
In Fig. 2 shown device, described computing unit 203 is calculating according to described slope and intercept the computational resource utilization rate C that this is applied in N+1 time point
n+1time, adopt following formulae discovery:
C
N+1=k×T
N+1+b。
In Fig. 2 shown device, described computing unit 203, when determining according to described first predetermined threshold value, this computational resource utilization rate being applied in N+1 time point the computing unit number U needing dilatation, adopts following formulae discovery:
wherein, Cb is the second predetermined threshold value, and Cb is less than the first predetermined threshold value; Num is the current computing unit number taken of this application.
In Fig. 2 shown device, described computational resource is: CPU and/or storage resources.
The above, be only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.