Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
In the embodiment of the present application, the execution body of the flow includes a terminal device. The terminal equipment comprises, but is not limited to, equipment such as a server, a computer, a smart phone and a tablet personal computer and the like capable of executing the method disclosed by the application. Fig. 1 shows a flow chart of an automatic resource planning method for a hybrid cloud according to a first embodiment of the present application, which is described in detail below:
S101, acquiring service load data and historical operation records in real time, and determining a service change trend by adopting a time sequence analysis algorithm to obtain a demand prediction model.
In this embodiment, service load data is obtained from the service system through the sensor interface, and the service load data is stored in the database by adopting a real-time acquisition technology, so as to obtain a load data set. And extracting a load data set and a historical operation record from the database, and combining the load data set and the historical operation record into complete time sequence data to obtain a sequence data set. And decomposing periodic fluctuation by adopting a time sequence analysis algorithm aiming at the sequence data set to obtain a primary trend characteristic. And fitting the primary trend characteristics by a regression analysis method, and determining the business change trend to obtain a trend function. And if the slope of the trend function is greater than a preset threshold, adjusting the trend function through an exponential smoothing algorithm to obtain an optimized trend function. And calculating a load value at a future time point according to the optimized trend function, and generating a demand prediction result to obtain a prediction data set. And comparing the prediction data set with the historical operation record, judging the prediction deviation and updating the model parameters to obtain a final prediction model.
In this embodiment, based on accurate traffic load prediction, the enterprise may plan and adjust cloud resources in advance, ensuring that sufficient computing, storage, and network resources are available during peak traffic hours.
S102, acquiring dynamic resource demand parameters from a demand prediction model, judging the resource allocation proportion of private cloud and public cloud, and determining an initial configuration scheme of a cross-cloud resource pool.
In this embodiment, the trend analysis is used to extract the service change feature, and the time sequence analysis algorithm is used to obtain the change trend of the dynamic resource requirement. And obtaining the demand parameters from the prediction model according to the change trend, and judging the peak value and the valley value of the resource demand by adopting a support vector machine algorithm. And if the demand parameters exceed the preset threshold, adjusting the distribution proportion of the private cloud resources and the public cloud resources into a dynamic proportion to obtain a cross-cloud resource distribution scheme. And determining an initial configuration scheme through a cross-cloud resource allocation scheme, and obtaining an optimized layout of resource pool management by adopting a load balancing tool. And extracting resource pool management data from the optimized layout, judging the real-time load distribution of the private cloud and the public cloud, and determining the resource scheduling priority. And acquiring dynamic adjustment parameters of the cross-cloud resource pool according to the resource scheduling priority, and judging whether to trigger the capacity expansion or capacity contraction operation of the resource pool. And updating the initial configuration scheme by dynamically adjusting parameters to obtain a final distribution result of the cross-cloud resource pool.
In the embodiment, the demand prediction model can accurately predict the future business change trend and the resource demand, provide scientific basis for resource allocation between private cloud and public cloud, realize dynamic adjustment of resources, flexibly configure the resources according to real-time demand, and improve the utilization efficiency of the resources. By comprehensively considering factors such as cost structures, performance characteristics and the like of private cloud and public cloud, a reasonable resource allocation strategy is formulated, and the operation cost of enterprises is reduced.
S103, optimizing the resource scheduling dynamics by adopting a reinforcement learning algorithm based on the initial configuration scheme to obtain a real-time scheduling plan.
In this embodiment, the resource usage (e.g., CPU usage, memory occupancy, network bandwidth usage, etc.) and traffic load (e.g., user request amount, transaction success rate, etc.) of the current system are used as status inputs. A series of possible scheduling actions are defined, such as starting or stopping virtual machines on different cloud platforms, adjusting virtual machine configurations (e.g., CPU cores, memory size), migrating virtual machines, etc. The reward function is designed to reflect the goals of the schedule, such as minimizing task response time, maximizing resource utilization, reducing energy consumption, etc. For example, the shorter the task response time, the higher the resource utilization, the lower the energy consumption, the larger the prize value may be set. A reinforcement learning algorithm suitable for the resource scheduling problem, such as a Deep Q Network (DQN) or a strategy gradient algorithm (such as REINFORCE, PPO, etc.), is selected, and algorithm parameters, such as neural network structure, learning rate, discount factor, etc., are initialized. The reinforcement learning model is trained using the historical data and the simulation environment. By simulating different resource demand scenes, an Agent interacts with the environment, and the strategy is adjusted according to feedback of the rewarding function. In the training process, the intelligent agent continuously tries different action combinations, observes the influence of the intelligent agent on the system state and rewards, and gradually learns to an optimal scheduling strategy. When new traffic load data arrives, the current system state is input into the trained reinforcement learning model. And the model rapidly outputs the optimal scheduling action under the current state, namely a real-time scheduling plan according to the learned strategy.
In this embodiment, the reinforcement learning algorithm can dynamically adjust the resource allocation policy according to the real-time traffic load and the system state, and quickly respond to the change of the resource demand. Through continuous learning and optimization, the intelligent agent can gradually learn the optimal scheduling strategy adapting to different business scenes. By optimizing resource scheduling, task response time is reduced, user experience is improved, resource utilization rate is improved, and resource waste and operation cost are reduced. The reinforcement learning algorithm realizes the automatic management of resource scheduling, reduces manual intervention and improves the working efficiency.
S104, extracting specific parameters of resource allocation from the real-time scheduling plan, judging whether the safety and flexibility requirements are met, and determining a final scheduling instruction.
In this embodiment, specific parameters regarding resource allocation are extracted from the real-time scheduling plan generated by the reinforcement learning algorithm. The parameters include the number of virtual machines that need to be started or stopped on the private and public clouds, respectively. Configuration information of the virtual machine, such as the number of CPU cores, the memory size, the storage capacity and the like. The allocation of network bandwidth includes uploading and downloading bandwidth. Other parameters related to resource allocation, such as load balancing policies, data migration plans, etc.
The security requirements are determined by (1) resource isolation and access control by ensuring that resources between different users or applications are isolated, preventing unauthorized access to the resources. Implementing strict access control policies, such as role-based access control (RBAC), ensures that only authorized users can access a particular resource. (2) And (3) fault recovery and redundancy design, namely checking whether the scheduling plan comprises a fault recovery mechanism, such as virtual machine backup, data redundancy storage and the like. When the key component or the resource fails, the system can be switched to the standby resource rapidly, and the continuity of the service is ensured. (3) And the resource utilization rate monitoring is to monitor the system resource utilization rate in real time, so as to ensure that the resource allocation cannot cause overload or idle resources of the system. Setting a resource utilization rate threshold value, and triggering an early warning mechanism when the resource utilization rate is close to or exceeds the threshold value.
The flexibility requirement is determined by (1) elastic scalability by evaluating whether the scheduling plan supports fast adjustment of resource allocation based on real-time changes in traffic load. The system can be ensured to automatically expand or reduce resources so as to meet the service requirements of different time periods and different scales. (2) Resource migration and reassignment-checking whether the scheduling plan contains a resource migration policy to migrate virtual machines or data quickly when needed. The system is ensured to flexibly reallocate the resources so as to cope with emergency or optimize the utilization efficiency of the resources. (3) Cross-cloud collaboration and integration, verifying whether the scheduling plan supports seamless collaboration and integration between private and public clouds. The cross-cloud resource pool can be managed, scheduled and optimized uniformly, and the overall resource utilization rate and the service quality are improved.
If the resource allocation parameters meet the safety and flexibility requirements, a final scheduling instruction is generated and sent to a corresponding resource management component for execution. If the requirements are not met, the method is adjusted or optimized according to specific conditions until the requirements are met.
In this embodiment, by implementing security measures such as resource isolation, access control, failure recovery, and redundancy design, stability and security of the system are ensured. Unauthorized access, resource abuse and malicious attacks are prevented, and the security of user data and enterprise assets is protected. Flexible resource management strategies such as elastic expansion, resource migration, redistribution and the like are supported, so that the system can rapidly respond to the change of the service load. The resource utilization efficiency and the service quality are improved, and the operation cost is reduced.
S105, based on the final scheduling instruction, a preset template engine is adopted to generate a configuration script and an automatic deployment file for the cross-cloud environment.
In this embodiment, key information, such as virtual machine specifications (CPU, memory, storage), network configuration, security group rules, API credentials of the cloud service provider, etc., is extracted from the final scheduling instruction output by the reinforcement learning algorithm. This information will be used to populate variables in the template engine to generate configuration scripts and automated deployment files that meet the requirements of the cross-cloud environment. Such as the Jinja template engine is chosen for use because it is Python-based, easy to integrate into existing automated toolchains, and supports rich template grammar and logic control. Jinja2 the template engine allows the structure of the configuration script and the automation deployment file to be separated from the dynamic content, and improves the reusability and maintainability of the code.
Jinja2 template files for generating configuration scripts and automation deployment files are designed and created. Variables, conditional statements, loop structures, etc. are defined in the template file to dynamically generate content according to the final scheduling instructions. For example, a template file may be created for generating configuration scripts for AWS EC2 instances, containing variables such as instance type, mirror ID, security group ID, etc.
And filling key information in the final scheduling instruction into a template file by using a rendering function of Jinja template engine to generate a specific configuration script and an automation deployment file. The rendering process may be automated, implemented by writing an API of Python script call Jinja. The generated configuration script and automation deployment file will contain detailed configuration information across cloud environments, such as network connection settings between private and public clouds, load balancer configuration, database connection strings, etc.
The generated configuration script and automation deployment file are read by using an automation tool (such as Ansible, terraform, etc.), and resource deployment and configuration of the cross-cloud environment are executed. The automation tool will create virtual machines, configure networks, install software, start services, etc. on private and public clouds according to instructions in the file. During deployment, the automation tool monitors deployment progress and provides error information and retry mechanisms when errors occur.
In the embodiment, the configuration script and the automatic deployment file are generated by using the template engine, so that the service change can be responded quickly, and the quick deployment and configuration of the resources can be realized. The automatic deployment tool can reduce manual intervention, reduce the deployment error rate and improve the overall deployment efficiency. The template engine separates the structure of the configuration script and the automatic deployment file from the dynamic content, so that the code is more modularized and easy to maintain, and when the configuration or deployment flow needs to be modified, only the template file or the scheduling instruction needs to be updated, and a large amount of script codes do not need to be modified. The template engine supports complex logic control and condition judgment, different configuration scripts and automatic deployment files can be generated according to different scheduling instructions, and the flexibility enables a company to easily expand a hybrid cloud environment of the company and support more types of application programs and resources. By automating the deployment tool to perform resource deployment and configuration across cloud environments, it can be ensured that each deployment follows a uniform flow and standard. The automation tool may also integrate security checking and compliance verification functions to ensure that the deployment process meets the corporate security policy and regulatory requirements.
In some embodiments, in the step S101, the determining the traffic change trend by collecting traffic load data and historical operation records in real time and adopting a time sequence analysis algorithm to obtain the demand prediction model specifically includes:
Periodically acquiring service load data and same-dimensional time sequence data according to distributed probes deployed on private cloud nodes and public cloud nodes to form a time sequence training data set, wherein the time sequence training data set comprises a CPU utilization rate sequence, a memory usage amount sequence, a network throughput sequence and a disk IOPS sequence;
Performing differential processing on the time sequence training data set, modeling the time sequence training data set subjected to differential processing through ARIMA, and performing residual error compensation through an LSTM network to form a time sequence prediction model;
And setting a correlation formula for converting the predicted value output by the time sequence prediction model into the virtual machine instance number and the cross-cloud resource configuration vector, and combining the correlation formula with the time sequence prediction model to form a demand prediction model.
In this embodiment, traffic load data is periodically collected from private cloud nodes and public cloud nodes by distributed probes, generating a time-series training dataset comprising a CPU utilization sequence, a memory usage sequence, a network throughput sequence, and a disk IOPS sequence. Differential processing is applied to the time sequence training data set, and time sequence data after differential is obtained. Modeling the time sequence data after the difference by adopting an ARIMA model to obtain a preliminary prediction result. And compensating the residual error of the ARIMA model through the LSTM network to obtain an optimized prediction model. And extracting the variation trend of each sequence from the optimized prediction model, and judging the resource use state. And if the resource use state exceeds a preset threshold value, adjusting the resource allocation of the private cloud node and the public cloud node through a load balancing tool to obtain the adjusted resource allocation. And updating acquisition parameters of the distributed probe according to the adjusted resource configuration, and acquiring a new time sequence training data set.
And obtaining a predicted value output by the time sequence prediction model, and calculating the number of virtual machine instances through a preset association formula to obtain a preliminary configuration result. And according to the preliminary configuration result, adopting a linear regression algorithm to adjust the proportion of the number of instances and cloud resources, and determining the number of the optimized instances. And calculating the cross-cloud resource allocation vector through the optimized number of instances, and obtaining a resource allocation scheme. And for the resource allocation scheme, if the value of the configuration vector exceeds a preset threshold, the cloud resource is reallocated through a support vector machine algorithm to obtain balanced configuration data. And adopting balanced configuration data, and judging the dynamic adjustment requirement of the resource configuration by combining the historical change trend of the predicted value. And updating a predicted value through a time sequence prediction model according to the dynamic adjustment requirement to obtain a new resource allocation vector. And judging the load balance state of the cloud resources through the new resource allocation vector to obtain a final resource scheduling scheme.
Specifically, the association formula satisfies
Wherein VM num represents the number of virtual machine instances,Indicating the predicted CPU utilization at time t,Represents the predicted memory usage at time t,Representing predicted network throughput at time t, R threshold represents a single virtual machine resource bearer threshold,Representing a round-up, Q t represents a cross-cloud resource configuration vector,Representing the number of virtual machine instances of the private cloud,Representing the number of virtual machine instances of the public cloud,Representing a multidimensional prediction matrix, S cost representing a cost constraint matrix, S security representing a security policy matrix, and f (·) representing a multi-objective optimization decision function.
Illustratively, in a data center of an enterprise, probes collect data every 5 minutes, generating a time-series training dataset comprising a CPU utilization sequence, a memory usage sequence, a network throughput sequence, and a disk IOPS sequence. It is assumed that the CPU utilization sequence may be a percentage data per minute, such as 30%, 35%, 40%, over 24 consecutive hours, reflecting the trend of system load over time. The acquisition mode can comprehensively capture the service running state and provide a reliable basis for subsequent prediction. In one possible implementation, the differential processing of the time series training data set is to eliminate data non-stationarity, making it more suitable for modeling. For example, assuming the memory usage sequence is 500MB, 550MB, 580MB, the difference becomes 50MB, 30MB, highlighting the trend rather than absolute value. Then, by modeling the linear law of the captured data by ARIMA, for example, for a network throughput sequence, ARIMA can predict the throughput of the next moment according to the traffic data (such as 100Mbps, 120Mbps, 130 Mbps) of the past 1 hour, and this method has a significant effect on processing time series data with strong stationarity, and can logically extract the main trend. It should be noted that ARIMA modeling may not fit the nonlinear residuals completely, and thus introduce LSTM networks for residual compensation. Specifically, suppose the ARIMA predicts that the CPU utilization is 45%, while the actual value is 48%, and the residual is 3%. LSTM further corrects the predicted value to 47.5% by learning the historical residual pattern (e.g., 2%, 3%, 1% of the residual sequence of the previous minutes), improving accuracy. The combination mode fully utilizes the linear modeling capability of ARIMA and the nonlinear learning capability of LSTM, and the prediction precision is obviously improved. Preferably, the output of the time sequence prediction model is converted into a virtual machine instance number and a cross-cloud resource configuration vector. For example, the prediction result shows that the CPU utilization rate will reach 80% and the memory usage amount is 2GB in the future 1 hour, 2 virtual machines can be calculated through the association formula, and 1 CPU core and 1GB memory are configured for each virtual machine. In one embodiment, the formula may be set toIf the utilization rate is 80%, 2 stations are required. The conversion logic is clear, and can directly guide resource allocation. In one possible implementation, the demand prediction model integrates timing predictions and associated formulas, e.g., a certain e-commerce platform in a promotional event, probes acquire disk IOPS sequence bursts (e.g., 1000, 1500, 2000), and models predict the next hour IOPS to 2500, in combination with formulas And obtaining 3 virtual machine support. The method not only predicts the load, but also can dynamically adjust the resources, thereby guaranteeing the service stability. It will be appreciated that technical effects of such models include resource utilization enhancement and cost optimization. For example, if 5 virtual machines are not predicted to be directly and statically allocated, 2 resources may be wasted, and by dynamic adjustment of the model, only 3 virtual machines are used to meet the requirement, thus saving about 40% of cloud resource cost. Meanwhile, the prediction accuracy is improved, the service interruption risk caused by insufficient resources can be reduced, and a complete closed loop from data acquisition to resource allocation is logically formed. For example, when private cloud node load suddenly increases, the model may predict and migrate part of the tasks to the public cloud in advance, smoothing cross-cloud resource scheduling. The multi-side supporting mode ensures the tightness of the scheme, shows the practicability through a specific scene, and reflects the value of the technology in service continuity.
In some embodiments, in the step S102, the obtaining the dynamic resource demand parameter from the demand prediction model, determining the resource allocation ratio of the private cloud to the public cloud, and determining the initial configuration scheme of the cross-cloud resource pool specifically includes:
extracting peak resource demand and baseline resource demand from the predicted value output by the demand prediction model;
Taking the minimized cost, time delay and risk as optimization targets, taking respective resource capacity constraint of public cloud and private cloud, safety isolation constraint between public cloud and private cloud and elastic buffer constraint between public cloud and private cloud as constraint conditions, and forming a first optimization objective function;
And determining the virtual machine allocation proportion between the public cloud and the private cloud by adopting a mixed integer programming algorithm based on the peak resource demand, the baseline resource demand and the first optimization objective function, and optimizing bandwidth and storage allocation by heuristic rules to form an initial configuration scheme of a cross-cloud resource pool.
In this embodiment, a predicted value is output through a demand prediction model, peak resources and baseline resources are extracted, and a resource demand range is determined by adopting statistical analysis. And according to the peak value resource and the baseline resource, combining the resource capacity constraint, and applying a mixed integer programming algorithm to obtain the virtual machine allocation proportion of the public cloud and the private cloud. And aiming at the virtual machine allocation proportion, acquiring a security isolation constraint, and determining a preliminary cross-cloud allocation scheme by adjusting the allocation proportion if the isolation requirement is met through logic judgment. And extracting bandwidth requirements from the preliminary cross-cloud allocation scheme, and optimizing bandwidth allocation by adopting heuristic rules to obtain a bandwidth optimization result. Based on the bandwidth optimization result and the baseline resource, the storage allocation scheme is determined by adjusting the storage allocation through heuristic rules in combination with elastic buffer constraint. And integrating the optimization targets through the virtual machine allocation proportion, the bandwidth optimization result and the storage allocation scheme to generate an initial configuration scheme crossing the cloud resource pool. Extracting resource use data from the initial configuration scheme, analyzing the stability of the configuration scheme by adopting a linear regression algorithm, and judging the final configuration scheme.
By way of example, assume that an enterprise private cloud node predicts a CPU utilization of 90% during peak traffic hours and a memory requirement of 3GB, while the baseline requirement during off-peak hours is a CPU utilization of 30% and a memory of 1GB. The extraction mode clearly divides the upper limit and the lower limit of resource use by analyzing the historical time sequence data, and lays a foundation for subsequent optimization. In one possible implementation, minimizing cost, delay and risk are used as optimization targets, embodying the idea of multidimensional balancing. Specifically, the cost points to the lease cost of cloud resources, the delay concerns the task response speed, and the risk involves service interruption caused by insufficient resources. In the constraint condition, the resource capacity constraint of the public cloud and the private cloud can be understood as that the private cloud has 10 CPU cores and 20GB of memory, and the public cloud can be elastically expanded to 50 cores and 100GB of memory. The security isolation constraint requires that sensitive data can only be processed in private cloud, and the elastic buffer constraint needs to ensure that 20% of spare capacity is reserved in public cloud. For example, an enterprise can implement isolation and elasticity by deploying a core database in a private cloud and running front-end services in a public cloud. It should be noted that the first optimization objective function is constructed by quantizing the above objective and constraint into a computable model. Preferably, the cost can be defined as a risk factor of 0.5 yuan per hour per core, with a delay of 0.1 increase per millisecond, forming a function by weighted combination. For example, a solution cost of 5-yuan, a delay of 10 milliseconds, a risk probability of 0.2, with the goal of minimizing the composite score. The method has clear logic and is convenient for solving the following algorithm. Based on peak resource demand, baseline resource demand and an optimization objective function, determining the virtual machine allocation proportion by adopting a mixed integer programming algorithm is a strict method. In one embodiment, the peak demand requires 15 CPU cores, the baseline requires 5, the private cloud capacity 10 cores, and the algorithm can derive the proportion of private cloud allocation 10, public cloud 5. The bandwidth and storage allocation is then optimized by heuristic rules. For example, bandwidth is preferentially allocated to low latency front end tasks, and storage tends to be in the private cloud to meet security requirements. It will be appreciated that the heuristic may be set to "the bandwidth allocation ratio is inversely proportional to the latency requirement" and if the front-end task needs 1 millisecond of response, 2Gbps of bandwidth is allocated. The method flexibly adjusts the resource distribution and ensures the high efficiency of the initial configuration scheme. Specifically, the initial configuration scheme of the cross-cloud resource pool needs to consider practical scenes. For example, the peak business hours predict 3GB of memory requirements, the private cloud provides 2GB, the public cloud supplements 1GB, and the bandwidth is configured to 1Gbps to support data transmission. This configuration not only meets peak demand, but also avoids resource idling through baseline optimization. In one possible implementation, if the baseline requirement only needs 1GB of memory, the scheme can dynamically reduce public cloud allocation, and the flexibility advantage is reflected. The scheme of multi-side support ensures the sufficiency of resources and improves the overall efficiency through fine distribution.
In some embodiments, in step S103, the optimizing the resource scheduling dynamics by using a reinforcement learning algorithm based on the initial configuration scheme to obtain a real-time scheduling plan specifically includes:
setting a carbon cost prediction function, wherein the carbon cost prediction function is used for predicting carbon cost generated by private cloud and public cloud under different resource allocation conditions;
Setting a resource utilization rate, a queue state and a carbon cost as a state space, setting elastic expansion and contraction of private cloud or public cloud, cross-cloud flow migration and priority task quota as an action space, setting resource efficiency as instant rewards, and setting carbon efficiency as long-term rewards;
Based on the initial configuration scheme, the state space, the action space, the instant rewards and the long-term rewards, the resource scheduling between the private cloud and the public cloud is dynamically optimized by adopting a double Q reinforcement learning algorithm, and a real-time scheduling plan is obtained.
In this embodiment, resource utilization and queue state data are obtained, and state space initial values are determined by collecting runtime information of private and public clouds. And extracting the resource utilization rate from the initial value of the state space, and obtaining the instant rewarding numerical value by calculating the current resource efficiency. Aiming at the queue state and the task quota, a priority ordering algorithm is adopted to judge a task allocation scheme, and adjusted task quota data is output. And predicting the influence of the cross-cloud flow migration on the carbon efficiency by adopting a linear regression algorithm through the adjusted task quota data and the cross-cloud migration attribute to obtain a migration optimization scheme. And acquiring migration optimization scheme and resource efficiency data, judging action combinations of private cloud expansion and contraction and public cloud expansion and contraction, and outputting expansion and contraction adjustment instructions. And extracting an action space update value from the expansion and contraction adjustment instruction, and calculating a carbon cost change trend through a prediction function to obtain a long-term carbon efficiency optimization result. And adjusting the action space parameters by adopting a reinforcement learning algorithm according to the carbon cost change trend and the state space update value, and outputting a final resource allocation scheme. Specifically, the Q value table is iteratively updated through a double Q learning algorithm, a resource scheduling strategy is dynamically optimized, short-term benefits and long-term benefits are balanced to obtain the current cloud environment state, the Q value table is queried based on the current state including calculation, storage and network resource use conditions of private cloud and public cloud, optimal actions are selected to perform resource scheduling, dynamic load balancing between the private cloud and the public cloud is achieved to monitor system performance index changes after resource scheduling, a reward value is calculated, the Q value table is updated, a continuous optimization scheduling strategy is used for aiming at sudden service requirements or abnormal conditions, an emergency scheduling mechanism is triggered, and resource allocation is rapidly adjusted to meet service requirements.
For example, the carbon cost prediction function may consider factors such as energy structure, plant efficiency, etc., to predict carbon emissions for different resource allocation schemes. In one possible implementation, the private cloud uses a clean energy duty of 80% with 0.2 kg of carbon dioxide per kilowatt-hour emission, while the public cloud energy is less structured with 0.5 kg of energy per kilowatt-hour emission. Through this prediction, an enterprise may trade off performance against environmental requirements. It should be noted that the design of the state space directly affects the decision accuracy. Specifically, the resource utilization may characterize the computational load, the queue status reflects the backlog of the task, and the carbon cost quantifies the environmental impact. For example, at a certain moment, the private cloud CPU utilization rate is 70%, the memory occupation is 2GB, the task queue length is 5, the predicted carbon emission is 10 kg, and the indexes together form the current state vector. In the aspect of action space, the flexible expansion and contraction determines the resource scale, the cross-cloud migration influences the load distribution, and the priority is used for adjusting the task sequence. In one possible implementation, a private cloud may be expanded by 2 CPU cores, data analysis tasks migrated to a public cloud, and critical traffic quota raised to 50% as a set of actions. This multidimensional scaling provides a rich choice for resource scheduling. Preferably, the resource efficiency is set as an instant prize, and the carbon efficiency is set as a long-term prize, which represents a balance between short-term performance and sustainable development. For example, a certain action increases the task processing speed by 20%, obtains a positive instant reward, and simultaneously predicts a 5% reduction in annual carbon emissions, obtaining a long-term rewarding addition. Such design directs the system to focus on environmental impact while enhancing performance. It will be appreciated that the double Q reinforcement learning algorithm progressively optimizes the decision strategy by continually trying and evaluating. In practice, algorithms may first attempt to migrate computationally intensive tasks to the private cloud, observing resource utilization increases and carbon emissions decreases, thus enforcing this strategy. Through continuous learning and adjustment, the system finally forms a dynamic scheduling scheme with balanced efficiency and environmental protection.
Further, the setting the carbon cost prediction function specifically includes:
constructing a carbon cost prediction function according to the power consumption of a real-time server of a private cloud, the regional carbon intensity and virtual machine instance power consumption related to various energy structures and public clouds in a power grid, wherein the carbon cost prediction function meets the following requirements of
Ctotal=α·Cprivate+(1-α)·Cpublic
Wherein C total represents the carbon cost of the carbon cost prediction function, C private represents the carbon cost of the private cloud, C public represents the carbon cost of the public cloud, α represents the dynamic weight of the private cloud load ratio, T represents the total time step, deltaT represents the integration time window,Representing a private cloud server real-time power consumption formula,Representation ofThe duty cycle of the i-th energy source in the power grid at the moment, F i represents the carbon emission factor of the energy source i,Representing public cloud virtual machine instance power consumption formulas,Representation ofThe real-time carbon intensity of the region where the public cloud is located at the moment, delta j represents the running time of the J-th virtual machine instance in a time window delta T, and J represents the total number of virtual machines in the public cloud cluster;
Wherein, the Representing the base power consumption of the kth server in the idle state,Representing peak power consumption at full load of the kth server,Representation ofCPU utilization rate of the kth server at the moment, K represents total number of servers in the private cloud cluster, eta j represents energy efficiency correction coefficient of the jth virtual machine instance,Representation ofThe CPU utilization of the jth virtual machine instance at time,Represents the maximum CPU quota available to any virtual machine instance,Representing the physical CPU thermal design power consumption corresponding to any virtual machine instance;
And obtaining the intensity trend of the carbon cost in a future preset time period by carrying out trend item modeling, cycle item extraction and residual item learning on the carbon cost output by the carbon cost prediction function.
In this embodiment, the dynamic weighting of the private cloud load ratio allows for adjusting the relative importance of the private cloud and public cloud carbon costs according to the actual situation. This flexibility enables the prediction function to adapt to different usage scenarios and policies, such as optimizing cloud service configuration under different time periods or load conditions.
The total time step is the predicted total time and the integration time window is the time interval when the carbon cost is calculated. These two parameters define the temporal range and accuracy of the predictions, allowing the user to adjust the granularity and range of predictions as desired.
The duty cycle of the i-th energy source and the carbon emission factor of the energy source i in the power grid describe the proportion of the various energy sources in the power grid and their carbon emission characteristics.
The real-time carbon intensity of the public cloud area reflects the carbon emission intensity of the power production of the public cloud area.
Through carrying out trend item modeling, periodic item extraction and residual item learning on the carbon cost output by the carbon cost prediction function, the technical scheme can predict the carbon cost strength trend in a preset time period in the future. This predictive capability provides decision support for enterprises and organizations to develop long-term emission abatement strategies and to cope with short-term fluctuations.
The detailed calculation of the public cloud virtual machine instance power consumption comprises an energy efficiency correction coefficient, a CPU utilization rate and physical CPU thermal design power consumption, so that the influence of the public cloud use on the carbon cost can be accurately estimated by the prediction function. This helps optimize the use of public cloud resources, improving energy efficiency.
The carbon cost prediction function can accurately calculate the total carbon cost in a given time window by comprehensively considering the real-time power consumption of the private cloud server, the duty ratio of various energy sources in the power grid, the carbon emission factor, the power consumption of the public cloud virtual machine instance and the regional carbon intensity. This accurate prediction provides a quantitative indicator for enterprises and organizations to evaluate their cloud service usage impact on the environment. By incorporating the duty cycle and carbon emission factor of various energy sources in the power grid, the predictive function can reflect the impact of the energy source structure on the carbon cost. This helps businesses and organizations select low carbon energy sources, thereby reducing their carbon footprint.
In some embodiments, in step S104, the extracting the specific parameters of the resource allocation from the real-time scheduling plan, determining whether the security and flexibility requirements are satisfied, and determining the final scheduling instruction specifically includes:
Extracting resource allocation parameters from a real-time scheduling plan, wherein the resource allocation parameters comprise resource type codes, cloud platform identifiers, geographic areas and resource parameter vectors, and the resource parameter vectors comprise virtual machine instance numbers, CPU core numbers, memory capacity, network bandwidth and storage capacity;
The security evaluation degree of the resource allocation parameters is determined by comprehensively analyzing the data sensitivity, encryption brightness, compliance, role access control layer progression and audit log retention days of the resource allocation parameters;
The flexible evaluation degree of the resource allocation parameters is determined by comprehensively analyzing the resource expansion and contraction capacity delay, the selectable proportion of the cloud suppliers and the capacity ratio of the idle resource pool of the resource allocation parameters;
and comparing the safety evaluation degree and the flexibility evaluation degree with respective preset thresholds respectively, judging whether the resource allocation parameters meet the safety and flexibility requirements, and if so, determining the resource allocation parameters as a final scheduling instruction.
In this embodiment, an initial dataset of resource allocation is obtained by extracting parameters such as resource type, cloud platform, geographic area, and number of virtual machines from a real-time dispatch plan. And carrying out feature analysis on the virtual machine number, the CPU core number, the memory capacity, the network bandwidth and the storage capacity in the initial data set by adopting a random forest algorithm to obtain the distribution feature of the resource parameter vector. If the correlation between the number of virtual machines and the number of CPU cores in the distribution characteristics exceeds a preset threshold, determining an optimized resource parameter vector by adjusting the distribution proportion of the cloud platform and the geographic area.
And according to the optimized resource parameter vector, analyzing the matching degree between the data sensitivity and the encryption strength to obtain a preliminary evaluation result of the security configuration. And judging whether the safety configuration deviation exists or not by comparing the preliminary evaluation result with the compliance and access control requirements, and acquiring the safety configuration parameters after deviation adjustment. And aiming at the security configuration parameters after deviation adjustment, determining the final security evaluation degree by combining the audit log retention days.
And determining a reference value of delay analysis by collecting real-time data of the expansion and contraction capacity of the resource. And acquiring availability data of the cloud provider according to the result of the delay analysis, and judging the distribution condition of the selectable proportion. And determining the allocation priority of the idle resources by adopting a preset threshold value according to the distribution condition of the selectable proportion. And acquiring dynamic change of the pool capacity ratio through allocation priority of idle resources to obtain a preliminary result of resource pool analysis. If the analysis result of the resource pool exceeds the preset range, determining an optimization scheme of comprehensive analysis by adjusting the calling proportion of the cloud provider. And according to an optimization scheme of comprehensive analysis, judging the final value of the flexible evaluation degree by adopting a random forest algorithm. And acquiring update data determined by the parameters through the final value of the flexible evaluation degree to obtain an adjustment scheme of the resource allocation parameters.
For example, when the resource allocation parameter is extracted from the real-time scheduling plan, the resource allocation parameter may be regarded as a multidimensional information set, for example, the resource type code may be that "VM-001" represents a virtual machine type, the cloud platform identifier is that "PC-01" represents a private cloud, the geographic area is set as "tokyo-tokyo", and the resource parameter vector specifically includes virtual machine instance number 5, CPU core number 8, memory capacity 32GB, network bandwidth 500Mbps and storage capacity 1TB. These parameters together outline the basic outline of resource allocation, laying the foundation for subsequent analysis. In one possible implementation, the security assessment of the resource allocation parameters may be analyzed from data sensitivity. Assuming that a task involves user privacy data and the sensitivity is rated high, the encryption strength is required to reach the AES-256 level. In terms of compliance, if the regional regulation requires that the data is not in the environment, the private cloud of the tokyo region naturally meets the requirements. The number of role access control layers is set to 3, only specific administrators are allowed to access, and the number of audit log retention days is set to 180 days to meet the audit needs. Through comprehensive evaluation, these factors may result in a security rating of 85, exceeding a preset threshold of 75, indicating that the security meets the criteria. The determination of the flexible evaluation degree focuses on the dynamics in the resource scheduling. Specifically, if the resource expansion and contraction delay is 2 seconds, the system response is rapid. The optional proportion of the multi-cloud provider is up to 60%, so that the scheduling can be flexibly switched to other cloud platforms such as public cloud. And if the capacity of the idle resource pool is 30%, reserved resources are sufficient to support burst requirements. After comprehensive analysis, the flexible evaluation degree can reach 80 and be higher than the threshold value 70, so that stronger adaptability is shown. In one possible implementation, the comparison of the security and flexible assessments may be further refined. For example, in a certain scene, the safety evaluation degree is 90, but the flexibility evaluation degree is only 65, and the safety evaluation degree does not reach the standard. At this time, parameters can be adjusted, for example, the number of virtual machine instances is reduced to 3 to reduce load pressure, and the idle resource ratio is increased to 40%, so that the flexible evaluation degree is increased to 72, and the requirements are met. This adjustment demonstrates the practicality of parameter optimization, helping the system to maintain flexible scheduling capability under high security. Preferably, the determination of the final scheduling instruction may also take into account a balance between parameters. For example, increasing the number of CPU cores to 10 may increase performance, but if the energy supply in the geographic area is intense, this may lead to increased costs. On the contrary, the number of the instances is kept to be 5, and the network bandwidth is optimized to 600Mbps, so that the task requirement can be met, and the resource waste is avoided. This tradeoff ensures instruction efficiency while saving operating costs for the enterprise. In one possible implementation, assuming that an enterprise needs to process a real-time data analysis task, the resource allocation parameters are initially set to be 4 virtual machine instances, 6 CPU cores and 16GB of memory. If the safety evaluation degree is 88 and the flexibility evaluation degree is 78, the safety evaluation degree exceeds the threshold value, and the safety evaluation degree is directly solidified into a scheduling instruction. The method not only ensures the safety of data processing, but also can quickly respond to flow fluctuation, and shows the practical value of a scheduling scheme. It will be appreciated that the analysis described above forms the rigorous logic of parameter determination by multi-sided tap. For example, the security evaluation degree is checked layer by layer from sensitivity to compliance, the flexibility evaluation degree is comprehensively considered from delay to a resource pool, the security evaluation degree and the flexibility evaluation degree are mutually supported, and finally, the instruction is ensured to be safe and flexible. The method effectively improves the reliability of resource scheduling and provides stable and sustainable cloud resource management support for enterprises.
In some embodiments, in step S105, the generating, based on the final scheduling instruction, a configuration script and an automated deployment file for a cross-cloud environment by using a preset template engine specifically includes:
performing association mapping on the resource allocation parameters and the configuration parameters and the deployment parameters to form a template engine;
analyzing the template engine by adopting a context-free grammar, constructing a template analysis tree, and inputting parameters of a final scheduling instruction into the template analysis tree to obtain an initial configuration deployment template;
Setting a cross-cloud grammar conversion rule base, converting the initial configuration deployment template according to the cross-cloud grammar conversion rule base, and performing semantic verification and authority verification to generate a configuration script and an automatic deployment file for a cross-cloud environment.
In the embodiment, the association mapping is established through the resource allocation parameters and the configuration parameters to generate a template engine, and the context-free grammar is adopted to analyze the template engine to construct an analysis tree, so that tree structure data is obtained. And obtaining parameter input through a scheduling instruction, and extracting an input processing result from the tree structure data. If the input processing result meets the preset condition, determining initial configuration content by using a logic construction method. Generating configuration generating data according to the initial configuration content, and adjusting the configuration generating data by adopting a tree structure. Generating data aiming at the adjusted configuration, and obtaining a deployment template frame through deployment template mapping. And extracting logic construction features from the deployment template framework, and judging whether the features accord with context-free rules or not. If the characteristics accord with the context-free rule, updating the deployment template framework through parameter input to obtain final template data.
And acquiring grammar rules and conversion rules by analyzing the cross-cloud environment requirements, and constructing a rule base. And executing conversion processing on the initial configuration deployment template according to the rule base to obtain a conversion result. And carrying out semantic verification on the conversion result, judging the consistency of the content, and generating a template passing the verification. And executing authority verification on the template passing verification, and determining access control compliance to obtain an authority verification result. And generating a configuration script according to the authority verification result, and processing the configuration script into a cross-cloud adaptation format by adopting a script generation tool. And generating a deployment file through the configuration script, and acquiring a complete file set required by automatic deployment. And loading the deployment file in the cross-cloud environment, and executing automatic deployment to complete environment adaptation.
For example, the number of virtual machine instances may be mapped as "instance_count", the number of CPU cores corresponds to "cpu_ cores", the memory capacity association "memory_size", and so on. The template engine formed by the mapping can flexibly adapt to the parameter requirements of different cloud platforms. In one possible implementation, when the context-free grammar parses the template engine, a production rule may be defined such as S→resource|Config| Deploy, resource→ TypeCount, config→ ParamValue, and so on. The template analysis tree constructed by the rules can effectively express the hierarchical structure of resource allocation. In the process of generating the initial configuration deployment template, the scheduling instruction parameters such as a VM-002,3,8 core and 16GB are input into an analysis tree, and the structural template content is obtained through grammar analysis and semantic processing. The method improves the accuracy and efficiency of template generation. In particular, the cross-cloud grammar conversion rule base may include proprietary grammar lookup tables for different cloud platforms. For example, the instance type "ecs.g6.large" of the ali cloud may correspond to "t3.Medium" of the AWS. Through the rule conversion, the initial template can adapt to a plurality of cloud environments, and the deployment compatibility is enhanced. In one embodiment, semantic verification may check for logical relationships between parameters, such as ensuring that the number of CPU cores matches the memory capacity. The rights verification may then check whether the operator has the necessary rights to deploy across clouds, such as checking the validity of the API key. These verification steps significantly promote the reliability of the configuration script. Preferably, the generated configuration script can be in YAML format, so that man-machine interaction is facilitated. And the automatic deployment file can select a template language of Terraform tools and the like, so that a declarative infrastructure, namely codes, are supported, and the resource management flow of the cross-cloud environment is simplified. It can be appreciated that the method realizes the efficient conversion from abstract resource parameters to specific deployment instructions through technologies such as a template engine, grammar analysis, rule conversion and the like, and provides a flexible and standardized cross-cloud resource scheduling scheme for enterprises.
Referring to fig. 2, an embodiment of the present invention provides an automated resource planning system 2 of a hybrid cloud, the system 2 specifically includes:
The first planning module 201 is configured to acquire service load data and a historical operation record in real time, determine a service change trend by using a time sequence analysis algorithm, and obtain a demand prediction model;
The second planning module 202 is configured to obtain dynamic resource demand parameters from the demand prediction model, determine a resource allocation ratio of the private cloud to the public cloud, and determine an initial configuration scheme of the cross-cloud resource pool;
the third planning module 203 is configured to optimize resource scheduling dynamics by adopting a reinforcement learning algorithm based on the initial configuration scheme, so as to obtain a real-time scheduling plan;
A fourth planning module 204, configured to extract specific parameters of resource allocation from the real-time scheduling plan, determine whether the security and flexibility requirements are satisfied, and determine a final scheduling instruction;
and a fifth planning module 205, configured to generate a configuration script and an automated deployment file for the cross-cloud environment by using a preset template engine based on the final scheduling instruction.
It can be understood that the content in the embodiment of the method for planning an automated resource of a hybrid cloud shown in fig. 1 is applicable to the embodiment of the system for planning an automated resource of a hybrid cloud, and the functions specifically realized by the embodiment of the system for planning an automated resource of a hybrid cloud are the same as those of the embodiment of the method for planning an automated resource of a hybrid cloud shown in fig. 1, and the beneficial effects achieved by the embodiment of the method for planning an automated resource of a hybrid cloud shown in fig. 1 are the same as those achieved by the embodiment of the method for planning an automated resource of a hybrid cloud shown in fig. 1.
It should be noted that, because the content of information interaction and execution process between the above systems is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the system is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Referring to fig. 3, an embodiment of the present invention further provides a computer device 3 comprising a memory 302 and a processor 301 and a computer program 303 stored on the memory 302, which computer program 303, when executed on the processor 301, implements the method for automated resource planning of a hybrid cloud according to any of the above methods.
The computer device 3 may be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The computer device 3 may include, but is not limited to, a processor 301, a memory 302. It will be appreciated by those skilled in the art that fig. 3 is merely an example of the computer device 3 and is not meant to be limiting as the computer device 3, and may include more or fewer components than shown, or may combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The Processor 301 may be a central processing unit (Central Processing Unit, CPU), the Processor 301 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 302 may in some embodiments be an internal storage unit of the computer device 3, such as a hard disk or a memory of the computer device 3. The memory 302 may also be an external storage device of the computer device 3 in other embodiments, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the computer device 3. Further, the memory 302 may also include both an internal storage unit and an external storage device of the computer device 3. The memory 302 is used to store an operating system, application programs, boot Loader (Boot Loader), data, and other programs, such as program code for the computer program. The memory 302 may also be used to temporarily store data that has been output or is to be output.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when being run by a processor, implements the method for automated resource planning of a hybrid cloud according to any one of the above methods.
In this embodiment, the integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least any entity or device capable of carrying computer program code to a camera device/terminal equipment, a recording medium, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the disclosed embodiments of the application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.