Resource allocation system, method and apparatus

By combining database nodes and central management nodes to make resource allocation decisions and using a combination of long and short cycles for prediction, the problem of low resource elasticity efficiency and accuracy of serverless databases is solved, and efficient and reliable resource allocation is achieved.

CN115391028BActive Publication Date: 2026-01-02ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210903545.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-01-02
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

Existing serverless databases have low resource elasticity efficiency, accuracy and robustness. Centralized decision-making leads to low elasticity efficiency and unreasonable resource allocation. When the central node is abnormal, it is prone to large-scale failure.

Method used

Resource allocation decisions are made by combining database nodes and central management nodes. By combining long and short-term forecasts, sliding window forecasting and decentralized resource allocation are achieved. Database nodes make short-term resource adjustments, while central management nodes make long-term trend forecasts.

Benefits of technology

It improves the efficiency and accuracy of resource boosting, reduces link consumption, enhances resource utilization and robustness, and avoids the impact of central node anomalies on resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391028B_ABST
    Figure CN115391028B_ABST
Patent Text Reader

Abstract

The application discloses a resource allocation method, device and system. The method obtains state data and / or resource usage data of an existing database instance through a database node; sends the data to a central management node; the central management node obtains load change characteristic data of the existing database instance in a first period according to data in the first period; sends the load change characteristic data to the database node; and the database node obtains resource allocation data of the existing database instance at a future time according to the load change characteristic data and data of the existing database instance in a second period. The processing manner can transform the resource allocation controlled by the central management node into the resource allocation decision made by the central management node and the database node in combination, and can effectively improve resource allocation efficiency, accuracy and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of serverless database, in particular to a resource allocation system, method and device, and an electronic device. BACKGROUND

[0002] Serverless database refers to a database based on Serverless architecture, which does not require users to create instances and can quickly complete deployment. Users using the database have the use characteristics of Serverless, that is, pay-as-you-go billing, which greatly reduces costs.

[0003] Serverless operation has the characteristics of automatic elasticity. Relational databases are the data brains of many application systems and need to be timely and accurate to upgrade resources, otherwise they will block the application system and even cause the entire system to collapse, so it is particularly important to improve the upgrade efficiency and accuracy of Serverless databases. A typical resource upgrade method is to use centralized resource management scheduling to determine the specific resource allocation logic to avoid resource conflicts and data consistency problems. Specifically, the data collected by the database node (Agent) is transmitted to the central management node for consumption, and the central management node consumes and decides to issue instructions to the database node for execution.

[0004] However, in the process of implementing the present application, the inventors found that the above-mentioned scheme at least has the following problems: 1) on the one hand, from data collection by the Agent to central consumption, data transmission and consumption are required, and on the other hand, the central consumption decision needs to be issued to the Agent end again, which results in low upgrade efficiency, about 10 seconds to several minutes of elastic efficiency, thereby causing long-time lag of the application; 2) the long overall time causes the positive feedback to be unable to be effectively adjusted, thereby causing unreasonable overall resource allocation and low elastic accuracy, and each upgrade needs to be followed by a second upgrade for correction, thereby wasting more resources; 3) the centralized decision-making is difficult to cope with a large number of instances, and once the central node is upgraded or abnormal, it will cause a large area of failure. SUMMARY

[0005] The present application provides a resource allocation method to solve the problems of low resource elasticity efficiency, accuracy and robustness in the prior art. The present application further provides a resource allocation device and system, and an electronic device.

[0006] The present application provides a resource allocation method, comprising:

[0007] The database node obtains state data and / or resource usage data of an existing database instance;

[0008] The resource usage data and / or the state data are sent to a central management node;

[0009] receiving load change characteristic data of the existing database instance in a first period sent by the central management node;

[0010] obtaining first resource allocation data of the existing database instance at a future time according to the load change characteristic data, and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period.

[0011] Optionally, the load change characteristic data is obtained in the following manner:

[0012] obtaining, by the central management node, statistical data of the resource usage data at multiple time points in the first period according to the resource usage data in the first period;

[0013] obtaining the load change characteristic data according to the statistical data at the multiple time points.

[0014] Optionally, the method further comprises:

[0015] obtaining, by the central management node, pressure statistical data of the database instance on resources at multiple time points in the first period according to the state data in the first period;

[0016] obtaining the load change characteristic data according to the statistical data at the multiple time points and the pressure statistical data of the database instance on resources at the multiple time points.

[0017] Optionally, the load change characteristic data comprises a glitch-like change, a periodic change, and a long-term pause-like change.

[0018] Optionally, the state data comprises at least one of the following: the number of connections of the database instance, the request quantity per second, the system throughput, a structured query language (SQL) with a slow running speed, and a cache hit rate; and the resource usage data comprises at least one of the following: central processing unit (CPU) usage data, memory usage data, and disk usage data.

[0019] Optionally, the obtaining of the first resource allocation data of the existing database instance at the future time according to the load change characteristic data and the resource usage data of the existing database instance in the second period comprises at least one of the following manners:

