A resource allocation method and apparatus
By dividing time periods based on historical data in the historical cycle and adjusting the resource allocation algorithm, the problem of inflexible and high cost in the existing technology is solved, and more flexible and efficient resource allocation is achieved.
Patent Information
- Application Number
- CN201910301219.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-15
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2039-04-15
AI Technical Summary
In the prior art, resource allocation is not flexible enough, and the cost of computing how to allocate resources is high, resulting in resource waste and low efficiency.
By dividing time periods based on historical data in the historical cycle and adjusting the resource allocation algorithm according to the classification of these time periods, more flexible and efficient resource allocation is achieved.
It realizes flexible adjustment of resource allocation algorithm, reduces the cost of adjusting resource allocation algorithm, and avoids the problems of waste of resources and low efficiency.
Smart Images

Figure CN110084496B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular, to a resource allocation method and apparatus. Background Art
[0002] Resources generally refer to the general term of various material elements such as material resources, financial resources, and human resources owned by a country or a certain region. Reasonable resource allocation not only means a reduction in resource waste but also means an improvement in efficiency. For example, for cloud computing, its computing resources can be used for big data processing, etc. However, the computing resources are limited. Therefore, it is very necessary to reasonably allocate these computing resources to maximize the benefits.
[0003] In the prior art, usually according to a resource allocation algorithm, it is determined how to allocate resources. Among them, the resource allocation algorithm is generally set manually according to experience. For example, by investigating the variation law between resource consumption and work efficiency, and setting the resource allocation algorithm manually according to this variation law. Or, by monitoring the demands of each resource requester, through a preset algorithm, the resource allocation algorithm is calculated and adjusted in real time. Among them, the monitored demands can be the amount of resources applied for by each resource requester, or the usage efficiency of each requester for resources, etc.
[0004] However, the resource allocation algorithm set according to experience is not flexible enough and not accurate enough, resulting in problems of waste and low efficiency still existing in resource allocation. And through the method of real-time calculation by the algorithm, if there are many resource requesters, it will lead to a situation where the cost of calculating how to allocate resources is not worth the gain.
[0005] Therefore, the present application provides a new resource allocation method and apparatus to solve the problems existing in the prior art. Summary of the Invention
[0006] Embodiments of this specification provide a resource allocation method and apparatus for solving the problems of inflexible resource allocation and high cost in calculating how to allocate resources in the prior art.
[0007] Embodiments of this specification adopt the following technical solutions:
[0008] A resource allocation method provided in this specification, where a historical period includes at least two time periods, and the method includes:
[0009] Dividing the time periods of a second historical period according to the historical data of a specified time period in a first historical period, where the first historical period is earlier than the second historical period;
[0010] Determining the classification to which each of the divided time periods in the second historical period belongs according to the historical data of the second historical period;
[0011] Adjust the resource allocation algorithm corresponding to the time period of at least one classification according to the classification described in each time period divided in the second historical period;
[0012] Perform resource allocation according to the adjusted resource allocation algorithm.
[0013] Optionally, divide the time period of the second historical period according to the historical data of the specified time period in the first historical period, specifically including:
[0014] Determine the type of business pressure in each time period of the first historical period;
[0015] Determine the median and standard deviation of the business pressure characterization values of the time periods of the specified business pressure type in the first historical period according to the business pressure characterization values of the time periods of the specified business pressure type in the first historical period;
[0016] Divide the time period of the second historical period according to the median and standard deviation of the business pressure characterization values.
[0017] Optionally, the types of business pressure include at least: peak type and off-peak type;
[0018] The specified business pressure type includes the off-peak type.
[0019] Optionally, divide the time period of the second historical period according to the median and standard deviation of the business pressure characterization values, specifically including:
[0020] Determine the start time and end time of each busy time type period in the second historical period according to the business pressure characterization value at each moment in the second historical period and the median and standard deviation of the business pressure characterization values of the time periods of the idle time type in the first historical period;
[0021] Divide the time period of the second historical period according to the start time and end time of each busy time type period in the second historical period.
[0022] Optionally, the historical period consists of at least two unit periods, and each unit period contains the same number of time periods. For each unit period, the identifiers of the time periods in this unit period are different.
[0023] Optionally, determine the classification to which each time period belongs after division in the second historical period according to the historical data of the second historical period, specifically including:
[0024] For each identifier, determine the median of the business evaluation values corresponding to this identifier according to the business evaluation values of the time periods corresponding to this identifier in the second historical period;
[0025] Determine the median and standard deviation of the business evaluation values of the unit cycles in the second historical period based on the business evaluation values of each unit cycle in the second historical period;
[0026] For each identifier, determine the category to which the time period corresponding to the identifier after division belongs according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit cycles in the second historical period, and the standard deviation.
[0027] Optionally, determining the category to which the time period corresponding to the identifier after division belongs according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit cycles in the second historical period, and the standard deviation specifically includes:
[0028] According to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit cycles in the second historical period, and the standard deviation, determine that the category to which the time period with the lowest business evaluation value belongs among the time periods corresponding to each identifier is the tail type;
[0029] According to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit cycles in the second historical period, and the standard deviation, determine that the category to which the time period with the highest business evaluation value belongs among the time periods corresponding to each identifier is the head type;
[0030] Determine that the category to which the time periods corresponding to other identifiers belong is the middle type.
[0031] Optionally, according to the categories to which the time periods divided in the second historical period belong, adjust the resource allocation algorithms corresponding to the time periods of at least one category, specifically including:
[0032] Adjust the resource allocation algorithm for the time period whose category is the tail type;
[0033] Keep the resource allocation algorithm for the time period whose category is the middle type unchanged;
[0034] Adjust the resource allocation algorithm for the time period whose category is the head type according to the resource allocation algorithm for the time period of the middle type and the adjusted resource allocation algorithm for the time period of the tail type.
[0035] Optionally, adjusting the resource allocation algorithm for the time period whose category is the head type according to the resource allocation algorithm for the time period of the middle type and the adjusted resource allocation algorithm for the time period of the tail type specifically includes:
[0036] Determine the resource consumption of the time period of the tail type according to the adjusted resource allocation algorithm for the time period of the tail type;
[0037] Determine the resource consumption of the time periods of the middle type according to the resource allocation algorithm for the time periods of the middle type;
[0038] Determine the remaining available resources according to the total available resources within a unit period and the resource consumptions of the time periods of the tail type and the middle type determined respectively;
[0039] Determine the resource allocation algorithm for the time periods of the head type in a unit period according to the remaining available resources;
[0040] Optionally, perform resource allocation according to the adjusted resource allocation algorithm, specifically including:
[0041] Perform resource allocation for each time period in subsequent unit periods according to the adjusted resource allocation algorithm.
[0042] A resource allocation device provided in this specification, where the historical period includes at least two time periods, and the device includes:
[0043] A time period division module that divides the time periods of the second historical period according to the historical data of the specified time period in the first historical period, where the first historical period is earlier than the second historical period;
[0044] A determination module that determines the classification to which each divided time period in the second historical period belongs according to the historical data of the second historical period;
[0045] An adjustment module that adjusts the resource allocation algorithm corresponding to the time periods of at least one classification type according to the classification to which each divided time period in the second historical period belongs;
[0046] An allocation module that performs resource allocation according to the adjusted resource allocation algorithm.
[0047] A computer-readable storage medium provided in this specification, characterized in that the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned resource allocation method is implemented.
[0048] An electronic device provided in this specification, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, the above-mentioned resource allocation method is implemented.
[0049] At least one of the above-mentioned technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0050] In the case where the historical cycle includes at least two time periods, based on the second historical cycle, the time periods in the second historical cycle are adjusted (i.e., divided) by the historical data in a historical cycle earlier than the second historical cycle (i.e., the first historical cycle). After dividing the time periods, the classification to which each divided time period belongs is re-determined according to the historical data of the second historical cycle itself. Based on the classification to which each re-determined time period belongs, the resource allocation algorithm corresponding to the time periods of at least one classification is adjusted according to the classification type. Since the resource allocation algorithm corresponds to the time period, even if the resource allocation algorithm is adjusted, the cost required for its calculation process is lower than real-time calculation, and the cost of adjusting the resource allocation algorithm can be reduced. And the resource allocation algorithm can be continuously adjusted, so it is more flexible than the resource allocation algorithm set manually. A good balance is achieved between flexible adjustment and cost, avoiding the defects of the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0052] Figure 1 A resource allocation process provided by an embodiment of this specification;
[0053] Figure 2 A schematic diagram of the historical cycle, unit cycle, and time period provided by this specification;
[0054] Figure 3 A schematic diagram of the change in resource consumption within a certain unit cycle;
[0055] Figure 4 A schematic diagram of the time period identifier provided by this specification;
[0056] Figure 5 A schematic diagram of dividing time periods provided by an embodiment of this specification;
[0057] Figure 6 A schematic diagram of computing power adjustment provided by this specification;
[0058] Figure 7 A schematic structural diagram of a resource allocation device provided by an embodiment of this specification;
[0059] Figure 8 Corresponding to an embodiment of this specification Figure 1 Schematic diagram of an electronic device. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0060] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0061] The following will, in conjunction with the drawings, elaborate on the technical solutions provided by each embodiment of this application.
[0062] Figure 1 For a resource allocation process provided in an embodiment of this specification, currently, common resource allocation processes are executed by a server. Thus, in the embodiments of this specification Figure 1 for the resource allocation process, the server can also execute this resource allocation process. The server can be a single device or a system composed of multiple devices (such as a distributed system), and this specification does not limit this.
[0063] In addition, in this specification, the server can determine a number of historical periods, unit periods, and time periods, and each historical period contains at least two time periods, such as Figure 2 shown.
[0064] Figure 2 is a schematic diagram of the historical period, unit period, and time period provided in this specification. Among them, the arrow line represents the time line. Each historical period contains at least two unit periods, and the number of time periods included in each unit period is the same. Figure 2 The number of unit periods included in each historical period in [figure] is 9. Of course, the number of unit periods included in each historical period may not be exactly the same. That is to say, the duration corresponding to each historical period may not be exactly the same, but the duration corresponding to each unit period is the same, and the number of time periods corresponding to each unit period is the same. Moreover, the server can pre-divide the time periods in each unit period, including: the start time, end time, and identification of each time period. In Figure 2 the time periods are sequentially identified as 1 to 6.
[0065] Furthermore, in this specification, the server can determine the time periods in the first and second historical periods according to a preset division rule. Specifically, the server can determine the time periods of each unit period for each unit period. Thus, in the first historical period and the second historical period, the division of time periods in each unit period is the same. Among them, the preset division rule can be set as needed, and the specific content of this division rule is not limited in this specification.
[0066] For example, assume the division rule is as follows: the historical period is 1 year, the unit period is 1 week, and each unit period is divided into several time slots with each time slot being 24 hours. Then, each historical period contains 52 unit periods, and each unit period is divided into 7 time slots according to the number of days. Or, assume the division rule is that the historical period is 1 month, the unit period is 1 day, and each unit period is divided into 6 time slots as shown in Table 1. Then, each historical period is divided into 28 to 31 unit periods according to the number of days in that historical period, and each unit period contains 6 time slots.
[0067]
[0068] Table 1
[0069] Furthermore, in this specification, for each time slot, the preset business pressure type of this time slot can be determined according to the business pressure of this time slot in the unit period. Among them, the business pressure types at least include: peak type and off-peak type. Then, the type of any time slot can be one of the peak type or the off-peak type, and the business pressure types of each time slot in each unit period can be alternately configured. For example, peak type time slot, off-peak type time slot, peak type time slot, off-peak type time slot... and so on. And, the resource allocation algorithms corresponding to time slots of different business pressure types may not be exactly the same.
[0070] Continuing with Table 1 as an example, time slots 2, 4, and 6 are peak type time slots, and the remaining time slots are off-peak type time slots. Then, the corresponding relationship among the time slot, business pressure type, and resource allocation algorithm can be shown in Table 2.
[0071]
[0072]
[0073] Table 2
[0074] Therefore, the resource allocation method in this specification can specifically include the following steps:
[0075] S102: Divide the time slots of the second historical period according to the historical data of the specified time slot in the first historical period.
[0076] In this specification, according to the preset division rule, the server can determine the time slots in each historical period, and for any two time slots in any unit period in any historical period, as long as their identifiers are the same, the start time and end time of these two time slots are consistent.
[0077] Generally, in different historical periods, the variation law of business pressure may vary. For example, assume that a certain region in the Northern Hemisphere uses natural gas for self-heating, and the natural gas usage can be regarded as a kind of business pressure. In the variation law of natural gas usage with a 1-month historical period and a 1-day unit period, in the historical period corresponding to January, the flat peak type period in the afternoon of each day is shorter (e.g., from 1 p.m. to 4 p.m., which is the period when the winter sunlight is relatively strong), while in the historical period corresponding to March, the flat peak type period in the afternoon of each day is longer (e.g., from 1 p.m. to 6 p.m., because the time of strong sunlight at noon in spring is extended compared to winter, so the duration of the period when natural gas heating is needed is reduced).
[0078] Therefore, in order to adjust the resource allocation algorithm more accurately later, the server can divide each time period of the second historical period according to the historical data of the specified time period in the first historical period. Among them, the first historical period is earlier than the second historical period, each historical period is a period that has been determined relative to the period before the current period, and the data in each historical period is the determined historical data, as Figure 2 shown. Each time period in the second historical period is divided according to a preset division rule, and the overall resource allocation algorithm for each time period in the second historical period is also determined by the divided time periods. Therefore, the division of the time periods of the second historical period in this step S102 can be regarded as re-dividing each time period of the second historical period.
[0079] The specified time period can be a time period of a specified business pressure type, such as peak type, flat peak type, etc.
[0080] First, since business pressure usually changes continuously, the peak type period and the flat peak type period usually appear alternately. The end moment of the previous flat peak type period is the start moment of the next peak type period. Therefore, the server can determine the average value of the business pressure characterization values of the specified business pressure type period in the first historical period as the division condition for re-dividing the time periods in the second historical period.
[0081] Specifically, the specified business pressure type includes the flat peak type. Then, the server can determine the median and standard deviation of the business pressure characterization values during the flat peak type periods in the first historical period based on the business pressure characterization values during each flat peak type period in the first historical period. Among them, the business pressure characterization value for each period is the business pressure characterization value at each moment during that period. Then, the server can determine the business pressure characterization value at each moment during the flat peak type periods in the first historical period and calculate the median and standard deviation of the business pressure characterization values. The calculation methods for the median and standard deviation are not elaborated in this specification. Among them, the duration of each moment can be set as needed. For example, it can be 5 minutes for one moment, 1 minute for one moment, or 10 seconds for one moment, etc. This specification does not make a limitation.
[0082] In addition, the business pressure characterization value is data that can intuitively or non-intuitively represent business pressure. For example, the natural gas usage, computing resource usage, etc. can be regarded as data that intuitively represents business pressure. And the number of computing requests received can be regarded as data that non-intuitively represents business pressure. In short, this specification does not limit what specific data the business pressure characterization value is. It is set as needed as long as it can represent business pressure data.
[0083] Secondly, the server can divide the periods of the second historical period based on the calculated median and standard deviation of the business pressure characterization values.
[0084] Specifically, the server can use the business pressure characterization value at each moment in the second historical period as the data for dividing periods, and use the median and standard deviation of the business pressure characterization values during the flat peak type periods in the first historical period determined previously as the division conditions to determine the start time and end time of each peak period in the second historical period.
[0085] The server, based on the business pressure characterization value at each moment in the second historical period, according to the formula O i >O m +3·O s , determines the start time and end time of the peak type period. Among them, O i represents the business pressure characterization value at the i-th moment, O m represents the median of the business pressure characterization values, O s represents the standard deviation of the business pressure characterization values, as Figure 3 shown.
[0086] Figure 3 is a schematic diagram of the change in the business pressure characterization value of the second historical period. Among them, the dashed line is the business pressure characterization value corresponding to O m +3·O s . It can be seen that through the formula Oi > O m +3·O s The start time and end time of the peak type period in the second historical period are determined.
[0087] Finally, according to the start time and end time of each peak type period in the second historical period, the periods of the second historical period are divided.
[0088] After determining the start time and end time of each peak type period in the second historical period, since the peak type periods and flat peak type periods appear alternately, the server can accordingly adjust the start time and end time of the flat peak type periods. For example, taking the periods shown in Table 1 and Table 2 as an example, assuming that Period 2 and Period 4 are adjusted to 11 a.m. - 1 p.m. and 5 p.m. - 8 p.m. respectively, then the corresponding adjacent flat peak periods, Period 1, Period 3, and Period 5, can also respectively adjust the start time and end time to 3 a.m. - 11 a.m., 1 p.m. - 5 p.m., and 8 p.m. - 11 p.m.
[0089] It should be noted that when dividing the periods in step S102, only the historical data of the periods in the first historical period is needed to divide the periods in the second historical period, which only involves the business pressure characterization value of the corresponding period and the business pressure characterization value at each moment. Therefore, the influence of the unit period does not need to be considered. Thus, even without the division of the unit period in step S102, there is no impact.
[0090] S104: According to the historical data of the second historical period, determine the classification to which each of the divided periods in the second historical period belongs.
[0091] In the embodiments of this specification, after dividing the periods in the second historical period, since the start time and end time corresponding to the periods may have changed, the server needs to re - determine the classification to which each period belongs. Among them, the classification to which the period belongs can be determined based on the business evaluation characterization value, and the business evaluation characterization value is a quantitative value used to characterize the efficiency of business processing. For example, the number of projects completed per minute by a cloud computing service, the number of P2P connections established per minute by a Peer - to - Peer (P2P) platform, the number of articles retrieved per second by a duplicate - checking server, and so on.
[0092] Moreover, in this specification, for each unit period, the identifiers of each time period in the unit period are different, and the identifiers of each time period in each unit period are determined according to the same naming rule. For example, in Table 1, identifiers 1 to 6 are determined according to the order of time periods in the unit period. That is to say, in other unit periods, even if the start time and end time of each time period are inconsistent, the identifiers are determined in the same order, as Figure 4 shown.
[0093] Figure 4 is a schematic diagram of time period identifiers provided in this specification. Among them, the distribution of the identifiers of the time periods in each unit period in the first historical period is the same as the distribution of the identifiers of the time periods in each unit period in the second historical period, even though the time periods in the second historical period have been obtained through step S102. Figure 4 The length of the time period in
[0094] is represented by the width of the rectangular box corresponding to the time period.
[0095] Specifically, the process of determining the classification to which each time period after division belongs in this specification includes:
[0096] First, the server can determine the resource utilization efficiency of each time period in the second historical period according to the historical data in the second historical period.
[0097] Secondly, for each identifier, according to the business evaluation values of the time periods corresponding to the identifier in the second historical period, determine the median of the business evaluation values corresponding to the identifier. That is, the server calculates the median of the business evaluation values of the time periods with the same identifier in the second historical period. For example, if the second historical period contains 10 unit periods, and each unit period contains 6 time periods with identifiers 1 to 6, then the server determines that in this second historical period, for each of the identifiers 1 to 10, the number of time periods corresponding to each identifier is 6, and then calculates the median of the business evaluation values of the 6 time periods corresponding to each identifier.
[0097] After that, for each unit period in the second historical period, determine the business evaluation value of the unit period, and calculate the median and standard deviation of the business evaluation values of the unit periods in the second historical period. That is, determine the average business evaluation value of each unit period in the second historical period.
[0098] Finally, for each identifier, according to the median of the business evaluation values corresponding to each identifier in the unit period, the median of the business evaluation values of the unit periods in the second historical period, and the standard deviation of the business evaluation values of the unit periods in the second historical period, determine the classification to which the time period corresponding to the identifier after division in step S102 belongs.
[0099] Further, in this specification, when re - determining the classification to which the identified corresponding time period belongs, the server can, based on the median of the service evaluation values respectively corresponding to each identifier in the unit cycle, the median of the service evaluation values of the unit cycle in the second historical cycle, and the standard deviation of the service evaluation values of the unit cycle in the second historical cycle, determine, from the time periods corresponding to each identifier, that the classification to which the time period with the lowest service evaluation value belongs is the tail type.
[0100] Specifically, the server can determine, from the time periods corresponding to each identifier, the time period with the lowest service evaluation value and satisfying the formula E j < E m + 1.5·E s The classification to which the time period belongs is the tail type. From the time periods corresponding to other identifiers except those whose classification is the tail type, determine the time periods satisfying the formula E j > E m The classification to which the time period belongs is the head type. Determine that the classification to which the time periods corresponding to the remaining other identifiers belong is the middle type. Among them, E j represents the median of the service evaluation values of the time period with identifier j, E m represents the median of the service evaluation values of the unit cycle in the second historical cycle, and E s represents the standard deviation of the service evaluation values of the unit cycle in the second historical cycle.
[0101] Of course, in this specification, the service evaluation value can correspond to numerical values in multiple dimensions. For example, the number of completed projects, the number of devices used for calculation, the number of projects calculated per minute, etc. Then, when determining the tail type, head type, and middle type, it can be determined based on the numerical values in at least one dimension. For example, determine: First, the median of the number of devices used for calculation is the lowest. Second, the median of the number of projects calculated per minute in the time period corresponding to the identifier < the median of the number of projects calculated per minute in the unit cycle + 1.5 × the standard deviation of the number of projects calculated per minute in the unit cycle. The classification to which the time period corresponding to the identifier belongs is the tail type.
[0102] S106: Adjust the resource allocation algorithm corresponding to the time periods of at least one classification according to the classification of each time period divided in the second historical cycle.
[0103] In the embodiments of this specification, since the classification to which the time period belongs can be used to determine which time periods need to adjust the resource allocation algorithm, after determining the classification to which each time period belongs after step S102, the server can adjust the resource allocation algorithm for the time periods of at least one classification.
[0104] Specifically, in this specification, since the business evaluation of the tail type time period is the lowest, it is a time period that urgently needs to be adjusted. Therefore, the server can first adjust the resource allocation algorithm for the time period classified as the tail type. The business evaluation of the middle time period is acceptable, so the resource allocation algorithm for the time period classified as the middle type can be kept unchanged. Finally, according to the resource allocation algorithm of the middle type time period and the adjusted resource allocation algorithm of the tail type, the resource allocation algorithm for the time period classified as the head type is adjusted.
[0105] In addition, since the available resources are always limited within a certain period of time. For example, the volume of natural gas that a natural gas pipeline can transport per unit time has an upper limit, and the weight of goods that a truck can carry in a day also has a theoretical limit. Therefore, for the resource allocation process in this specification, the total amount of available resources per unit cycle is fixed.
[0106] So when adjusting the resource allocation algorithm, the server can determine the resource consumption of the time period of the tail type according to the adjusted resource allocation algorithm of the time period of the tail type, and determine the resource consumption of the time period of the middle type according to the resource allocation algorithm of the time period of the middle type. Then, according to the total amount of available resources per unit cycle and the resource consumption of the time periods of the tail type and the middle type determined respectively, the remaining available resources per unit cycle are determined. Finally, according to the remaining available resources per unit cycle, the resource allocation algorithm for the time period of the head type in the unit cycle is determined.
[0107] S108: Perform resource allocation according to the adjusted resource allocation algorithm.
[0108] In this specification, in steps S102 to S106, the server adjusts the resource allocation algorithm based on historical data. Therefore, after the server determines the resource allocation algorithms for each time period after adjustment, it can determine the resource allocation algorithms for each time period in the unit cycle and perform resource allocation for each time period in the subsequent unit cycles. That is, perform resource allocation for the time periods in the current unit cycle or future unit cycles according to the adjusted resource allocation algorithm.
[0109] Specifically, the server can apply the start time and end time of each time period divided by step S102 in the second historical cycle to subsequent unit cycles. And perform resource allocation for subsequent unit cycles according to the adjusted resource allocation algorithms for each time period.
[0110] Based on Figure 1The resource allocation method shown above, first, based on the historical data of two historical periods, uses the historical data of the earlier historical period (i.e., the first historical period) to adjust the time period division of the later historical period (i.e., the second historical period). After that, it determines the classification to which each time period of the second historical period after division belongs. Finally, according to the classification to which each time period divided by step S102 of the second historical period belongs, it adjusts the resource allocation algorithm corresponding to the time periods of at least one classification, and performs resource allocation according to the adjusted resource allocation algorithm. Since the resource allocation algorithm can be continuously adjusted according to historical data, it is more flexible than the manually set resource allocation algorithm. And each time the resource allocation algorithm is adjusted, it can be adjusted according to time periods in the historical period, so the cost of adjusting the resource allocation algorithm can be reduced, avoiding the defects of the prior art.
[0111] In addition, since there is usually a lag between the change of the resource allocation algorithm and the change of the service evaluation value. For example, the resource allocation algorithms between two adjacent time periods are different. However, when transitioning from one time period to another, although the way of allocating resources may change (i.e., the resource allocation algorithm changes), the corresponding effect needs to lag for a period of time to be reflected, that is, the service evaluation value will change after a delay. Therefore, in order to reduce the resource waste caused by this lag characteristic, in step S102 of this application, when the server determines the start time and end time of the peak type time period, it can extend the duration of the peak type time period.
[0112] Specifically, an extended duration ΔT can be preset, extend the start time of the peak time period forward by ΔT, and extend the end time of the peak time period backward by ΔT. Of course, the server can also only extend the start time or the end time, which is not limited in this specification.
[0113] For the convenience of understanding, this specification provides the following scenario. This resource allocation process is a process of allocating computing resources (i.e., computing power) of a cloud computing service platform. In order to avoid the situation of idle computing power on the platform, in addition to the computing power used by resident projects, the platform can usually also provide computing services externally. The resource allocation method of this specification can be used for the platform to perform reasonable computing power (i.e., resources) allocation.
[0114] Suppose that in this platform, the unit period is 1 day, the historical period is 1 week, and each unit period is divided into 6 time periods. Then in step S102, the server determines the computing power usage at each moment of each flat peak type time period in the first historical period according to the historical data of the flat peak type time period in the first historical period, and then determines the median and standard deviation of the computing power usage at each moment of the flat peak type time period. After that, according to the formula O i >O m +3·O sDetermine the start time and end time of the peak type period in the second historical period, that is, the period with a relatively high computing power usage, such as Figure 5 shown. Then in the formula at this time, O i represents the computing power usage at the i-th moment, O m represents the median of the computing power usage at each moment, O s represents the standard deviation of the computing power usage at each moment.
[0115] Figure 5 is a schematic diagram provided in this specification for determining the start time and end time of the peak type period, Figure 5 is a graph of the computing power usage fluctuation of a certain unit period in the first historical period. The dashed line is the computing power usage O m + 3·O value. This dashed line divides the fluctuation line into 6 regions, corresponding to the peak type period and the flat peak type period respectively.
[0116] After that, in step S104, the specific business evaluation characterization value of each period in the second historical period can be: the number of projects completed in a unit time, that is, the project completion speed. Since third parties usually continuously submit computing applications, and each application can be regarded as a project, the business evaluation characterization value within this unit time can be determined by determining the project completion speed.
[0117] For example, when the project is simpler, the project completion speed is faster. Suppose the cloud computing platform receives 1000 projects in unit time B, but 999 of them are simple data processing, and the cloud computing platform completes 999 projects in unit time B. And in unit time C, the cloud computing platform receives 10 projects, but 9 of them are complex simulated wind tunnel processing, and the cloud computing platform only completes 1 project in unit time C. Then the project completion speed in unit time B is higher than that in unit time C.
[0118] Then for each identifier, the server can determine that the project completion speed in the period corresponding to each identifier is the slowest and satisfies the formula E j < E m + 1.5·E s The period belonging to the classification of the tail type. At this time, in this formula, E j represents the median of the project completion speed of the period with identifier j, E m represents the median of the project completion speed of this unit period, E s represents the standard deviation of the project completion speed of this unit period.
[0119] In addition, to eliminate the influence of special cases on the classification of the determined time period, when calculating the above median, the server can also remove the data of each time period in the unit cycle where the number of items received in the unit cycle is less than the first threshold. If the number of items is not less than the first threshold, it indicates that the platform is operating normally in this unit cycle, and the resource allocation process can continue to be executed according to the steps. If the number of items is less than the first threshold, it indicates that the number of items received by the platform in this unit cycle is abnormal, which may cause inaccurate classification when used for classification. Therefore, the data of this unit cycle is not used for classification.
[0120] Finally, in step S106, adjust the total computing power allocation percentage of the time periods of the tail type to improve the project completion speed of the time periods of the tail type and improve the platform efficiency. And since the computing power required for resident projects should remain constant in total throughout the day, after increasing the computing power in the time periods of the tail type to process external projects, the server can determine the total consumption of computing power in other time periods except for the time periods of the head type, and then determine the computing power allocation algorithm for the time periods of the head type.
[0121] Figure 6 This is a schematic diagram of computing power adjustment provided in this specification, which is adjusted from the total computing power allocation percentage on the left to the total computing power allocation percentage on the right. Among them, 50% is the total computing power consumed by the resident projects of the cloud platform in one day, and the remaining 50% of the computing power is the computing power allocated to each time period. By increasing the total computing power percentage of the time periods of the tail type from 12% to 14%, the efficiency of the time periods of the tail type is increased, and the computing power percentage of the time periods of the head type is reduced from 5% to 1%.
[0122] Another scenario is also provided in this specification. This resource allocation process is a process of allocating order delivery fees. Suppose the unit cycle is 1 day, and the identifiers of the time periods are: morning idle time, lunch peak, afternoon idle time, evening peak, night idle time, and midnight snack.
[0123] The resource consumption per unit time in step S102 is the order volume per unit time. That is, the number of orders accepted by riders within the unit time. And the unit time is less than 5 minutes.
[0124] In step S104, the resource utilization efficiency is the order acceptance rate within 5 minutes, that is, the number of orders accepted by riders within five minutes. The total resource usage of the unit cycle is the total order volume of a single day.
[0125] In addition, in step S104, the server can also determine the number of orders held by each user within each unit time (that is, the order holding volume per unit time of each rider) and the number of active users (that is, the number of riders). The resource allocation algorithm for each time period is the reward amount for a single order in this time period, that is, the additional reward that a rider can obtain for completing an order.
[0126] The server can determine, according to the conditions in Table 3, that the time period meeting the conditions in Table 3 is the low-peak period in a single day, and determine the peak period in a single day according to the conditions in Table 4.
[0127]
[0128] Table 3
[0129]
[0130]
[0131] Table 4
[0132] Finally, in step S106, the server can first adjust the reward amount for a single order in the time period of the tail type, and increase the reward amount for a single order in the time period of the tail type according to a preset step size. The reward amount for a single order in the time period of the middle type remains unchanged. According to the total available reward amount per day, determine the total available reward amount remaining for the time period of the head type. According to the formula
[0133] Reward amount for a single order = Total available reward amount remaining for the time period of the head type / Total number of orders in the time period of the head type, to determine the reward amount for a single order in the time period of the head type, that is, the resource allocation algorithm.
[0134] Based on Figure 1 the resource allocation method shown, the embodiments of this specification also correspondingly provide a schematic structural diagram of a resource allocation device, as shown in Figure 7 shown.
[0135] Figure 7 A schematic structural diagram of a resource allocation device provided by the embodiments of this specification, the historical period includes at least two time periods, and the device includes:
[0136] A time period division module 202, which divides the time periods of the second historical period according to the historical data of the specified time period in the first historical period, where the first historical period is earlier than the second historical period;
[0137] A determination module 204, which determines the classification to which each of the divided time periods in the second historical period belongs according to the historical data of the second historical period;
[0138] An adjustment module 206, which adjusts the resource allocation algorithm corresponding to the time periods of at least one classification type according to the classification to which each of the divided time periods in the second historical period belongs;
[0139] An allocation module 208, which performs resource allocation according to the adjusted resource allocation algorithm.
[0140] Optionally, the time period division module 202 determines the business pressure types of each time period in the first historical period, determines the median and standard deviation of the business pressure characterization values of the time periods of the specified business pressure type in the first historical period according to the business pressure characterization values of the time periods of the specified business pressure type in the first historical period, and divides the time periods of the second historical period according to the median and standard deviation of the business pressure characterization values.
[0141] Optionally, the business pressure types at least include: peak type and flat peak type, and the specified business pressure type includes flat peak type.
[0142] Optionally, the time period division module 202 determines the start time and end time of each busy time type period in the second historical period according to the business pressure characterization value of each moment in the second historical period and the median and standard deviation of the business pressure characterization values of the time periods of the idle time type in the first historical period, and divides the time periods of the second historical period according to the start time and end time of each busy time type period in the second historical period.
[0143] Optionally, the historical period consists of at least two unit periods, each unit period contains the same number of time periods, and for each unit period, the identifiers of the time periods in this unit period are different.
[0144] Optionally, the determination module 204 determines the median of the business evaluation values corresponding to each identifier according to the business evaluation values of the time periods corresponding to each identifier in the second historical period, determines the median and standard deviation of the business evaluation values of the unit periods of the second historical period according to the business evaluation values of each unit period in the second historical period, and for each identifier, determines the category to which the time period corresponding to this identifier belongs after division according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation.
[0145] Optionally, the determination module 204 determines that the category to which the time period with the lowest business evaluation value belongs among the time periods corresponding to each identifier is the tail type according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation, determines that the category to which the time period with the highest business evaluation value belongs among the time periods corresponding to each identifier is the head type according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation, and determines that the category to which the time periods corresponding to other identifiers belong is the middle type.
[0146] Optionally, the adjustment module 206 adjusts the resource allocation algorithm for the time periods classified as the tail type, keeps the resource allocation algorithm for the time periods classified as the middle type unchanged, and adjusts the resource allocation algorithm for the time periods classified as the head type according to the resource allocation algorithm for the time periods of the middle type and the adjusted resource allocation algorithm for the time periods of the tail type.
[0147] Optionally, the adjustment module 206 determines the resource consumption of the time periods of the tail type according to the adjusted resource allocation algorithm for the time periods of the tail type, determines the resource consumption of the time periods of the middle type according to the resource allocation algorithm for the time periods of the middle type, determines the remaining available resources according to the total available resources within a unit period and the respectively determined resource consumptions of the time periods of the tail type and the time periods of the middle type, and determines the resource allocation algorithm for the time periods of the head type in a unit period according to the remaining available resources.
[0148] Optionally, the allocation module 208 allocates resources to each time period in subsequent unit periods according to the adjusted resource allocation algorithm.
[0149] An embodiment of this specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above Figure 1 provided resource allocation method.
[0150] Based on Figure 1 the resource allocation method shown, an embodiment of this specification also proposes Figure 8 a schematic structural diagram of the electronic device shown. As Figure 8 , at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above Figure 1 described resource allocation method.
[0151] Of course, in addition to the software implementation, this specification does not exclude other implementation manners, such as logic devices or a combination of software and hardware. That is to say, the execution subject of the following processing flow is not limited to each logic unit and may also be hardware or a logic device.
[0152] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many method flow improvements today can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented using a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is an integrated circuit whose logical function is determined by the user programming the device. Designers can program themselves to "integrate" a digital system onto a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, today, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compilers used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL). There is not just one type of HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow using the above-mentioned several hardware description languages and programming it into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.
[0153] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers, etc., to achieve the same functions. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.
[0154] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0155] For the convenience of description, when describing the above devices, they are described separately as various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0156] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.
[0157] The present invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow and / or block of the flowchart illustrations and / or block diagrams, and combinations of flows and / or blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing apparatus create means for implementing the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0158] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0159] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0160] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0161] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.
[0162] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0163] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0164] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0165] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0166] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiment.
[0167] The above description is only for the embodiments of this specification and is not intended to limit this specification. For those skilled in the art, various modifications and changes can be made to this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this specification.
Claims
1. A resource allocation method, characterized in that, The historical period includes at least two time periods, and the method includes: Dividing the time periods of a second historical period according to the historical data of a specified time period in a first historical period, where the first historical period is earlier than the second historical period; Determining the categories to which the divided time periods in the second historical period belong according to the historical data of the second historical period; Adjusting the resource allocation algorithms corresponding to the time periods of at least one category according to the categories of the divided time periods in the second historical period; Performing resource allocation according to the adjusted resource allocation algorithm; Dividing the time periods of the second historical period according to the historical data of a specified time period in the first historical period, specifically including: Determining the types of business pressure for each time period in the first historical period, where the types of business pressure at least include: peak type and off-peak type; Determining the median and standard deviation of the business pressure characterization values of the off-peak type time periods in the first historical period according to the business pressure characterization values of the off-peak type time periods in the first historical period; Dividing the time periods of the second historical period according to the median and standard deviation of the business pressure characterization values, specifically including: determining the start time and end time of each peak type time period in the second historical period according to the business pressure characterization value at each moment in the second historical period and the median and standard deviation of the business pressure characterization values of the off-peak type time periods in the first historical period; dividing the time periods of the second historical period according to the start time and end time of each peak type time period in the second historical period; The historical period consists of at least two unit periods, and each unit period contains the same number of time periods, and for each unit period, the identifiers of the time periods in this unit period are different; Determining the categories to which the divided time periods in the second historical period belong according to the historical data of the second historical period, specifically including: for each identifier, determining the median of the business evaluation values corresponding to this identifier according to the business evaluation values of the time periods corresponding to this identifier in the second historical period; determining the median and standard deviation of the business evaluation values of the unit periods of the second historical period according to the business evaluation values of the unit periods in the second historical period; For each identifier, determining the category to which the corresponding time period after division belongs according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation, specifically including: determining that the category to which the time period with the lowest business evaluation value belongs among the time periods corresponding to each identifier is the tail type according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation; determining that the category to which the time period with the highest business evaluation value belongs among the time periods corresponding to each identifier is the head type according to the median of the business evaluation values corresponding to each identifier in the second historical period, the median of the business evaluation values of the unit periods of the second historical period, and the standard deviation; determining that the categories to which the time periods corresponding to other identifiers belong are the middle types.
2. The method according to claim 1, wherein Adjust the resource allocation algorithms corresponding to the time periods of at least one classification according to the classification to which each time period divided in the second historical cycle belongs. Specifically, it includes: Adjust the resource allocation algorithm for the time period whose classification is the tail type; Keep the resource allocation algorithm for the time period whose classification is the middle type unchanged; Adjust the resource allocation algorithm for the time period whose classification is the head type according to the resource allocation algorithm for the time period of the middle type and the adjusted resource allocation algorithm for the time period of the tail type.
3. The method according to claim 2, wherein Adjust the resource allocation algorithm for the time period whose classification is the head type according to the resource allocation algorithm for the time period of the middle type and the adjusted resource allocation algorithm for the time period of the tail type. Specifically, it includes: Determine the resource consumption of the time period of the tail type according to the adjusted resource allocation algorithm for the time period of the tail type; Determine the resource consumption of the time period of the middle type according to the resource allocation algorithm for the time period of the middle type; Determine the remaining available resources according to the total available resources within a unit cycle and the resource consumptions of the time periods of the tail type and the middle type determined respectively; Determine the resource allocation algorithm for the time period of the head type in a unit cycle according to the remaining available resources.
4. The method according to any one of claims 1 to 3, characterized in that, Perform resource allocation according to the adjusted resource allocation algorithm. Specifically, it includes: Perform resource allocation for each time period in subsequent unit cycles according to the adjusted resource allocation algorithm.
5. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method described in any one of claims 1-4 above.
6. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1-4 above.
Citation Information
Patent Citations
Resource service system and resource distribution method thereof
CN104168318A
Self-adaptive resource allocation method and device
CN106911592A