Database container scheduling method and device, electronic equipment and storage medium
By acquiring historical resource data and time-series prediction models of database containers, and combining them with a multi-factor weighted scheduling scoring model, the problem of low resource utilization in database container scheduling is solved, realizing intelligent dynamic scheduling of database containers and improving resource utilization and business processing efficiency.
Patent Information
- Application Number
- CN202511765446.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies that schedule database containers based on static information result in low resource utilization and low efficiency in database business processing. They cannot adapt to the dynamic resource needs of database instances, leading to resource waste or competition.
By acquiring historical resource data from database containers and combining it with time series forecasting models to predict future resource demands, a multi-factor weighted scheduling scoring model is adopted. Based on business level labels and resource load adaptability, a scheduling score is calculated to achieve dynamic and intelligent scheduling.
It improves database resource utilization and business processing efficiency, avoids resource waste and competition, ensures the stable operation and service quality of critical businesses, and enhances the accuracy and fairness of scheduling.
Smart Images

Figure CN121579136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database technology, and specifically to a database container scheduling method, apparatus, electronic device, and storage medium. Background Technology
[0002] As database systems evolve towards containerization and cloud-native architectures, they are deployed on private cloud resource orchestration platforms centered around Kubernetes. During the containerization deployment of databases, the scheduling mechanism of database containers is a crucial factor affecting data processing efficiency within Kubernetes.
[0003] In related technologies, scheduling is typically performed using a Kubernetes scheduler, which makes scheduling decisions for database containers based on static information such as current resource request volume and node resource idle rate. However, in real-world scenarios, the business load characteristics of different instances vary significantly, and resource consumption patterns exhibit dynamic and fluctuating patterns. Especially during peak periods or periodic job execution, resource demands often surge in short periods. This scheduling based on static information of nodes and database containers results in scheduling decisions lacking foresight, failing to effectively adapt to real resource demands, leading to resource waste or resource contention, and reducing resource utilization and database business processing efficiency. Summary of the Invention
[0004] In view of this, it is necessary to provide a database container scheduling method, apparatus, electronic device and storage medium to solve the technical problems of low database resource utilization and low database business processing efficiency in the prior art of database container scheduling based on static information.
[0005] To address the aforementioned technical problems, in a first aspect, the present invention provides a database container scheduling method, the method comprising: In one possible implementation, historical resource data of the database containers of each candidate node in the current cluster during operation is obtained, wherein the database containers are configured with business level tags; Based on the historical resource data, predict the resource demand of each candidate node's database container within a future preset time window. Based on the current resource usage data corresponding to each candidate node and the predicted resource demand, the resource load adaptability of the candidate node is calculated. Based on the service level label and the resource load adaptability, a scheduling score for each candidate node is calculated using a multi-factor weighted scheduling scoring model. The target node is determined based on the scheduling score of the candidate nodes, and the database container is scheduled based on the target node.
[0006] In one possible implementation, the current resource usage data includes the current remaining resource amount and the current resource load, and the resource load adaptability includes resource adaptability and load adaptability; calculating the resource load adaptability of the candidate nodes based on the current resource usage data corresponding to each candidate node and the predicted resource demand includes: The resource suitability is calculated based on the ratio between the current remaining resources and the predicted resource demand. The predicted amount of redundant resources for the candidate nodes is predicted based on the current resource load and the current remaining resource amount. The load adaptability is determined based on the predicted demand resources, the predicted redundant resources, and the current remaining resources.
[0007] In one possible implementation, determining the load adaptability based on the predicted demand resource amount, the predicted redundant resource amount, and the current remaining resource amount includes: Obtain the resource load fluctuation of the candidate nodes; The effective remaining resource amount is determined based on the current remaining resource amount and the resource load fluctuation. The expected remaining amount of resources is determined based on the predicted amount of redundant resources and the predicted amount of demand resources. The load fit is determined based on the ratio between the effective remaining resources and the expected remaining resources.
[0008] In one possible implementation, the multi-factor weighted scheduling scoring model includes a first weight corresponding to the service level label, a second weight corresponding to the resource adaptability, and a third weight corresponding to the load adaptability. Based on the service level label and the resource load adaptability, a scheduling score for each candidate node is calculated using a multi-factor weighted scheduling scoring model, including: The corresponding business compatibility is determined based on the business level label; The scheduling score is determined based on the service adaptability and the first weight, the resource adaptability and the second weight, and the load adaptability and the third weight.
[0009] In one possible implementation, scheduling the database container based on the target node includes: The database capacity is dynamically deployed based on the target node through an independent scheduling extension component.
[0010] In one possible implementation, after scheduling the database container based on the target node, the method further includes: Obtain the scheduling result of the database container; Based on the scheduling results, reinforcement learning is performed on the scheduling scoring model based on multi-factor weighting.
[0011] In one possible implementation, the step of predicting the predicted resource demand of each candidate node's database container within a future preset time window based on the historical resource data includes: When the sample size of the historical resource data is less than a preset sample size threshold, an exponential moving average time series model is used to predict the historical resource data to obtain the predicted resource demand of each candidate node's database container within a future preset time window. When the sample data volume of the historical resource data is greater than or equal to the preset sample size threshold, the historical resource data is predicted using an LSTM-based time series model to obtain the predicted resource demand of each candidate node's database container within a future preset time window.
[0012] Secondly, the present invention also provides a database container scheduling device, the device comprising: The acquisition unit is used to acquire historical resource data of the database containers of each candidate node in the current cluster during operation, wherein the database containers are configured with business level tags; The prediction unit is used to predict the required resource quantity of each candidate node's database container within a future preset time window based on the historical resource data. The first calculation unit is used to calculate the resource load adaptability of the candidate nodes based on the current resource usage data corresponding to each candidate node and the predicted amount of required resources. The second calculation unit is used to calculate the scheduling score of each candidate node based on the service level label and the resource load adaptability using a multi-factor weighted scheduling scoring model. The scheduling unit is used to determine the target node based on the scheduling score of the candidate node, and to schedule the database container based on the target node.
[0013] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein the memory is used to store a program; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the database container scheduling method described in any of the above implementations.
[0014] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps of the database container scheduling method described in any of the above implementations.
[0015] The beneficial effects of this invention are: The database container scheduling method provided by this invention acquires historical resource data of the database containers of each candidate node in the current cluster during their operation. This data is then combined with a time series prediction model to predict the resource requirements of the database containers. This acquisition of dynamic resource data from the database platform avoids blind scheduling based on static resource requests, enabling intelligent dynamic scheduling of database containers. The database containers are configured with business level tags to ensure that subsequent scheduling strategies have priority control capabilities. Based on historical resource data, the method predicts the resource requirements of each candidate node's database containers within a preset future time window. This allows for the perception of historical resource usage patterns, ensuring the accuracy of the resource requirement prediction. Furthermore, predicting the resource requirement enables forward-looking and dynamic adaptation in subsequent scheduling decisions, avoiding blind scheduling based on static resource requests, reducing the randomness and uncertainty of resource allocation, and achieving intelligent dynamic scheduling of database containers. Based on the current resource usage data and predicted resource requirements of each candidate node, the method calculates... The resource load adaptability of candidate nodes is quantitatively calculated, effectively adapting to the real resource needs of database containers and avoiding resource waste or competition in subsequent database container scheduling strategies. Based on business level tags and resource load adaptability, a multi-factor weighted scheduling scoring model is used to calculate the scheduling score of each candidate node, avoiding the defects of static weight settings and improving the rationality and accuracy of scheduling scores. This facilitates subsequent flexible consideration of business priorities and resource balance based on scheduling scores, enhancing the scheduling mechanism's ability to optimize multiple objectives, improving the level of scheduling intelligence, and increasing the accuracy and fairness of resource scheduling. It can also adapt to complex resource scheduling scenarios and ensure service quality. Based on the scheduling scores of candidate nodes, target nodes are determined, and database containers are scheduled based on target nodes. This achieves dynamic, intelligent, and hierarchical awareness scheduling of database containers in the cloud platform, improving the resource matching degree, scheduling accuracy, and business assurance capabilities of the database system. It can effectively adapt to real resource needs, avoid resource waste or competition, and improve database resource utilization and database business processing efficiency. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic flowchart of an embodiment of the database container scheduling method provided by the present invention; Figure 2 For the present invention Figure 1 A schematic diagram of an embodiment of S103; Figure 3 For the present invention Figure 2 A schematic diagram of an embodiment of S203; Figure 4 A schematic diagram of an embodiment of the database container scheduling device provided by the present invention; Figure 5 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0019] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0020] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.
[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0022] The execution subject of the database container scheduling method in this application embodiment can be the database container scheduling device provided in this application embodiment, or different types of electronic devices such as server equipment, physical host, or user equipment (UE) that integrate the database container scheduling device. The database container scheduling device can be implemented in hardware or software. The UE can be a terminal device such as a smartphone, tablet computer, laptop computer, handheld computer, desktop computer, or personal digital assistant (PDA).
[0023] Currently, the Kubernetes scheduler primarily makes scheduling decisions based on static information such as current resource request volume and node resource idle rate. It lacks the ability to model historical resource usage patterns of database containers and cannot perceive the importance of the business corresponding to each database instance. This can lead to critical database containers being scheduled to resource-constrained nodes, impacting system stability; ordinary database containers potentially preempting high-performance resources, resulting in resource waste; and a lack of global awareness and dynamic optimization mechanisms in resource contention scenarios. Furthermore, traditional scheduling strategies struggle to meet the "business-centric" resource orchestration requirements and cannot achieve truly resource-aware intelligent scheduling of database containers.
[0024] In view of this, the embodiments of this application combine the historical resource patterns of database container operation, business levels, and resource prediction mechanisms to realize dynamic scheduling optimization of database container instances in the resource orchestration platform, which is used to improve the resource utilization efficiency and critical business scheduling guarantee capability of the database in the private cloud, thereby improving the database resource utilization rate and database business processing efficiency.
[0025] This invention provides a database container scheduling method, apparatus, electronic device, and storage medium, which are described below.
[0026] Figure 1 This is a schematic flowchart of an embodiment of the database container scheduling method provided by the present invention, as shown below. Figure 1 As shown, the method includes: S101. Obtain historical resource data of the database containers of each candidate node in the current cluster during operation, wherein the database containers are configured with business level tags.
[0027] In this context, the current cluster refers to the set of all compute nodes that are in the Ready state at the time of scheduling and are managed by the same Kubernetes control plane. In this embodiment, the cluster can be a Kubernetes cluster. Candidate nodes are the compute nodes of the current cluster. Historical resource data refers to the periodically persisted resource usage data sampled from all database containers running on the candidate nodes within the past T time window, including CPU utilization, memory usage, historical peak resource usage, and resource usage time series.
[0028] The inventors discovered that databases serve different levels of business importance, resulting in significant differences in scheduling and guarantee capabilities. Certain critical systems (such as core transaction systems and master data platforms) have higher requirements for resource stability than general analytical or testing databases. This leads to a situation where database instances in cloud platforms typically serve different types of business systems with varying levels of business importance. However, existing scheduling strategies generally employ a homogenized approach, failing to dynamically adjust scheduling priorities based on the criticality of the business served by the database. This can easily lead to scheduling failures or performance degradation of core business databases due to resource conflicts. Therefore, in this embodiment, business level labels are configured for database containers. These business level labels refer to the business level identifier assigned to each database container instance by the electronic device. For example, business level labels can be divided into: Level 1 (L1) corresponding to critical core business databases, Level 2 (L2) corresponding to important support databases, and Level 3 (L3) corresponding to non-critical databases such as testing and analysis databases. Therefore, this embodiment introduces the concept of database business levels, assigning different scheduling priority weights to database containers of different business levels. This enables control over the scheduling priority of database containers based on the business level corresponding to the business level label, ensuring that critical business databases are prioritized in resource competition and guaranteeing the stable operation and service quality of critical businesses.
[0029] Specifically, data can be acquired in real-time through a monitoring system (such as Prometheus) and stored in a data platform used for model training and prediction. Historical resource data can then be retrieved from this data platform to subsequently combine with time series prediction models to predict database container resource requirements. This dynamic resource data acquisition from the database platform avoids blind scheduling based on static resource requests, enabling intelligent dynamic scheduling of the database container. Business level tags can be generated through custom tags, configuration fields, or platform business interfaces, such as through YAML files or platform management interfaces, to adapt to different business scenarios. These tags are used for subsequent scheduling priority calculations, ensuring that subsequent scheduling strategies have scheduling priority control capabilities.
[0030] S102. Based on the historical resource data, predict the resource demand of each candidate node's database container within a future preset time window.
[0031] Among them, the demand resource forecast refers to the demand resources predicted based on the historical resource data of the database container to predict future resource demand.
[0032] Specifically, based on historical resource data and a time-series forecasting model, the predicted resource demand of each candidate node's database container within a future preset time window can be predicted. This embodiment predicts the predicted resource demand based on historical resource data, thereby perceiving the historical resource usage patterns of the database container, ensuring the accuracy of the predicted resource demand. Furthermore, by predicting the predicted resource demand, subsequent scheduling decisions can be made more forward-looking and dynamically adaptable, avoiding blind scheduling based on static resource requests, reducing the blindness and uncertainty of resource allocation, and achieving intelligent dynamic scheduling of the database container.
[0033] S103. Based on the current resource usage data corresponding to each candidate node and the predicted resource demand, calculate the resource load adaptability of the candidate node.
[0034] Here, current resource usage data refers to the real-time resource usage data of candidate nodes. Resource load adaptability refers to the degree of adaptability between the predicted resource demand of the database container and the available resources of the candidate nodes, as well as the matching degree of the resource load status of the candidate nodes.
[0035] Specifically, by using the current resource usage data and predicted resource demand of each candidate node, the resource load adaptability of the candidate node is calculated, thus realizing the quantitative calculation of the resource load adaptability of the candidate node. This enables effective adaptation to the real resource demand of the database container and avoids resource waste or resource contention in subsequent database container scheduling strategies.
[0036] S104. Based on the service level label and the resource load adaptability, calculate the scheduling score of each candidate node using a multi-factor weighted scheduling scoring model.
[0037] Among them, the multi-factor weighted scheduling scoring model is a mathematical model that uses a fusion of multiple factors for weighted evaluation of the scheduling score of candidate nodes. The scheduling score is suitable for evaluating the matching degree between candidate nodes and database containers; the higher the score, the more suitable the candidate node is to host the corresponding database container instance.
[0038] Specifically, a mapping table between service level labels and preset service scheduling scores can be set in advance. The preset service scheduling scores corresponding to the service level labels can be obtained from the mapping table, and the resource load adaptability can be used as the corresponding resource scheduling score. Then, the preset service scheduling scores and resource scheduling scores can be substituted into the scheduling score model based on multi-factor weighting to calculate the scheduling score of each candidate node.
[0039] Understandably, this embodiment considers the business level tags of the database container and the resource load adaptability of candidate nodes, and uses a multi-factor weighted calculation method to calculate the scheduling score. It integrates multiple factors and calculates according to their respective weights, avoiding the defects of static weight settings. This improves the rationality and accuracy of the scheduling score, and facilitates subsequent flexible consideration of business priorities and resource balance based on the scheduling score. It enhances the scheduling mechanism's ability to optimize multiple objectives, strengthens the level of scheduling intelligence, and improves the accuracy and fairness of resource scheduling. At the same time, it can adapt to complex resource scheduling scenarios and ensure service quality.
[0040] It is worth noting that by incorporating business registration tags into the calculation of scheduling scores, the scheduling priority can be dynamically adjusted according to the criticality of the business carried by the database, thus avoiding scheduling failures or performance degradation of core business databases due to resource conflicts.
[0041] S105. Determine the target node based on the scheduling score of the candidate nodes, and schedule the database container based on the target node.
[0042] The target node can be the candidate node with the highest scheduling score.
[0043] Specifically, database containers are scheduled based on target nodes. Since the target node is the candidate node with the highest scheduling score, and the scheduling score is based on multi-dimensional information including comprehensive business level tags, historical resource data, current resource usage data, and predicted resource demand, dynamic, intelligent, and hierarchical awareness scheduling of database containers in the cloud platform is achieved. This improves the resource matching degree, scheduling accuracy, and business assurance capability of the database system, effectively adapts to real resource needs, avoids resource waste or resource competition, and improves database resource utilization and database business processing efficiency.
[0044] In summary, the database container scheduling method provided by this invention obtains historical resource data of the database containers of each candidate node in the current cluster during their operation. This data is then combined with a time series prediction model to predict the resource requirements of the database containers, thus obtaining dynamic resource data of the database platform. This avoids blind scheduling based on static resource requests and enables intelligent dynamic scheduling of database containers. The database containers are configured with business level tags to ensure that subsequent scheduling strategies have priority control capabilities. Based on historical resource data, the method predicts the resource requirements of each candidate node's database containers within a preset future time window. This allows for the perception of historical resource usage patterns of the database containers, ensuring the accuracy of the resource requirement prediction. Furthermore, predicting the resource requirement enables forward-looking and dynamic adaptation in subsequent scheduling decisions, avoiding blind scheduling based on static resource requests, reducing the blindness and uncertainty of resource allocation, and achieving intelligent dynamic scheduling of database containers. This is achieved based on the current resource usage data and resource requirement predictions of each candidate node. The system quantifies the resource load adaptability of candidate nodes, enabling effective adaptation to the real resource needs of database containers and avoiding resource waste or contention in subsequent database container scheduling strategies. Based on business level labels and resource load adaptability, a multi-factor weighted scheduling scoring model is used to calculate the scheduling score of each candidate node. This avoids the shortcomings of static weight settings, improving the rationality and accuracy of scheduling scores. This facilitates flexible consideration of business priorities and resource balance based on scheduling scores, enhancing the scheduling mechanism's multi-objective optimization capabilities, increasing scheduling intelligence, and improving the accuracy and fairness of resource scheduling. It also adapts to complex resource scheduling scenarios, ensuring service quality. Based on the scheduling scores of candidate nodes, target nodes are determined, and database containers are scheduled based on these target nodes. This achieves dynamic, intelligent, and hierarchical awareness scheduling of database containers in the cloud platform, improving the resource matching degree, scheduling accuracy, and business assurance capabilities of the database system. It effectively adapts to real resource needs, avoids resource waste or contention, and improves database resource utilization and database business processing efficiency.
[0045] In some embodiments of the present invention, such as Figure 2 As shown, the current resource usage data includes the current remaining resource amount and the current resource load, and the resource load adaptability includes resource adaptability and load adaptability; step S103 includes: S201. Calculate the resource suitability based on the ratio between the current remaining resource quantity and the predicted resource demand quantity; S202. Predict the redundancy resource prediction amount of the candidate node based on the current resource load and the current resource remaining amount; S203. Determine the load adaptability based on the predicted demand resources, the predicted redundant resources, and the current remaining resources.
[0046] Here, the current remaining resource amount is the current idle resource amount of the candidate node. The predicted redundancy resource amount is the resource redundancy assessment amount of the candidate node.
[0047] Specifically, the resource suitability of each candidate node is calculated based on the ratio between the current remaining resource quantity and the predicted resource demand. Then, a redundancy resource prediction model is trained based on the historical resource idleness and historical resource load of the candidate nodes. The predicted redundancy resource quantity is then predicted based on the current resource load and current remaining resource quantity, combined with the redundancy resource prediction model. Finally, the load suitability is determined based on the predicted resource demand, the predicted redundancy resource quantity, and the current remaining resource quantity. Understandably, this embodiment considers candidate node load fluctuations and redundancy resources, enabling a more accurate assessment of node suitability.
[0048] In one specific implementation, the resource suitability can be calculated using the following formula. :
[0049] In the above formula, The remaining amount of resources before, This is a forecast of the resource requirements of the database container within a future preset time window t.
[0050] In some embodiments of the present invention, such as Figure 3 As shown, step S203 includes: S301. Obtain the resource load fluctuation of the candidate node; S302. Determine the effective remaining resource amount based on the current remaining resource amount and the resource load fluctuation amount; S303. Determine the expected remaining amount of resources based on the predicted amount of redundant resources and the predicted amount of demand resources; S304. Determine the load adaptability based on the ratio between the effective remaining resource amount and the expected remaining resource amount.
[0051] Specifically, the fluctuation amount can be determined based on the resource load fluctuation amount and the corresponding load fluctuation weight. The difference between the current remaining resource amount and the load fluctuation amount is determined as the effective remaining resource amount. Then, the redundant resource prediction amount and the corresponding resource redundancy factor are used to determine the redundancy amount. The sum of the redundancy amount and the demand resource prediction amount is determined as the expected remaining resource amount. Finally, the load fit is calculated based on the ratio between the effective remaining resource amount and the expected remaining resource amount. In this embodiment, the load fluctuation and redundant resources of candidate nodes are considered. On nodes with resource redundancy, the fit can be improved, avoiding scheduling bottlenecks caused by resource shortages.
[0052] In one specific implementation, the load adaptability can be calculated using the following formula. :
[0053] In the above formula, The load volatility weight takes into account the changes in the load of candidate nodes. If the fluctuation is large, its suitability will be reduced. This represents the fluctuation in resource load, determined based on user feedback data. The resource redundancy factor is used to adjust the fit of candidate nodes under conditions of redundant resources. When there are many redundant resources, the fit should be increased; the resourceRedundancyFactor is the predicted amount of redundant resources.
[0054] In some embodiments of the present invention, the scheduling scoring model based on multi-factor weighting includes a first weight corresponding to the service level label, a second weight corresponding to the resource adaptability, and a third weight corresponding to the load adaptability; step S104 includes: S401. Determine the corresponding service compatibility based on the service level label; S402. Determine the scheduling score based on the service adaptability and first weight, the resource adaptability and second weight, and the load adaptability and third weight.
[0055] Specifically, the scheduling score is obtained by summing the product of business adaptability and the first weight, the product of resource adaptability and the second weight, and the product of load adaptability and the third weight.
[0056] In one specific implementation, the scheduling score can be calculated using the following formula. :
[0057] In the above formula, For business adaptability, the score is derived from the business level label mapping (e.g., L1=1.0, L2=0.6, L3=0.3). Represents the i-th factor (e.g. , , ), The dynamic weight of the i-th factor. w 1( t ), w 2( t ), w3 ( t ) represent the first weight, the second weight, and the third weight, respectively, which can be dynamically adjusted according to the actual application scenario.
[0058] In some embodiments of the present invention, step S105 includes: S501. Dynamically deploy the database capacity based on the target node using an independent scheduling extension component.
[0059] The standalone scheduling extension component can be integrated into mainstream container scheduling platforms, such as KubernetesScheduler Extender, or a custom scheduler plugin.
[0060] Specifically, an independent scheduling extension component is adopted to dynamically deploy database containers based on target nodes. This achieves a non-intrusive scheduling extension design without modifying the core scheduler code. Intelligent scheduling decisions based on business level and resource prediction are injected into the standard scheduling process, enabling online, dynamic, and non-intrusive optimal deployment of database containers during cluster operation. Simultaneously, this scheduling method reduces implementation difficulty and platform adaptation costs, while possessing good compatibility and maintainability. It can be integrated into existing container cloud platforms, supports containerized deployment of various database types, and has broad applicability and promotional value.
[0061] In some embodiments of the present invention, after step S105, the method further includes: S601. Obtain the scheduling result of the database container; S602. Based on the scheduling results, perform reinforcement learning on the scheduling scoring model based on multi-factor weighting.
[0062] Specifically, based on the scheduling results, reinforcement learning is applied to the scheduling scoring model based on multi-factor weighting, thereby optimizing the model parameters of the scheduling scoring model and further improving the accuracy of the scheduling scoring model.
[0063] In one specific implementation, the process of performing reinforcement learning on the multi-factor weighted scheduling scoring model is as follows: The system status at each moment includes the current node's resource status (e.g., idle CPU, memory, etc.), the current resource usage data of the current database container (e.g., CPU, memory, etc.), the database container's business level label (e.g., L1, L2, L3), and historical scheduling feedback, i.e., scheduling results (e.g., whether scheduling failures occurred, whether resources were overloaded, etc.), defined as:
[0064] Where L represents the service level, and feedback represents historical scheduling feedback.
[0065] Scheduling decision, which involves selecting a candidate node for database container scheduling, is expressed as: ; in, Candidate nodes for scheduling Rewards are given based on the current scheduling results, including positive rewards such as high resource utilization and low latency, and negative rewards such as high resource idle rate (resource waste) or resource overload leading to performance degradation.
[0066]
[0067] Where Utilization represents node resource utilization, Overload represents resource overload, Latency represents scheduling delay, and α and β are adjustment factors.
[0068] The agent is trained using the Deep Q-Network (DQN) algorithm, its policy is updated, and scheduling decisions are optimized: The learning update rule is as follows:
[0069] Where α is the learning rate. It is a discount factor. It indicates an expectation of future rewards.
[0070] The scheduling strategy is continuously adjusted based on the training results, enabling the agent to select the optimal scheduling action under different system states.
[0071] In some embodiments of the present invention, step S102 includes: S701. When the sample data volume of the historical resource data is less than the preset sample volume threshold, the historical resource data is predicted using an exponential moving average time series model to obtain the predicted resource demand of each candidate node's database container within a future preset time window. S702. When the sample data volume of the historical resource data is greater than or equal to the preset sample volume threshold, the historical resource data is predicted using an LSTM-based time series model to obtain the predicted resource demand of each candidate node's database container within a future preset time window.
[0072] Specifically, historical resource data of the database container instance is modeled. When the initial data sample size is small (i.e., the sample size of historical resource data is less than a preset sample size threshold), an exponential moving average is used to predict short-term resource demand, thus obtaining the predicted resource demand of the database container within a preset future time window. : ; Later, once a large amount of data samples is available—that is, when the amount of historical resource data samples is greater than or equal to a preset sample size threshold—an LSTM model based on deep learning is introduced for prediction. The prediction objective is the resource consumption within a preset future time window (such as peak CPU / memory usage over 24 hours), thus obtaining the predicted resource demand of the database container within the preset future time window. This enables proactive awareness of scheduling behavior, allowing us to perceive historical resource usage patterns of the database, adapt to the actual operating characteristics of database containers in private clouds, and improve the overall resource utilization and critical business service assurance capabilities of the system.
[0073] To better implement the database container scheduling method in this embodiment of the invention, based on the database container scheduling method, correspondingly, as follows: Figure 4 As shown, this embodiment of the invention also provides a database container scheduling device, the database container scheduling device 400 including: The acquisition unit 401 is used to acquire historical resource data of the database containers of each candidate node in the current cluster during operation, wherein the database containers are configured with business level tags. Prediction unit 402 is used to predict the required resource amount of each candidate node's database container within a future preset time window based on the historical resource data. The first calculation unit 403 is used to calculate the resource load adaptability of the candidate nodes based on the current resource usage data corresponding to each candidate node and the predicted amount of required resources. The second calculation unit 404 is used to calculate the scheduling score of each candidate node based on the service level label and the resource load adaptability using a multi-factor weighted scheduling scoring model. The scheduling unit 405 is used to determine the target node based on the scheduling score of the candidate node, and to schedule the database container based on the target node.
[0074] The database container scheduling device 400 provided in the above embodiments can implement the technical solutions described in the above database container scheduling method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above database container scheduling method embodiments, and will not be repeated here.
[0075] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502, and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0076] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 502 or process data, such as the database container scheduling method of the present invention.
[0077] In some embodiments, processor 501 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 501 may be local or remote. In some embodiments, processor 501 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, inter-cloud, multi-cloud, or any combination thereof.
[0078] In some embodiments, memory 502 may be an internal storage unit of electronic device 500, such as a hard disk or memory of electronic device 500. In other embodiments, memory 502 may also be an external storage device of electronic device 500, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 500.
[0079] Furthermore, the memory 502 may include both internal storage units of the electronic device 500 and external storage devices. The memory 502 is used to store application software and various types of data installed on the electronic device 500.
[0080] In some embodiments, display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 503 is used to display information from electronic device 500 and to display a visual user interface. Components 501-503 of electronic device 500 communicate with each other via a system bus.
[0081] In one embodiment, when processor 501 executes the database container scheduler in memory 502, the following steps may be performed: Obtain historical resource data of the database containers of each candidate node in the current cluster during their operation, wherein the database containers are configured with business level tags; Based on the historical resource data, predict the resource demand of each candidate node's database container within a future preset time window. Based on the current resource usage data corresponding to each candidate node and the predicted resource demand, the resource load adaptability of the candidate node is calculated. Based on the service level label and the resource load adaptability, a scheduling score for each candidate node is calculated using a multi-factor weighted scheduling scoring model. The target node is determined based on the scheduling score of the candidate nodes, and the database container is scheduled based on the target node.
[0082] It should be understood that when the processor 501 executes the database container scheduler in the memory 502, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0083] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 500 mentioned. Electronic device 500 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 500 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0084] Accordingly, this application also provides a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the steps or functions of the database container scheduling methods provided in the above-described method embodiments.
[0085] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0086] The database container scheduling method, apparatus, electronic device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A database container scheduling method, characterized by, The method comprises: obtaining historical resource data of each candidate node in the current cluster in the running process of the database container, wherein the database container is configured with a business level label; predicting a demand resource prediction of the database container of each candidate node within a future preset time window based on the historical resource data; calculating a resource load adaptation degree of the candidate node based on the current resource usage data corresponding to each candidate node and the demand resource prediction; calculating a scheduling score of each candidate node by using a multi-factor weighted scheduling score model based on the business level label and the resource load adaptation degree; determining a target node based on the scheduling score of the candidate node, and scheduling the database container based on the target node.
2. The database container scheduling method of claim 1, wherein, The current resource usage data includes current resource remaining amount and current resource load amount, and the resource load adaptation degree includes resource adaptation degree and load adaptation degree; the calculation of the resource load adaptation degree of the candidate node based on the current resource usage data corresponding to each candidate node and the demand resource prediction comprises: calculating the resource adaptation degree according to the ratio between the current resource remaining amount and the demand resource prediction; predicting a redundant resource prediction of the candidate node according to the current resource load amount and the current resource remaining amount; determining the load adaptation degree according to the demand resource prediction, the redundant resource prediction and the current resource remaining amount.
3. The database container scheduling method of claim 2, wherein, The determination of the load adaptation degree according to the demand resource prediction, the redundant resource prediction and the current resource remaining amount comprises: obtaining a resource load fluctuation of the candidate node; determining an effective resource remaining amount based on the current resource remaining amount and the resource load fluctuation; determining an expected resource remaining amount based on the redundant resource prediction and the demand resource prediction; determining the load adaptation degree based on the ratio between the effective resource remaining amount and the expected resource remaining amount.
4. The database container scheduling method of claim 2, wherein, The multi-factor weighted scheduling score model comprises a first weight corresponding to the business level label, a second weight corresponding to the resource adaptation degree and a third weight corresponding to the load adaptation degree; the calculation of the scheduling score of each candidate node by using the multi-factor weighted scheduling score model based on the business level label and the resource load adaptation degree comprises: determining a business adaptation degree corresponding to the business level label; determining the scheduling score based on the business adaptation degree and the first weight, the resource adaptation degree and the second weight, and the load adaptation degree and the third weight.
5. The database container scheduling method of claim 3, wherein, The scheduling of the database container based on the target node comprises: dynamically deploying the database container based on the target node through an independent scheduling expansion component.
6. The database container scheduling method of claim 4, wherein, After the scheduling of the database container based on the target node, the method further comprises: obtaining a scheduling result of the database container; based on the scheduling result, reinforcing learning of the multi-factor weighted scheduling score model.
7. The database container scheduling method of claim 1, wherein, The prediction of the demand resource prediction of the database container of each candidate node within a future preset time window based on the historical resource data comprises: When the sample data amount of the historical resource data is less than a preset sample amount threshold, a time series model of exponential moving average is used to predict the historical resource data, to obtain the demand resource prediction amount of the database container of each candidate node within a future preset time window; When the sample data amount of the historical resource data is greater than or equal to the preset sample amount threshold, a time series model based on LSTM is used to predict the historical resource data, to obtain the demand resource prediction amount of the database container of each candidate node within a future preset time window.
8. A database container scheduling apparatus characterized by comprising: The apparatus comprises: an acquisition unit configured to acquire historical resource data of database containers of each candidate node in a current cluster during running, the database containers being configured with business level labels; a prediction unit configured to predict, based on the historical resource data, a demand resource prediction amount of the database containers of each candidate node within a future preset time window; a first calculation unit configured to calculate, based on current resource usage data of each candidate node and the demand resource prediction amount, a resource load adaptation degree of the candidate node; a second calculation unit configured to calculate, based on the business level labels and the resource load adaptation degree, a scheduling score of each candidate node by using a scheduling score model based on multi-factor weighting; a scheduling unit configured to determine a target node based on the scheduling score of the candidate node, and to schedule the database containers based on the target node.
9. An electronic device, comprising: comprising a memory and a processor, wherein the memory is configured to store a program; the processor is coupled to the memory and is configured to execute the program stored in the memory, to implement the steps in the database container scheduling method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, a computer readable program or instruction for storing, the program or instruction being executed by a processor to implement the steps in the database container scheduling method of any one of claims 1 to 7.