[0020] if the resource usage data and / or the state data in the second period satisfies a resource adjustment condition, and the load change characteristic data is a glitch-like change, obtaining the first resource allocation data according to a first resource adjustment strategy;

[0021] If the resource usage data and / or the state data in the second period meets a resource adjustment condition, and the load change characteristic data is periodical, the first resource allocation data is obtained according to a second resource adjustment strategy.

[0022] Optionally, the resource adjustment condition comprises that the resource usage data in the second period exceeds a first resource usage threshold or is lower than a second resource usage threshold; the first resource adjustment strategy comprises a first resource increasing strategy and a first resource decreasing strategy, and the second resource adjustment strategy comprises a second resource increasing strategy and a second resource decreasing strategy.

[0023] Optionally, the method further comprises:

[0024] receiving second resource allocation data of the existing database instance at a future time sent by the central management node;

[0025] obtaining third resource allocation data of the existing database instance at the future time according to the first resource allocation data and the second resource allocation data.

[0026] Optionally, the method further comprises:

[0027] receiving fourth resource allocation data of the new database instance or the migrated database instance sent by the central management node;

[0028] running the new database instance or the migrated database instance according to the fourth resource allocation data.

[0029] Optionally, the method further comprises:

[0030] locking the allocable resources of the database node when the central management node performs the resource allocation processing or the database node performs the resource allocation processing.

[0031] The application also provides a resource allocation method, comprising:

[0032] receiving state data and / or resource usage data of an existing database instance sent by a database node;

[0033] obtaining load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period;

[0034] sending the load change characteristic data to the database node, so that the database node obtains first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period.

[0035] Optionally, further comprising:

[0036] allocating resources of the database node for the new database instance or the migrated database instance;

[0037] sending the resource allocation data to the database node, so that the database node runs the new database instance or the migrated database instance according to the resource allocation data.

[0038] The application further provides a resource allocation apparatus, comprising:

[0039] a data acquisition unit configured to acquire state data and / or resource usage data of an existing database instance by a database node;

[0040] a data reporting unit configured to send the resource usage data and / or the state data to a central management node;

[0041] a data receiving unit configured to receive load change characteristic data of the existing database instance in a first period sent by the central management node;

[0042] a resource allocation unit configured to acquire first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data of the existing database instance in a second period, the length of the first period being greater than the length of the second period.

[0043] The application further provides a resource allocation apparatus, comprising:

[0044] a data receiving unit configured to receive state data and / or resource usage data of an existing database instance sent by a database node;

[0045] a data acquisition unit configured to acquire load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data;

[0046] a data sending unit configured to send the load change characteristic data to the database node, so that the database node acquires first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period.

[0047] The application further provides an electronic device, comprising:

[0048] a communication interface;

[0049] a processor and a memory;

[0050] a memory for storing a program for implementing the above method, and the device is powered on and runs the program of the method through the processor.

[0051] The application also provides a resource allocation system, comprising the resource allocation device deployed at the database node side and the resource allocation device deployed at the central management node side.

[0052] The application also provides a computer readable storage medium, wherein instructions are stored in the computer readable storage medium, and when the instructions are run on a computer, the computer executes the various methods.

[0053] The application also provides a computer program product comprising instructions, which, when run on a computer, cause the computer to execute the various methods.

[0054] Compared with the prior art, the application has the following advantages:

[0055] The resource allocation method provided by the embodiments of the application comprises the following steps: a database node obtains state data and / or resource (such as CPU and memory) usage data of an existing database instance; the resource usage data and / or the state data are sent to a central management node; the central management node obtains load change characteristic data of the existing database instance in a first period (a long period, which can be days, such as 30 days) according to the resource usage data and / or the state data in the first period; the load change characteristic data is sent to the database node; and the database node obtains first resource allocation data of the existing database instance at a future time (such as the next second) according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period (a short period, which can be seconds, such as 30 seconds), and the length of the first period is greater than the length of the second period. By using this processing mode, the resource allocation controlled by the central management node is converted into resource allocation decisions made by the central management node and the database node in combination, long-period trend prediction is performed at the central management node, long-short-period combined prediction is performed by using the computing power redundancy of the database node, sliding window prediction and decentralized resource allocation are realized, short-period resource allocation data communication between the central management node and the database node is avoided, and link consumption is reduced; therefore, the resource pop-up efficiency and accuracy can be effectively improved, and the computing resources are more in line with system pressure. In addition, resource allocation by using the computing power of the database node can also improve resource utilization. Furthermore, the way of making resource allocation decisions in combination of the central management node and the database node also makes it possible that even if the central management node is upgraded or iterated or abnormal, the resource allocation of the database instance will not be affected; therefore, the robustness of resource allocation can be effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1Structure diagram of an embodiment of a resource allocation system provided by the present application;

[0057] Figure 2 Interaction diagram of an embodiment of a resource allocation system provided by the present application;

[0058] Figure 3a Structure diagram of an embodiment of a resource allocation system provided by the present application;

[0059] Figure 3b Structure diagram of an embodiment of a resource allocation system provided by the present application;

[0060] Figure 4 Structure diagram of an embodiment of a resource allocation system provided by the present application;

[0061] Figure 5 Structure diagram of an embodiment of a resource allocation system provided by the present application;

[0062] Figure 6 Structure diagram of an embodiment of a resource allocation system provided by the present application. DETAILED DESCRIPTION

[0063] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details, and it is understood that the present application is not limited to the embodiments described herein. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the present application.

[0064] In the present application, a resource allocation system, method and device, and an electronic device are provided. In the following embodiments, various schemes are described one by one in detail.

[0065] The serverless database refers to a database based on a serverless architecture, including a central management node and a plurality of database nodes, wherein the database nodes are referred to as edge nodes or edge servers. A user's application system can use the serverless database, and at this time, the user does not need to create a database instance, and can quickly complete deployment. For example, a customer service system of a certain bank and an online transaction platform of a certain enterprise both use the serverless database, the customer service system of the bank corresponds to a database instance 1, and the online transaction platform of the enterprise corresponds to a database instance 2, the database instance 1 and the database instance 2 can run on the same database node or different database nodes, and the central management node adjusts the database node resources, such as CPU and memory resources, occupied by the database instance 1 and the database instance 2 according to the load change of the database instance 1 and the load change of the database instance 2.

[0066] First embodiment

[0067] Please refer to Figure 1 which is a structural schematic diagram of an embodiment of a resource allocation system of the present application. In the embodiment, the system includes a plurality of database nodes 1 (database node 1-1 to database node 1-n) and a central management node 2.

[0068] The system includes a plurality of database nodes 1 and a central management node 2. As shown in Figure 2 The database node 1 is configured to obtain state data and / or resource usage data of an existing database instance, and send the resource usage data and / or the state data to the central management node 2. The central management node 2 is configured to receive the resource usage data and / or the state data, obtain load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period, and send the load change characteristic data to the database node 1. The database node 1 receives the load change characteristic data of the existing database instance in the first period sent by the central management node 2, and obtains first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period.

[0069] The length of the first period is greater than the length of the second period. According to the length of the first period and the length of the second period, the first period is referred to as a long period, and the second period is referred to as a short period. The first period can be a day level, such as 15 days or 30 days, etc., so that the load change characteristic data of the existing database instance in the first period can be obtained according to at least one of the resource usage data and the state data of the database instance in the last 30 days (such as the resource usage data, or the state data, or the resource usage data and the state data), which can be referred to as a long period trend model of the database instance. The second period can be a sliding window, which can be a second level, such as 10 seconds or 30 seconds, etc., so that the first resource allocation data of the database instance at a future time (such as the next second or the next two seconds, etc.) can be obtained according to the long period trend model of the database instance in the last 30 days and at least one of the resource usage data and the state data of the database instance in the last 30 seconds. It can be seen that the database node does not need to obtain a resource adjustment instruction from the central management node each time the database instance adjusts the resource allocation amount.

[0070] The state data includes but is not limited to at least one of the following: the number of connections of the database instance, the request amount per second, the system throughput, the running speed of the structured query statement, and the cache hit rate. The resource usage data includes but is not limited to at least one of the following: the usage data of the central processing unit (CPU), the memory usage data, and the disk usage data.

[0071] The load change characteristic data can be the change rule of the load of the database instance in the long period (the first period) to the resource demand, which can reflect the change characteristics of the load of the database instance to the resource demand. The change of the load to the resource demand will affect the change of the resource demand. The load change characteristic data includes but is not limited to: a burr-like change, a period-like change, and a long-term pause-like change. Figure 3a As shown in the figure, the burr-like change refers to the change of the load of the database instance to the resource demand in a sudden manner, which can have no rule. Figure 3b As shown in the figure, the period-like change refers to the change of the load of the database instance to the resource demand in a periodical manner. The long-term pause-like change refers to the change of the load of the database instance to the resource demand being less.

[0072] The central management node can periodically obtain the load change characteristic data, such as at 0 o'clock every day or at a fixed time several times a day. The central management node triggers the process of obtaining the load change characteristic data of the existing database instance in the first period according to the resource usage data and / or the state data in the first period, and then distributes the load change characteristic data to the database node. The central management node is responsible for the process of obtaining the load change characteristic data of multiple database instances on multiple database nodes, and the central management node distributes the load change characteristic data of different database instances to the corresponding database nodes.

[0073] In one example, the central management node obtains the load change characteristic data in the following manner: the central management node obtains statistical data of the resource usage data at multiple time points in the first period according to the resource usage data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points.

[0074] The statistical data can be any one of the average, median, maximum, or minimum of the resource usage data at multiple time points, such as the average of the CPU usage rate of database instance A at 8:05:15 every day for the past 30 days, or the average of the memory usage rate. In specific implementation, multiple resource usage data can be obtained at multiple time points in the first period, and then the statistical data of multiple indicators can be integrated to obtain the load change characteristic data, so that more accurate load change characteristic data can be obtained.

[0075] In one example, the central management node can also obtain the load change characteristic data in the following manner: the central management node obtains statistical data of the resource usage data at multiple time points in the first period according to the resource usage data in the first period; obtains pressure statistical data of the database instance on the resource at multiple time points in the first period according to the state data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points and the pressure statistical data of the resource at the multiple time points.

[0076] The state data of the database instance can reflect the pressure condition of the database instance on the resource. The pressure statistical data can be any one of the average, median, maximum, or minimum of the state data (such as the number of connections, QPS, TPS, etc.) of the database instance at multiple time points, such as the average of the number of connections of database instance A at 8:05:15 every day for the past 30 days, or the average of the QPS. If the pressure statistical data increases over time, the database instance needs to be resource-popped up; if the pressure statistical data decreases over time, the database instance needs to be resource-popped down.

[0077] In one example, the central management node can further obtain the load change characteristic data in the following manner: the central management node obtains, according to the state data of the first period, pressure statistics data of the database instance on the resource at multiple time points within the first period; and obtains the load change characteristic data according to the pressure statistics data of the resource at the multiple time points.

[0078] The database node can periodically obtain the first resource allocation data, such as triggering execution every 5 seconds to obtain the first resource allocation data of the database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance within the second period, and then adjust the resource specification of the database instance according to the first resource allocation data. Taking the example of triggering execution every 5 seconds to obtain the first resource allocation data by the database node, assuming that the second period is 10 seconds and the future time is the next second, the database node obtains the first resource allocation data of the database instance at the next second according to the resource usage data and / or the state data of the database instance within the last 10 seconds every 5 seconds.

[0079] In one example, the database node can obtain the first resource allocation data in at least one of the following manners: 1) if the resource usage data within the second period and / or the state data satisfies the resource adjustment condition, and the load change characteristic data is a spike-like change, the first resource allocation data is obtained according to a first resource adjustment strategy; 2) if the resource usage data within the second period and / or the state data satisfies the resource adjustment condition, and the load change characteristic data is a periodic change, the first resource allocation data is obtained according to a second resource adjustment strategy.

[0080] The resource adjustment condition includes but is not limited to: the resource usage data within the second period exceeding a first resource usage threshold (upper limit of resource usage) or being lower than a second resource usage threshold (lower limit of resource usage). In specific implementation, the resource adjustment condition can be set according to application requirements.

[0081] For example, if the CPU usage rate of the database instance A within the last 10 seconds is 85%, which is greater than the CPU resource usage upper limit of 80%, the first resource increase strategy is used to allocate more CPU resources and more memory to the database instance A. If the CPU usage rate of the database instance A within the last 10 seconds is 35%, which is less than the CPU resource usage lower limit of 50%, the first resource reduction strategy is used to allocate less CPU resources and less memory to the database instance A.

[0082] The first resource adjustment strategy includes a first resource increasing strategy and a first resource decreasing strategy. For example, if the load change characteristic data of the database instance A is a spike change, the first resource increasing strategy is to increase the resource according to a first proportion, and if the first proportion is 2, the CPU, memory and other resources are doubled; and the first resource decreasing strategy is to decrease the resource according to the first proportion, and if the first proportion is 2, the CPU, memory and other resources are halved.

[0083] The second resource adjustment strategy includes a second resource increasing strategy and a second resource decreasing strategy. For example, if the load change characteristic data of the database instance A is a periodic change, the second resource increasing strategy is to increase the resource according to a second proportion, and if the second proportion is 0.25, the CPU, memory and other resources are increased by 25%; and the second resource decreasing strategy is to decrease the resource according to the second proportion, and if the second proportion is 0.25, the CPU, memory and other resources are decreased by 25%.

[0084] In one example, the database node is further configured to receive second resource allocation data of the existing database instance at a future time sent by the center management node; and obtain third resource allocation data of the existing database instance at the future time according to the first resource allocation data and the second resource allocation data.

[0085] The second resource allocation data can be obtained in the following manner: the center management node obtains statistical data of the resource usage data and / or the state data at multiple time points within a first period according to the resource usage data and / or the state data at the multiple time points within the first period; and obtains the second resource allocation data according to the statistical data. For example, statistical data of the CPU usage rate of the database instance A at multiple time points within a first period is analyzed, such as the average value of the CPU usage rate at 8:05:15 every day in the last 30 days is 30%, which is taken as the second resource allocation data of the database instance A at 8:05:15. The first resource allocation data and the second resource allocation data obtained by the above manner are weighted and summed to obtain the third resource allocation data. In this way, the accuracy of the resource elasticity adjustment can be further improved.

[0086] In one example, the database node is further configured to receive fourth resource allocation data of a new database instance or a migrated database instance sent by the center management node; and run the new database instance or the migrated database instance according to the fourth resource allocation data. The center management node can determine the fourth resource allocation data of the new database instance or the migrated database instance by using existing resource allocation logic.

[0087] In practical implementation, the system provided in this application allows database nodes to allocate resources to existing database instances, while also allowing the central management node to allocate resources to new or migrated database instances. All allocated resources belong to the database nodes, meaning both types of resource allocation will compete for the same resource simultaneously. To prevent resource allocation overflow, the allocatable resources of the database nodes can be locked when either the central management node or a database node performs resource allocation. This locking mechanism ensures that only the central management node or a database node can allocate resources at any given time.

[0088] like Figure 4 As shown, in this embodiment, the database node may include the following components: a detector, a first collector, a first analyzer, a first resource allocator, a resource locker, and an executor; the central management node may include: a second collector, a second analyzer, and a second resource allocator. The detector is responsible for detecting the status data and resource usage data of the database instance and reporting them to the first and second collectors. The first collector collects the data required for local analysis of the database node. This data includes, but is not limited to, data on the database instance's usage of hardware resources such as CPU, memory, and disk, and may also include the database instance's status data (such as the number of connections). The second collector collects the data required for predictive analysis by the central management node. This data includes, but is not limited to, information on the database instance's usage of hardware resources such as CPU, memory, and disk, and may also include data such as the database instance's connection count, requests per second (QPS), system throughput (TPS), slow SQL (structured query statements), and cache hit rate. The second analyzer analyzes and predicts the load change characteristics of the database instance based on long-term (e.g., the last 30 days) resource usage data and / or status data. The first analyzer uses short-term (e.g., the last 10 seconds) resource usage and status data to analyze and predict the database instance's performance over the most recent short period. It then combines this with long-term load change characteristics data to calculate a more accurate resource allocation strategy, such as doubling or increasing resource usage by 25%. The resource allocator schedules and allocates resources according to the allocation strategy. The first resource allocator only schedules and allocates resources for existing database instances on the same database node, while the second resource allocator can schedule and allocate resources for new or migrated database instances across multiple database nodes. The resource lock resolves the allocation of resources used by multiple database instances on the same database node, preventing inconsistencies in resource allocation. The executor executes the resource allocator's allocation results on the specific database instances.

[0089] In one example, the database node is specifically configured to acquire the state data and the resource usage data at a timing (e.g., every second). The resource usage data includes, but is not limited to, CPU, memory, disk, and connection number used by the database instance. The state data includes, but is not limited to, QPS (number of requests per second), TPS (number of transactions per second), and CacheHit (cache hit rate) of the database instance. The database node is specifically configured to store the state data and the resource usage data in a second period in a cache. The central management node is specifically configured to store the resource usage data and the state data in a first period in a database. The central management node device can generate the load change characteristic data periodically (e.g., every day).

[0090] The following takes the MySQL database as an example to describe the processing flow of resource allocation. The processing flow is as follows:

[0091] 1. First, the detector detects the current resource usage of the database instance at a timing (e.g., every second), monitors the CPU, memory, disk, and connection number used by the current database process as the resource usage data of MySQL, and monitors the QPS (number of requests per second), TPS (number of transactions per second), and CacheHit (cache hit rate) of the instance as the state data of MySQL. The resource usage data and the state data are reported to the first collector of the database node and the second collector of the central node.

[0092] 2. The first collector collects the data reported by the detector, which will be cached in the cache (Cache). At the same time, the first collector will maintain a window of time T (i.e., a second period, such as 30 seconds) as a sliding window, which contains all data within the nearest T time from the current time as the input of the first analyzer.

[0093] 3. The second collector collects the data reported by the detector, which will be landed in the historical database for the second analyzer to analyze at a timing.

[0094] 4. The second analyzer will analyze the data in the historical database every certain period of time (e.g., every day) to generate the load change characteristic data of the database instance through machine learning and deliver the load change characteristic data to the first analyzer as input.

[0095] 5. The first analyzer will analyze the future resource usage change trend by combining the data in the real-time sliding window and the load change characteristic data generated by the second analyzer as parameters.

[0096] 6、the first resource allocator acquires the resource lock according to the result of the first analyzer, so as to obtain the right of resource allocation of the database node, and can suppress the demand of the central management node for allocating resources to the new database instance at the same time, and then completes resource allocation; the second resource allocator acquires the resource lock according to the result of the second analyzer, so as to obtain the right of resource allocation of the database node, and can suppress the demand of the database node for allocating resources to the existing database instance at the same time, and then completes resource allocation.

[0097] 7、the executor modifies the resource allocation related parameters of the database instance such as BufferPool by changing the cgroup, expanding the disk, changing the database parameters, etc. after receiving the execution instruction.

[0098] From the above embodiment, the resource allocation method provided by the embodiment of the application can obtain the state data and / or resource (such as CPU and memory) usage data of the existing database instance through the database node; send the resource usage data and / or the state data to the central management node; the central management node obtains the load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period (a long period, which can be days, such as 30 days); send the load change characteristic data to the database node; the database node obtains the first resource allocation data of the existing database instance at a future time (such as the next second) according to the load change characteristic data and the resource usage data of the existing database instance in a second period (a short period, which can be seconds, such as 30 seconds), and the length of the first period is greater than the length of the second period. By using this processing method, the resource allocation controlled by the central management node is converted into the resource allocation decision made by the central management node and the database node in combination, the central management node makes long period trend prediction, and the algorithm power redundancy of the database node is used for long-short period combined prediction, sliding window prediction and decentralized resource allocation are realized, short period resource allocation data communication between the central management node and the database node is avoided, and link consumption is reduced; therefore, the resource pop-up efficiency and accuracy can be effectively improved, and the computing resources are more consistent with the system pressure. In addition, using the algorithm power of the database node for resource allocation can also improve the resource utilization rate. Furthermore, the way of making resource allocation decision in combination of the central management node and the database node also makes it possible that even if the central management node is upgraded or iterated or abnormal, the resource allocation of the database instance will not be affected; therefore, the robustness of resource allocation can be effectively improved.

[0099] Second embodiment

[0100] In the above-mentioned embodiments, a resource allocation system is provided, and the present application also provides a resource allocation method. The execution subject of the method includes but is not limited to a database node. The method corresponds to the above-mentioned embodiments of the system. Since the method embodiments are basically similar to the system embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the system embodiments. The following described method embodiments are only illustrative.

[0101] Please refer to Figure 5 which is a flowchart of an embodiment of the resource allocation method of the present application. In the embodiment, the method includes:

[0102] Step S501: The database node acquires state data and / or resource usage data of an existing database instance.

[0103] The state data includes but is not limited to at least one of the following: the number of connections of the database instance, the request amount per second, the system throughput, the structured query statement running slowly, and the cache hit rate. The resource usage data includes but is not limited to at least one of the following: the usage data of the central processing unit (CPU), the memory usage data, and the disk usage data.

[0104] Step S503: The resource usage data and / or the state data are sent to a central management node.

[0105] Step S505: The load change characteristic data of the existing database instance in a first period is received, which is sent by the central management node.

[0106] Step S507: According to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the first resource allocation data of the existing database instance at a future time is acquired, and the length of the first period is greater than the length of the second period.

[0107] The length of the first period includes a day level time length, such as 30 days. The length of the second period includes a second level time length, such as 30 seconds. The length of the future time includes a second level time length, such as the next second or the next two seconds.

[0108] The load change characteristic data can be the load demand change law of the database instance in a long period (the first period), which can reflect the load demand change characteristics of the database instance. The load demand change will affect the resource demand change. The load change characteristic data includes but is not limited to the following: a burr-like change, a periodic change, and a long-term pause-like change. As shown in Figure 3a As shown in Figure 3bAs shown, the periodic change refers to a periodic change in the load demand of the database instance. The long-term pause change refers to a change in the load demand of the database instance.

[0109] In implementation, the load change characteristic data can be obtained in the following manner: the central management node obtains statistical data of the resource usage data at multiple time points in the first period according to the resource usage data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points.

[0110] In implementation, the method can further include the following steps: the central management node obtains pressure statistical data of the database instance on the resource at multiple time points in the first period according to the state data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points and the pressure statistical data of the resource at the multiple time points.

[0111] In one example, step S507 can adopt at least one of the following manners: if the resource usage data in the second period meets the resource adjustment condition and the load change characteristic data is the glitch change, the first resource allocation data is obtained according to the first resource adjustment strategy; and if the resource usage data in the second period meets the resource adjustment condition and the load change characteristic data is the periodic change, the first resource allocation data is obtained according to the second resource adjustment strategy.

[0112] The resource adjustment condition includes but is not limited to: the resource usage data in the second period exceeds a first resource usage threshold or is lower than a second resource usage threshold; the first resource adjustment strategy includes a first resource increase strategy and a first resource decrease strategy, and the second resource adjustment strategy includes a second resource increase strategy and a second resource decrease strategy.

[0113] In one example, the method can further include the following steps: receiving the second resource allocation data of the existing database instance at a future time sent by the central management node; and obtaining third resource allocation data of the existing database instance at the future time according to the first resource allocation data and the second resource allocation data.

[0114] The second resource allocation data can be obtained as follows: The central management node obtains statistical data of the resource usage data at multiple moments within the first period, based on the resource usage data of the first period; and obtains the second resource allocation data based on the statistical data. For example, analyzing the statistical data of CPU utilization of database instance A at multiple moments within the first period, such as the average CPU utilization at 8:05:15 AM every day for the last 30 days being 30%, this data is used as the second resource allocation data of database instance A at 8:05:15 AM. The first and second resource allocation data obtained in the above manner are then weighted and summed to obtain the third resource allocation data. This processing method can further improve the accuracy of resource elastic adjustment.

[0115] In one example, the method may further include the following steps: receiving fourth resource allocation data for a new database instance or a migrated database instance sent by a central management node; and running the new database instance or the migrated database instance according to the fourth resource allocation data.

[0116] The term "new database instance" refers to a newly created database instance, such as a newly purchased database instance. The term "existing database instance" refers to a database instance whose database node is already running. The term "migrated database instance" refers to a database instance that is migrated from one database node to another. For example, when a database node becomes unavailable, it is necessary to migrate the database instances on that node to other database nodes. In this case, nodes and resources need to be allocated to the migrated database instances.

[0117] like Figure 4 As shown, the central management node may include a second resource allocator for allocating resource data to new or migrated database instances. This approach allows the central management node to not only cooperate with database nodes to allocate resources to existing database instances within those nodes, but also to use existing resource allocation logic to allocate resource data to new or migrated database instances.

[0118] In one example, the method may further include the following steps: when the central management node performs resource allocation processing or the database node performs resource allocation processing, locking the allocatable resources of the database node.

[0119] In a specific implementation, the system provided by the embodiments of the present application allows the database node to allocate resources to the existing database instance, and allows the central management node to allocate resources to the new database instance or the migrated database instance. The allocated resources are all resources of the database node. It can be seen that the two resource allocation processes compete for the same resource at the same time. In order to avoid resource allocation overflow, the central management node or the database node performs the resource allocation process, and the lock processing is performed on the allocable resources of the database node. Through the lock control, only the central management node or the database node can perform the resource allocation at the same time.

[0120] Third embodiment

[0121] In the above embodiments, a resource allocation method is provided, and the present application also provides a resource allocation device corresponding to the method. The device corresponds to the above-mentioned embodiments of the scheduling method. Since the device embodiments are basically similar to the method embodiments, the description is relatively simple, and the related parts can be referred to the part of the method embodiments. The device embodiments described below are only illustrative.

[0122] The present application further provides a resource allocation device, comprising: a data acquisition unit, a data reporting unit, a data receiving unit, a resource allocation unit,

[0123] The data acquisition unit is configured to acquire state data and / or resource usage data of the existing database instance by the database node. The data reporting unit is configured to send the resource usage data and / or the state data to the central management node. The data receiving unit is configured to receive the load change characteristic data of the existing database instance in a first period sent by the central management node. The resource allocation unit is configured to acquire first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data of the existing database instance in a second period. The length of the first period is greater than the length of the second period.

[0124] In one example, the resource allocation unit is specifically configured to acquire the first resource allocation data according to a first resource adjustment strategy if the resource usage data in the second period meets a resource adjustment condition and the load change characteristic data is a spike-like change. The resource allocation unit is specifically configured to acquire the first resource allocation data according to a second resource adjustment strategy if the resource usage data in the second period meets the resource adjustment condition and the load change characteristic data is a periodic change.

[0125] In one example, the apparatus can further include a second resource allocation data receiving unit configured to receive second resource allocation data of the existing database instance at a future time sent by the central management node; and the resource allocation unit is further configured to obtain third resource allocation data of the existing database instance at the future time according to the first resource allocation data and the second resource allocation data.

[0126] In one example, the apparatus can further include a fourth resource allocation data receiving unit configured to receive fourth resource allocation data of the new database instance or the migrated database instance sent by the central management node; and the new database instance or the migrated database instance is run according to the fourth resource allocation data.

[0127] In one example, the apparatus can further include a resource lock management unit configured to perform a lock process on the allocable resources of the database node when the central management node performs the resource allocation process or the database node performs the resource allocation process.

[0128] Fourth Embodiment

[0129] In the above embodiments, a resource allocation system is provided, and the present application further provides a resource allocation method. The execution subject of the method includes but is not limited to the central management node. The method corresponds to the above-mentioned embodiments of the system. Since the method embodiments are basically similar to the system embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the system embodiments. The following described method embodiments are only illustrative.

[0130] Please refer to Figure 6 which is a flowchart of an embodiment of the resource allocation method of the present application. In the embodiment, the method includes the following steps.

[0131] Step S601: receiving the state data and the resource usage data of the existing database instance sent by the database node apparatus.

[0132] Step S601: generating the load change characteristic data of the existing database instance in the first period according to the resource usage data and the state data in the first period.

[0133] Step S601: sending the load change characteristic data to the database node apparatus.

[0134] In one example, the method can further include the following steps: allocating resources for the new database instance; and sending the resource data allocated for the new database instance to the database node.

[0135] Fifth Embodiment

[0136] In the above-mentioned embodiments, a resource allocation method is provided, and the present application further provides a resource allocation apparatus corresponding to the method. The apparatus corresponds to the above-mentioned embodiments of the resource allocation method. Since the apparatus embodiments are basically similar to the method embodiments, the description is relatively simple, and the related parts can be referred to the part of the method embodiments. The apparatus embodiments described below are merely illustrative.

[0137] The present application further provides a resource allocation apparatus, comprising: a data receiving unit, a long-term characteristic data generating unit, and a long-term characteristic data sending unit.

[0138] The data receiving unit is configured to receive state data and / or resource usage data of an existing database instance sent by a database node; the data obtaining unit is configured to obtain load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period; and the data sending unit is configured to send the load change characteristic data to the database node, so that the database node obtains first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period.

[0139] In one example, the apparatus can further comprise a second resource allocation unit and a resource allocation data sending unit. The resource allocation unit is configured to allocate resources for a new database instance; and the resource allocation data sending unit is configured to send resource data allocated for the new database instance to the database node.

[0140] Sixth embodiment

[0141] In the above-mentioned embodiments, a resource allocation method is provided, and the present application further provides an electronic device corresponding to the method. The device corresponds to the above-mentioned embodiments of the method. Since the device embodiments are basically similar to the method embodiments, the description is relatively simple, and the related parts can be referred to the part of the method embodiments. The device embodiments described below are merely illustrative.

[0142] The present application further provides an electronic device, comprising: a communication interface, a processor, and a memory. The memory is configured to store a program for implementing the resource allocation method provided in the above-mentioned method embodiments, and the terminal is powered on and runs the program of the method through the processor.

[0143] The present application discloses the above-mentioned preferred embodiments, but is not intended to limit the present application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application should be subject to the scope defined by the claims of the present application.

[0144] In one typical arrangement, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0145] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) being used by the computer system to store data and program code. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other memory technology, CD-ROM, digital versatile disks (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information for access by a computer.

[0146] 1. Computer-readable media includes permanent and non-permanent, removable and non-removable media 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 disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. According to the definition in this paper, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carriers.

[0147] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as a method, system or computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

Claims

1. A resource allocation method, comprising: a database node obtaining state data and / or resource usage data of an existing database instance; sending the resource usage data and / or the state data to a central management node; receiving load change characteristic data of the existing database instance in a first period sent by the central management node; obtaining first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period, the first period being a day level and the second period being a second level. 2.The method of claim 1, wherein the load change characteristic data is obtained in the following manner: the central management node obtains statistical data of the resource usage data at multiple time points in the first period according to the resource usage data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points. 3.The method of claim 2, further comprising: the central management node obtains pressure statistical data of the database instance on resources at multiple time points in the first period according to the state data in the first period; and obtains the load change characteristic data according to the statistical data at the multiple time points and the pressure statistical data of the database instance on resources at the multiple time points. 4.The method of claim 1, wherein the obtaining of the first resource allocation data of the existing database instance at the future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in the second period comprises at least one of the following manners: if the resource usage data and / or the state data in the second period meets a resource adjustment condition and the load change characteristic data is a glitch-like change, obtaining the first resource allocation data according to a first resource adjustment strategy; and if the resource usage data and / or the state data in the second period meets the resource adjustment condition and the load change characteristic data is a periodic change, obtaining the first resource allocation data according to a second resource adjustment strategy. 5.The method of claim 1, further comprising: receiving second resource allocation data of the existing database instance at the future time sent by the central management node; and obtaining third resource allocation data of the existing database instance at the future time according to the first resource allocation data and the second resource allocation data.

6. The method of claim 1, characterized in that, further comprising: receiving fourth resource allocation data of a new database instance or a migrated database instance sent by the central management node; and running the new database instance or the migrated database instance according to the fourth resource allocation data. 7.The method of claim 6, further comprising: locking the allocable resources of the database node when the central management node or the database node performs the resource allocation processing. 8.A resource allocation method, comprising: a central management node receiving state data and / or resource usage data of an existing database instance sent by a database node; The central management node obtains load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period; The central management node sends the load change characteristic data to the database node, so that the database node obtains first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period is greater than the length of the second period, the first period is a day level, and the second period is a second level.

9. The method of claim 8, further comprising: allocating resources of the database node for the new database instance or the migrated database instance; sending resource allocation data to the database node, so that the database node runs the new database instance or the migrated database instance according to the resource allocation data.

10. A resource allocation apparatus, comprising: a data collection unit configured to acquire state data and / or resource usage data of an existing database instance by a database node; a data reporting unit configured to send the resource usage data and / or the state data to a central management node; a data receiving unit configured to receive load change characteristic data of the existing database instance in a first period sent by the central management node; a resource allocation unit configured to obtain first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data of the existing database instance in a second period, the length of the first period being greater than the length of the second period, the first period being a day level, and the second period being a second level.

11. A resource allocation apparatus, comprising: a data receiving unit configured to receive state data and / or resource usage data of an existing database instance sent by a database node by a central management node; a data obtaining unit configured to obtain load change characteristic data of the existing database instance in a first period according to the resource usage data and / or the state data in the first period by the central management node; a data sending unit configured to send the load change characteristic data to the database node by the central management node, so that the database node obtains first resource allocation data of the existing database instance at a future time according to the load change characteristic data and the resource usage data and / or the state data of the existing database instance in a second period, the length of the first period being greater than the length of the second period, the first period being a day level, and the second period being a second level.

12. An electronic device, comprising: comprising: a communication interface; a processor and a memory; the memory is configured to store a program for implementing the method according to any one of claims 1-7 or 8-9, and the terminal is powered on and runs the program of the method by the processor.

13. A resource allocation system, comprising: the resource allocation apparatus according to claim 10, and the resource allocation apparatus according to claim 11.

Citation Information

Patent Citations

  • Resource scheduling system based on load characteristics in industrial cloud environment

    CN112905343A

  • Predictive resource management

    US20120173477A1