Data resource contention risk prediction and optimization method based on lstm and attention mechanism

By combining LSTM with an attention mechanism, we can dynamically monitor resource contention in multi-tenant cloud data centers, accurately predict and optimize contention risks, and solve the problems of existing technologies that cannot capture early signs of linkage and are not accurate in optimization, thereby improving resource utilization efficiency and service stability.

CN122154759APending Publication Date: 2026-06-05SHAANXI YUNCHANG INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHAANXI YUNCHANG INFORMATION TECH CO LTD
Filing Date
2026-02-04
Publication Date
2026-06-05

Smart Images

  • Figure CN122154759A_ABST
    Figure CN122154759A_ABST
Patent Text Reader

Abstract

The application discloses a data resource contention risk prediction and optimization method based on LSTM and attention mechanism, and particularly relates to the technical field of computing resource management. First, the multi-dimensional performance index sequence of a cloud data center is collected, and the shared resource affinity of fusion time decay and resource access frequency is calculated as an auxiliary feature to construct an enhanced input for training an LSTM network. The attention mechanism fused with a contention diffusion speed factor is used to dynamically weight the key time slices and quantify the risk driving. The resource contribution mapping of the introduction of the causal test is used to determine the dominant contention resource, and the precise adaptive optimization action, such as virtual machine migration or path partition adjustment, is triggered accordingly, thereby improving the accuracy and interpretability of the resource contention risk prediction, realizing the closed-loop linkage from prediction to optimization, and solving the problems of difficult performance degradation prediction, inaccurate root location and low optimization efficiency caused by the implicit contention of micro-architecture level resources in the cloud data center.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computing resource management technology, and more specifically, to a method for predicting and optimizing data resource contention risks based on LSTM and attention mechanisms. Background Technology

[0002] In multi-tenant cloud data centers, multiple business applications share the same physical server hardware resources via virtual machines or containers. Although the virtualization platform can allocate computing cores and memory quotas to different tenants, at the processor microarchitecture level, shared data paths such as the last-level cache, memory controller, storage I / O queue, and network interface controller are still competed for by all tenants. When applications process data, they form a continuous access chain across cache, memory, storage, and network. When multiple workloads run concurrently, a surge in resource consumption at one stage can trigger a chain of waits, leading to overall performance fluctuations.

[0003] Current cloud platform resource management primarily relies on static quota allocation, single-indicator alarms based on fixed thresholds, or post-event sampling monitoring. However, data resource contention is essentially a dynamic process that evolves over time: it typically begins with multiple tenants frequently accessing and replacing hot data in shared caches, leading to memory bus contention and gradually spreading to storage I / O queuing and network bandwidth saturation, forming a temporal linkage effect of local congestion and link propagation. In the early stages of contention, this effect often manifests as weak, asynchronous abnormal fluctuations in multiple resource indicators, and any single indicator may not have yet reached the alarm threshold, making it difficult for traditional monitoring methods to detect. More importantly, due to the lack of modeling capabilities for long-term dependencies and linkage patterns of multi-dimensional indicator sequences, existing methods cannot identify the patterns of contention evolution from historical and real-time data, nor can they determine the dominant resource type that triggers the chain reaction during the risk accumulation phase. This results in subsequent optimization actions such as migration and rate limiting lacking precise basis, and can only passively respond to performance degradation that has already occurred, causing service response delays, decreased throughput, and low resource utilization efficiency.

[0004] Therefore, there is an urgent need for a prediction and optimization method that can capture early signs of linkage from multi-dimensional time-series monitoring data, learn the dynamic evolution of data resource competition, and accurately locate the root cause, so as to achieve proactive defense and precise suppression of the risk of data resource competition. Summary of the Invention

[0005] To overcome the aforementioned deficiencies in existing technologies, this invention provides a method for predicting and optimizing data resource contention risks based on LSTM and attention mechanisms. By designing a shared resource affinity feature that integrates time decay and resource access frequency, the method enhances the time series model's perception of resource linkage effects. Furthermore, it innovatively introduces a contention diffusion rate adjustment factor into the attention mechanism to focus on the nonlinear risk evolution stage. Simultaneously, it combines resource contribution mapping based on causal testing to achieve accurate attribution and targeted optimization, thereby solving the problems mentioned in the background technology.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for predicting and optimizing data resource contention risk based on LSTM and attention mechanisms, comprising the following steps: Step S1: Collect a continuous performance index sequence of the multi-tenant cloud data center, including shared cache hit rate, memory path utilization, storage I / O queue depth, and network bandwidth utilization. Align the timestamps with a dynamic sliding window and fuse them into a multi-dimensional time-series feature vector to capture early, subtle, interconnected changes in resource contention as the initial input. Step S2: Based on the temporal feature vector, shared resource affinity is introduced as an auxiliary feature. An enhanced input sequence is constructed by calculating the dynamically weighted average of the access correlations among resources, and then input into the LSTM network to learn long-term temporal dependencies. The output hidden state sequence represents the evolution of contention. The shared resource affinity is dynamically calculated by multiplying the time-decayed correlation coefficient by the resource access frequency. Step S3: Utilizing the hidden state sequence, an attention mechanism is applied to dynamically allocate weights to highlight the starting point and spread trend of resource congestion in key time segments, generating a weighted attention vector to quantify the potential driving factors of competition risk; Step S4: Input the weighted attention vector into the fully connected layer to predict the risk probability, and output the level of contention risk and the type of dominant resource within the future time window as the basis for optimization decisions; Step S5: Based on the risk prediction results, trigger an adaptive optimization strategy to suppress contention by prioritizing the migration of tenant virtual machines that dominate resource contention to low-load servers or dynamically adjusting shared path partitions.

[0007] Preferably, in step S1, the time alignment process of the dynamic sliding window aligns the values ​​on a unified time scale reference point by iterating through the sampling points of each index sequence one by one. First, linear interpolation is performed on the non-aligned points to estimate the missing values. Then, the average or median is aggregated within the window as the representative value to form a multi-dimensional feature vector sequence to capture early subtle linkage changes. Before the representative value is calculated, the upper and lower bounds are generated based on the baseline distribution of the same index in the historical stable segment. Sampling points that exceed the upper and lower bounds and are inconsistent with the trend of adjacent time slices are identified as outliers. The representative value is calculated after the outliers are truncated or corrected by interpolation of adjacent time slices to avoid the early linkage signal being distorted by abnormal sampling. At the same time, the moving average filter is applied to the aggregated sequence to smooth the noise and ensure the continuity and stability of the input sequence.

[0008] Preferably, in step S2, when constructing the resource access correlation sequence, high-frequency components are decomposed and suppressed, low-frequency components are baseline corrected, and time-delay correlation values ​​are calculated as correlation coefficients using cross-correlation functions. After obtaining the time-delay correlation values ​​through cross-correlation calculation, lag filtering rules are generated based on the contention proxy sequence formed by the fusion of standardized deviations of multiple resource indicators within the window. The contention proxy sequence obtains a change intensity sequence through first-order difference, and a set of time delays that have a consistent response within the same window as the change intensity peak is selected, and time-delay correlation values ​​that do not have a consistent response are removed. Repeated operations cover each resource pair (at least including pairwise combinations between cache, memory path, storage I / O and network path) to form a correlation sequence set. When generating shared resource affinity features, the retained correlation coefficients are time-decay weighted summed to make recent correlation dominate affinity calculation, and an enhanced input sequence is formed by vector concatenation.

[0009] Preferably, in step S2, after generating the shared resource affinity features, an autoregressive moving average model is applied to the affinity sequence for prediction smoothing to reduce the impact of instantaneous jitter. Before concatenating the affinity features with the original vector element by element through dimensional matching, a nonlinear activation function is applied for fusion to enhance the capture of non-stationarity in contention, forming a feature sequence corresponding to the basic input sequence. Then, the affinity features are concatenated with the original vector element by element through dimensional matching to construct an enhanced input sequence for inputting into the LSTM network. The gated state is updated time-slice by time-slice to output the hidden state sequence, representing the contention evolution law.

[0010] Preferably, in step S3, the input matrix of the attention mechanism is formed by stacking the hidden states within the scope of attention in chronological order. The rows of the matrix correspond to the time slice index and are one-to-one with the time slice index mapping table output in step S2. The columns of the matrix correspond to the hidden state dimension. When constructing the attention weight calculation elements, sinusoidal position encoding is introduced to the query vector and key vector to correct the time position information. When dynamically allocating weights, the similarity score sequence of the key vectors within the scope of attention is calculated based on the query vector corresponding to the current prediction time and normalized to form a weight distribution. The congestion start point change rate is formed by the adjacent difference of the hidden states in the time dimension, and the start point change rate sequence is used to construct the start indication distribution. An entropy penalty is applied to the weight distribution to suppress excessive dispersion, and a consistency constraint based on the divergence between the weight distribution and the start indication distribution is applied to make the weight peak aligned with the start point candidate segment and maintain continuous coverage of adjacent time slices in the diffusion segment, forming a weight distribution used for weighted summation to generate the attention vector.

[0011] Preferably, in step S3, after generating the weighted attention vector, low-frequency noise is filtered out by spectral analysis of the hidden state difference to quantify the specific driving intensity of the resource dimension; the driving factor characterization is extracted by principal component analysis, the hidden state difference of high-weight segments is grouped and aggregated into driving intensity according to the resource dimension, and the output description is bound to quantify the driving factors of competition risk. At the same time, multi-head attention is used to fuse the output of multiple subspaces to ensure comprehensive capture of the linkage at different scales.

[0012] Preferably, in step S4, when establishing the resource contribution mapping, a mapping table from feature dimensions to resource groups is first constructed. The change intensity of the attention vector projection group is aggregated, and the contribution of each group is calculated by weighted summation using attention weights. The dominant resource type is obtained by normalization and sorting, and the risk probability output is bound. When aggregating the change intensity of each resource group, a Granger causality test threshold based on historical time series data is introduced for filtering to ensure that the contribution reflects the causal driving force of the competition and to ensure that the contribution truly reflects the causal driving source of the competition. At the same time, in the case of multi-peak distribution, the relative differences of candidate resources are retained as auxiliary information to improve the prediction robustness.

[0013] Preferably, in step S4, when constructing the fully connected mapping, high-order features are extracted through batch normalization and inter-layer constraints. Before softmax head classification, attention vector time window convolution is applied to capture local peaks of risk probability. Then, softmax head classification is used to dominate resource type, and the output is bound to the risk probability compressed by sigmoid to form future time window prediction results, which serve as the basis for optimization decisions. At the same time, continuous probability curve output is added to reflect trend changes.

[0014] Preferably, in step S5, when performing virtual machine migration, first screen the migrateable tenants to exclude unsupported instances, then calculate the affinity between the target server and the existing load, select a landing point with low affinity and sufficient resources, initiate migration through the platform interface and monitor changes in the process, and if the coupling increases, backtrack and reselect (backtrack when the affinity increases after migration but the risk does not decrease) to reduce the risk of secondary contention. The affinity calculation is combined with Bayesian updates of the predicted risk level during site selection to dynamically adjust the landing point priority; at the same time, the path partition parameters are gradually adjusted to observe the decline of indicators.

[0015] Preferably, in step S5, when suppressing jitter and performing closed-loop calibration, the action interval is set and repeated triggering is combined. After optimization, the collected indicators are compared with the predicted fallback transfer. When the calibration sample is used for parameter adjustment, the online gradient descent and the fallback threshold are jointly optimized. When a deviation exists, the calibration sample is recorded for parameter adjustment, forming a feedback mechanism to stably suppress the spread of contention and improve resource utilization and service stability.

[0016] Technical effects and advantages of the present invention: (1) This invention introduces shared resource affinity, dynamically calculated based on time decay and resource access frequency, as an auxiliary feature, and constructs an enhanced input sequence together with multidimensional performance indicators. This enables the LSTM network to more accurately capture the subtle coupling relationships and early signs of collaborative contention between different resources, thereby learning the evolutionary laws of resource contention from complex time-series data. This effectively solves the problem that existing static monitoring methods cannot provide early warning of performance interference caused by linkage effects because they ignore the dynamic correlation between resources.

[0017] (2) This invention incorporates the reciprocal of the diffusion speed into the attention weight calculation, dynamically focuses on the key stage of nonlinear diffusion, and combines Granger causality test filtering mechanism to accurately attribute resource contribution, thereby realizing the interpretable quantification of risk driving factors; effectively solving the problems of traditional prediction models' rough characterization of risk evolution process and the lack of causal basis for subsequent optimization measures, which leads to blind actions or poor results. Attached Figure Description

[0018] Figure 1 This is a simplified flowchart of the data resource contention risk prediction and optimization method of the present invention. Detailed Implementation

[0019] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0020] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0021] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the scope of this application and its application or use.

[0022] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0023] See Figure 1 A simplified flowchart of a data resource contention risk prediction and optimization method is provided in this invention. Figure 1 The data resource contention risk prediction and optimization method based on LSTM and attention mechanism shown includes: Step S1: Collect a continuous performance index sequence of the multi-tenant cloud data center, including shared cache hit rate, memory path utilization, storage I / O queue depth, and network bandwidth utilization. Align the timestamps with a dynamic sliding window and fuse them into a multi-dimensional time-series feature vector to capture early, subtle, interconnected changes in resource contention as the initial input. Specifically, the implementation process of step S1 includes: The system continuously collects a series of performance metrics related to shared resources from the cloud monitoring system. These metrics include at least shared cache hit rate, memory path utilization, storage I / O queue depth, and network bandwidth utilization. Since the indicators can come from different sampling sources and different sampling periods, a dynamic sliding window (the length of which is adaptively adjusted based on the standard deviation and autocorrelation coefficient of the indicator sequence) is used for time alignment and fusion: with a unified time scale as the benchmark, each indicator is resampled and aggregated within the corresponding window to obtain a multidimensional feature vector sequence on the same time slice; To enable the window to adapt to changes in resource status, the window length can be adaptively adjusted based on the recent volatility of indicators or the strength of autocorrelation. When indicators change more drastically, a finer-grained window is used to capture short-term linkages, while a longer window is used when indicators change more smoothly to enhance trend stability. The fused feature vector sequence is normalized, and missing values ​​and outliers are robustly corrected to avoid bias in model learning caused by individual sampling anomalies. This yields a multidimensional time-series input sequence for subsequent modeling.

[0024] Furthermore, outlier screening employs an adaptive threshold generation rule based on historical baselines: a baseline distribution is constructed for the same indicator within a historically stable segment, and upper and lower bounds are generated based on the dispersion and center position of this distribution; when the indicator value deviates significantly from the baseline within the online window and the direction of deviation is inconsistent with that of adjacent time slices, it is determined to be an outlier.

[0025] Step S2: Based on the temporal feature vector obtained in S1, the affinity of shared resources is introduced as an auxiliary feature. An enhanced input sequence is constructed by calculating the dynamic weighted average of the access correlation between resources, and then input into the LSTM network to learn the long-term temporal dependency relationship. The output hidden state sequence represents the evolution law of contention. The explanation explains that, based on the multidimensional time-series input sequence, shared resource affinity is introduced as an auxiliary feature to explicitly characterize the coupling strength across resources. Shared resource affinity can be defined as the degree of access linkage between different resource indicator sequences within a sliding window. Its calculation can be based on correlation or interdependence, and a dynamic weighting method is used to assign higher weights to more recent time segments to highlight the indicative significance of early, subtle linkage changes for subsequent contention and diffusion (in one possible embodiment, the affinity is equal to the sum of the exponentially decaying weights of each time segment i multiplied by the correlation coefficient and then by the resource access frequency freq_i, divided by the sum of all exponentially decaying weights). To improve robustness, the correlation calculation can suppress or truncate outliers. The output of shared resource affinity can be a scalar or a vector to reflect the coupling strength between different resource pairs. The affinity feature is concatenated with the original multidimensional feature vector to form an enhanced input sequence.

[0026] Specifically, the implementation process of step S2 includes: Sub-step 201: Prepare basic timing features From the multi-dimensional temporal feature vector sequence obtained in step S1, feature dimensions such as shared cache hit rate, memory path utilization, storage I / O queue depth, and network bandwidth utilization are selected to characterize the shared resource status. After time slice alignment, sequence truncation and missing term filling are completed to form the basic input sequence required for subsequent calculations. Sub-step 202: Constructing a resource access correlation sequence A sliding window is used to traverse the basic input sequence window by window. Within each window, paired samples are created for any two resource indicator sequences. First, detrending and scaling are performed on the samples within the window. Then, outliers are suppressed or truncated. Subsequently, the correlation value between the two sequences is calculated and recorded as the correlation coefficient under that window. The above operation is repeated until the correlation calculation of resource pairs such as cache and memory, cache and storage, cache and network, memory and storage, memory and network, and storage and network is completed, thereby obtaining a set of resource access correlation sequences that change over time. Furthermore, after obtaining the correlation values ​​of each time lag through cross-correlation calculation, a lag filtering threshold is generated based on the contention surrogate sequence within the window. The contention surrogate sequence is obtained by weighting and fusing the standardized deviations of each resource indicator within the window according to resource groups, and the change intensity sequence is obtained through first-order differencing. When the correlation peak corresponding to a certain time lag does not form a consistent response with the change intensity peak of the contention surrogate sequence within the same window, the time lag is determined to be an uncorrelated lag and is removed. The set of time lags with consistent responses is retained for subsequent affinity weighting calculation. Sub-step 203: Generate shared resource affinity features Within each window, the resource access correlation coefficients corresponding to that window are dynamically weighted and averaged. The weights are determined based on temporal proximity, ensuring that correlation coefficients closer to the current time have a higher proportion within the window. When using a vector form, the weighted results of each resource pair are arranged in a preset order to form an affinity vector, reflecting the coupling strength between different resource pairs. When using a scalar form, the affinity vector is further aggregated to obtain a single affinity value. Simultaneously, to ensure continuity across windows, the affinity sequence can be smoothed to reduce the impact of instantaneous jitter, ultimately obtaining a shared resource affinity feature sequence that corresponds one-to-one with the time slices of the basic input sequence. In one possible embodiment, the dynamic weighted average process is specifically calculated as follows: when determining weights based on temporal proximity, an exponential decay function is used for calculation, that is, the proximity weight value at the current moment decays exponentially as its time distance from historical moments increases; Sub-step 204: Construct the enhanced input sequence and obtain the hidden state sequence The shared resource affinity features are concatenated with the original multidimensional temporal feature vectors according to time slices to obtain the enhanced input sequence. The enhanced input sequence is then input into the Long Short-Term Memory network in chronological order. At each time slice, the network updates the gating state by combining the current input with the internal memory of the previous time slice and outputs the corresponding hidden state. The hidden states of each time slice are collected to form a hidden state sequence, which serves as a temporal representation of the contention evolution law and is output to subsequent steps.

[0027] Step S3: Using the hidden state sequence output by S2, apply an attention mechanism to dynamically allocate weights to highlight the starting point and spread trend of resource congestion in key time segments, and generate a weighted attention vector to quantify the potential driving factors of competition risk; The explanation explains that the input sequence is enhanced and fed into a Long Short-Term Memory (LSTM) network to learn the long-term temporal dependencies of contention states. The LTM network uses a gating mechanism to retain and forget historical information, thus expressing the nonlinear evolution of contention as local changes gradually accumulate and spread. The network outputs a hidden state sequence, which serves as a temporal encoding of the contention evolution process, containing both responses to short-term disturbances and accumulated information about long-term trends. To improve generalization ability, regularization can be used during training to suppress overfitting, making the model adaptable to different tenant combinations and load patterns.

[0028] Specifically, the implementation process of step S3 includes: Sub-step 301: Prepare the hidden state input sequence The hidden state sequence output from step S2 is received, and its length is truncated and batched according to time order. Abnormal mutation points in the sequence are suppressed to ensure that the hidden states of each time slice are at a comparable scale. Then, the scope of interest corresponding to the current prediction target is determined, and the hidden states within this scope are arranged in their original order to form the input matrix for attention calculation, which serves as the basis for subsequent weight allocation. Furthermore, the input matrix for attention calculation is formed by stacking the hidden states within the scope of interest in chronological order. The rows of the matrix correspond to the time slice indices, and the columns correspond to the hidden state dimensions. The scope of interest is centered on the current prediction time and selects consecutive time slices forward to cover the congestion initiation and spread process. The time slice index mapping table output in step S2 ensures a one-to-one correspondence with the enhanced input sequence. Sub-step 302: Constructing the computational elements of attention weights A linear transformation is applied to each hidden state in the input matrix at each time slice to obtain the query vector, key vector, and value vector. During the calculation, the transformation parameters are shared or grouped to maintain temporal consistency. At the same time, temporal position information is introduced to correct the query and key, so that segments closer to the congestion trigger have higher discriminative power in similarity calculation, providing a separable representation space for subsequent identification of the starting point and diffusion trend. Sub-step 303: Dynamically allocate weights and highlight key segments The congestion initiation point change rate is obtained by differencing adjacent time slices of the hidden state within the key segment set. Specifically, the hidden state sequence is differentiated along the time dimension to form a change rate sequence, and the time slice in which the change rate sequence first shows a sustained increase within the scope of interest is used as the basis for candidate initiation point segments. The similarity score between the query vector and each key vector is calculated for each time slice. Using the query vector corresponding to the current prediction time as a benchmark, the similarity score is calculated for the key vectors of all time slices within the scope of interest, resulting in a score sequence covering both congestion initiation and diffusion segments. After normalizing the score sequence to form a weight distribution, two types of constraints are applied to the weight distribution: first, the entropy of the weight distribution is penalized to suppress excessive weight dispersion, focusing attention on a small number of key time slices; second, an initiation indicator distribution is constructed based on the initiation point change rate sequence, and the divergence between the weight distribution and the initiation indicator distribution is calculated as a consistency constraint, aligning the weight peak with the candidate initiation point segments while maintaining continuous coverage of diffusion segments in adjacent time slices. Sub-step 304: Generate weighted attention vectors and quantify driving factors The attention vector is formed by weighted summation of the value vectors of each time slice using attention weights, and the vector is normalized for cross-batch comparison. Then, the driving factor representation is extracted based on the weight distribution and the direction of hidden state change. The hidden state difference information corresponding to high weight segments is aggregated into driving strength, and the driving contribution description bound to the attention vector is output to characterize the dominant features of the competition risk from the beginning to the spread.

[0029] Furthermore, this embodiment makes scenario-based improvements to the attention mechanism. Specifically, when calculating the attention weight, the reciprocal of the current contention diffusion speed is introduced as a dynamic adjustment factor. The contention diffusion speed is quantified by calculating the absolute value of the rate of change of key resource indicators (such as shared cache hit rate) in adjacent time slices. This adjustment factor is multiplied by the original similarity score, so that the attention weight obtained in the time segment of accelerated contention diffusion is significantly enhanced.

[0030] Step S4: Input the weighted attention vector generated in S3 into the fully connected layer to predict the risk probability, and output the level of contention risk and the type of dominant resource within the future time window as the basis for optimization decisions; The explanation explains that an attention mechanism is applied to the hidden state sequence to dynamically allocate time weights, thereby highlighting the contribution of the resource congestion initiation and diffusion segments to the prediction. The attention mechanism calculates and normalizes the similarity of the hidden state sequence to obtain the time weight distribution, and then weights and aggregates the hidden state sequences to obtain the attention vector (the specific implementation of continuity and sparsity constraints in this step is through the combined application of L1 norm penalty and Gaussian smoothing filtering). The attention vector is used to represent key driving information of contention risk. To simultaneously capture different time scales and different linkage modes, multi-head attention can be used to learn multiple attention subspaces in parallel, and then the outputs of each subspace are fused to obtain the final attention vector. Simultaneously, to output the dominant resource factor, a resource contribution mapping function can be established, aggregating the correspondence between the attention vector and the input feature dimensions to obtain the contribution ranking of each resource dimension, and outputting the one with the highest contribution as the dominant resource type, thus enabling the prediction results to directly serve subsequent optimization decisions.

[0031] The attention vector is input into the prediction layer to obtain the contention risk level within the future prediction window. The prediction layer can use a fully connected structure for nonlinear mapping and output the risk probability or risk level. In addition to the risk level, the dominant resource type is also output as a basis for optimizing action selection. The training objective can be supervised learning. Risk labels can be constructed from contention events or performance degradation events in historical data. Contention events can be obtained by joint conditional judgment of multiple resource indicators simultaneously deviating from the baseline and accompanied by service performance degradation. Dominant resource labels can be obtained by offline statistical analysis of the abnormal contribution of each resource when a contention event occurs or generated in a weakly supervised manner. This provides verifiable supervision for the output of risk level and dominant resource type, avoiding conclusive inferences based solely on attention weights.

[0032] Specifically, the implementation process of step S4 includes: Sub-step 401: Align the prediction input with the time window The system receives the weighted attention vector and its corresponding time slice index from step S3, aligns the attention vector with the current time according to a preset prediction time window, and performs scaling and missing term completion on the vector. Simultaneously, it retains the correlation index between the attention weight distribution and the hidden state difference information, facilitating consistency between subsequent risk output and resource contribution calculations, thus forming an input tensor that can be directly fed into the prediction layer. Sub-step 402: Construct a fully connected mapping and output the risk probability. The input tensor is fed into a fully connected layer for nonlinear feature mapping. First, high-order combined features are extracted through one or more linear transformations, and regularization constraints are added between layers to suppress overfitting. Then, a probability output head is used to compress the mapping result, limiting the output to a probability space to form the contention risk level. During the training phase, the probability output head is supervised by historical contention event labels, enabling the model to learn the risk escalation pattern driven by both the initial fragment and the diffusion trend. Sub-step 403: Establish resource contribution mapping and calculate contribution ranking Based on the feature dimension definition in step S1 and the attention focus segment in step S3, a resource contribution mapping function is constructed (the resource contribution mapping function calculates the contribution by aggregating the dot product of attention weights and hidden state differences). The projection of the attention vector in the feature space is aggregated with each resource dimension group (first, a resource dimension grouping mapping table is determined, and the input feature dimensions are divided into cache group, memory path group, storage I / O group, and network path group; then, the time slice with the highest attention weight is taken as the key segment set, and the change intensity of each group of features is calculated within the key segment set, and the change intensity is weighted and summed with attention weights to obtain the contribution of that group; finally, the contribution of each group is normalized and sorted to obtain the dominant resource type). During aggregation, the attention weight and the change amplitude of the hidden state in the corresponding time slice are combined to obtain the comprehensive contribution of each type of resource; the contribution is normalized and a sorting result is generated to ensure that different resources are comparable and sensitive to both short-term spikes and continuous diffusion. Sub-step 404: Output the dominant resource type and bind it to the risk outcome. The resource category with the highest contribution is selected as the dominant resource type output from the resource contribution ranking, and it is bound to the risk probability output in the same prediction time window. When the contribution distribution is multi-peaked or similar, the top few candidate resources and their relative differences are retained as auxiliary information to avoid noise interference in the single category judgment. The final output includes the prediction results of the competition risk level and the dominant resource type, which can be directly referenced by subsequent optimization strategies.

[0033] Furthermore, to provide more flexible risk insights, the basic risk probability value is converted into one of two expression forms as a supplementary output option: 1) Threshold-based hierarchical expression: mapped to discrete risk levels of high, medium, and low according to a preset probability interval; 2) Continuous expression: directly outputs the smoothed probability curve to more delicately reflect the trend change of risk from its inception to its spread; when the contribution distribution shows multiple peaks or the values ​​are close, the top K candidate resources and their relative contribution differences are retained as auxiliary metadata and output together to enhance the robustness and interpretability of the results.

[0034] Step S5: Based on the risk prediction results of S4, trigger an adaptive optimization strategy to suppress contention by prioritizing the migration of tenant virtual machines that dominate resource contention to low-load servers or dynamically adjusting shared path partitions (a set of control actions to isolate, limit, or adjust the weight of shared resource access). The explanation explains that an adaptive optimization strategy is triggered based on the risk prediction results. This optimization strategy is executed by a strategy engine, which includes at least action mapping rules, jitter suppression constraints, and a closed-loop feedback mechanism. Action mapping rules map the dominant resource type to a set of targeted resource control actions. When the dominant resource is cache-related, cache isolation or affinity scheduling is prioritized; when the dominant resource is memory path-related, memory path quotas or cross-node scheduling are prioritized; when the dominant resource is storage path-related, storage queue weight adjustment or bandwidth shaping is prioritized; and when the dominant resource is network path-related, network priority scheduling or communication throttling is prioritized. When virtual machines need to be migrated, the migration is performed through the cloud platform interface. At the same time, resource affinity constraints are introduced when selecting the migration target to reduce the coupling strength between the migrated landing point and the existing load, thereby reducing the probability of secondary contention. The strategy engine sets trigger interval constraints and benefit evaluation rules (comparing the risk level, dominant resource contribution, and key indicator changes before and after each action; if the risk continues to decline, the current strategy is maintained and a cooling-off period is entered; if the risk decline is insufficient or the dominant resource is transferred, the action set matching the new dominant resource is switched; the samples before and after the action are recorded as calibration samples for subsequent online calibration or periodic retraining to maintain the consistency between prediction and optimization). When the risk change does not achieve significant improvement or is in the cooling-off period, the same type of action is not repeated. After optimization, monitoring metrics are collected and compared with the prediction results. If the deviation persists, the model can be calibrated or updated online. The performance metrics after optimization are compared with the initial prediction, and samples with significant deviations are marked as calibration samples. Calibration samples are used to fine-tune the parameters of the core prediction model (i.e., the LSTM network) online. In one implementation, these calibration samples are used to update the gating parameters of the LSTM network online with a low learning rate. Specifically, sub-step 501: Generate optimization trigger conditions and execution context. The system receives the contention risk level and dominant resource type output from step S4, merges them with the current server load profile, tenant operating status, and historical handling records to form the execution context required for an optimization decision; simultaneously, it forms triggering criteria based on the direction and duration of risk changes and writes them into the trigger queue to ensure that subsequent actions correspond to the same batch of prediction results within the same time window, avoiding false triggers caused by state drift; Sub-step 502: Establish action mapping rules and filter candidate actions Based on the dominant resource type, the action mapping rules are invoked to generate a targeted set of candidate actions, and executable constraints are attached to the candidate actions. When the dominant resource points to a cache or memory path, affinity scheduling, bandwidth limits, or isolation actions are prioritized. When it points to a storage or network path, queue weight adjustment, bandwidth shaping, or priority control actions are prioritized. Subsequently, actions that would trigger secondary contention are eliminated based on tenant importance and resource coupling, forming a set of feasible candidate solutions. Sub-step 503: Perform virtual machine migration and introduce affinity-constrained addressing. When migration is included in the candidate solutions, tenants eligible for migration are first screened to exclude instances with short-term fluctuations or those that do not support migration. Then, target servers are screened for low load and the affinity of shared resources between the migration target and the existing load is calculated. Servers with lower affinity and sufficient remaining resources are prioritized as landing sites. Subsequently, the migration is initiated through the cloud platform interface, and changes in resource consumption during the migration process are continuously monitored. If the migration causes a new increase in coupling, a rollback or reselection of the landing site is triggered to reduce the risk of secondary contention. Sub-step 504: Adjust shared path partitions and implement progressive suppression When candidate solutions include path partitioning or quotas, the corresponding control entry point is first selected based on the dominant resource type (when the dominant resource is cache, cache isolation or cache usage quota control is used; when the dominant resource is memory path, memory path bandwidth quota or memory access rate control is used; when the dominant resource is storage I / O, storage queue weight or scheduling parameter control is used; when the dominant resource is network path, network priority or sending rate control is used; and the control parameters are updated in a progressive manner, with indicators re-collected after each update to determine whether to further deepen the suppression). For example, isolation or quota control is used for cache-related contention, bandwidth or access rate limits are used for memory path contention, queue weight or scheduling parameter adjustment is used for storage path contention, and priority and throttling strategies are used for network path contention. The control parameters are adjusted progressively, first applying small amounts of suppression and observing the indicator decline trend, and then gradually increasing according to feedback to reduce service jitter caused by a one-time strong intervention. Sub-step 505: Suppress jitter and perform closed-loop calibration to improve overall efficiency To avoid oscillations caused by repeated migrations or frequent rate limiting, a cooldown period and a minimum interval for similar actions are set. Requests repeatedly triggered within a continuous time window are merged or delayed. After optimization, key indicators are collected and compared with prediction results to assess whether the risk has decreased and whether the dominant resources have shifted. When deviations persist, they are recorded as calibration samples for online updates or parameter adjustments. Through the above feedback mechanism, resource utilization and service stability are improved. The specific calibration method for the closed-loop feedback mechanism in this step is supplemented by using calibration samples to update the gradient of the LSTM network's gating parameters. Furthermore, the risk level before the action is triggered is used as a reference baseline, and the direction and persistence of the risk level change within the continuous review window after the action is executed are used to make a judgment. When the risk level is continuously decreasing relative to the reference baseline and the contribution of the dominant resource decreases synchronously, it is judged that the decline is valid. When the risk level is not continuously decreasing or the contribution of the dominant resource does not decrease but a shift occurs, it is judged that the decline is invalid and the action switch or rollback is triggered.

[0035] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for predicting and optimizing data resource contention risk based on LSTM and attention mechanism, characterized in that... ,include: Step S1: Collect a continuous performance index sequence of the multi-tenant cloud data center, including shared cache hit rate, memory path utilization, storage I / O queue depth, and network bandwidth utilization. Align the timestamps using a dynamic sliding window and fuse them into a multi-dimensional time-series feature vector. Step S2: Based on the temporal feature vector, shared resource affinity is introduced as an auxiliary feature. An enhanced input sequence is constructed by calculating the dynamically weighted average of the access correlations among resources, and then input into the LSTM network to learn long-term temporal dependencies. The output hidden state sequence represents the evolution of contention. The shared resource affinity is dynamically calculated by multiplying the time-decayed correlation coefficient by the resource access frequency. Step S3: Utilizing the hidden state sequence, apply an attention mechanism to dynamically allocate weights to highlight the starting point and spread trend of resource congestion in key time segments, generating a weighted attention vector; Step S4: Input the weighted attention vector into the fully connected layer to predict the risk probability, and output the level of contention risk and the type of dominant resource within the future time window as the basis for optimization decisions; Step S5: Based on the risk prediction results, trigger an adaptive optimization strategy to suppress contention by prioritizing the migration of tenant virtual machines that dominate resource contention to low-load servers or dynamically adjusting shared path partitions.

2. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S1, the time alignment process of the dynamic sliding window traverses the sampling points of each index sequence one by one, aligns the values ​​on the unified time scale reference point, first performs linear interpolation to estimate missing values ​​for non-aligned points, and aggregates either the average or the median within the window as a representative value to form a multidimensional feature vector sequence. Before the representative value is calculated, the upper and lower bounds are generated based on the baseline distribution of the same index in the historical stable segment, and sampling points that exceed the upper and lower bounds and are inconsistent with the trend of adjacent time slices are identified as outliers. The representative value is calculated after the outliers are truncated or corrected by interpolation of adjacent time slices, so as to avoid the early linkage signal being distorted by abnormal sampling.

3. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S2, when constructing the resource access correlation sequence, high-frequency components are decomposed and suppressed, low-frequency components are baseline corrected, and time-delay correlation values ​​are calculated as correlation coefficients using cross-correlation functions. After obtaining the time-delay correlation values ​​through cross-correlation calculation, lag filtering rules are generated based on the contention proxy sequence formed by the fusion of standardized deviations of multiple resource indicators within the window. The contention proxy sequence obtains a change intensity sequence through first-order difference, and a set of time-delay values ​​that have a consistent response within the same window as the change intensity peak is selected, and time-delay correlation values ​​that do not have a consistent response are removed. The operation is repeated to cover each resource pair to form a correlation sequence set. When generating shared resource affinity features, the retained correlation coefficients are time-decrease weighted summed to make recent correlation dominate affinity calculation, and an enhanced input sequence is formed by vector concatenation.

4. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 3, characterized in that... In step S2, after generating the shared resource affinity features, the affinity features are concatenated element-by-element with the original vector through dimensional matching. Before concatenation, the two types of features are nonlinearly mapped and then fused to form a feature sequence corresponding to the basic input sequence. Then, the affinity features are concatenated element-by-element with the original vector through dimensional matching to construct an enhanced input sequence. The input is then fed into the LSTM network, and the gated state is updated time-by-time to output the hidden state sequence, representing the competition evolution law.

5. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S3, the input matrix of the attention mechanism is formed by stacking the hidden states within the scope of attention in chronological order. The rows of the matrix correspond to the time slice index and are one-to-one with the time slice index mapping table output in step S2. The columns of the matrix correspond to the hidden state dimension. When constructing the attention weight calculation elements, sinusoidal position encoding is introduced to the query vector and key vector to correct the time position information. When dynamically allocating weights, the similarity score sequence of the key vectors within the scope of attention is calculated based on the query vector corresponding to the current prediction time and normalized to form a weight distribution. The congestion start point change rate is formed by the adjacent difference of the hidden states in the time dimension, and the start point change rate sequence is used to construct the start indication distribution. Entropy penalty is applied to the weight distribution to suppress excessive dispersion, and consistency constraint based on the divergence between the weight distribution and the start indication distribution is applied to make the weight peak aligned with the start point candidate segment and maintain continuous coverage of adjacent time slices in the diffusion segment, forming a weight distribution used for weighted summation to generate the attention vector.

6. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 5, characterized in that... In step S3, after generating the weighted attention vector, low-frequency noise is filtered out by spectral analysis of the hidden state difference to quantify the specific driving intensity of the resource dimension; the driving factor characterization is extracted by principal component analysis, the hidden state difference of high-weight segments is grouped and aggregated into driving intensity according to the resource dimension, and the output description is bound to quantify the driving factors of competition risk. At the same time, multi-head attention is used to fuse the output of multiple subspaces to ensure comprehensive capture of the linkage at different scales.

7. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S4, when establishing the resource contribution mapping, a mapping table from feature dimensions to resource groups is first constructed. The change intensity of the attention vector projection group is aggregated, and the contribution of each group is calculated by weighted summation using attention weights. The dominant resource type is obtained by normalization and sorting, and the risk probability output is bound. When aggregating the change intensity of each resource group, a Granger causality test threshold based on historical time series data is introduced for filtering to ensure that the contribution reflects the causal drive of competition.

8. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S4, when constructing the fully connected mapping, before the softmax head classification, the attention vector time window convolution is applied to capture the local peak of the risk probability. Then, the softmax head classification is used to dominate the resource type, and the output is bound to the sigmoid compressed risk probability to form the future time window prediction result. At the same time, the continuous probability curve output is supplemented to reflect the trend change.

9. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 1, characterized in that... In step S5, when performing virtual machine migration, firstly, migrateable tenants are screened to exclude unsupported instances, then the affinity between the target server and the existing load is calculated, and landing points with low affinity and sufficient resources are selected. The migration is initiated through the platform interface and the process changes are monitored. When the affinity increases after migration but the risk does not decrease, the migration is reversed to reduce the risk of secondary contention. The affinity calculation is combined with Bayesian updates of the predicted risk level during site selection to dynamically adjust the landing point priority; at the same time, the path partition parameters are gradually adjusted to observe the decline of indicators.

10. The data resource contention risk prediction and optimization method based on LSTM and attention mechanism according to claim 9, characterized in that... In step S5, during jitter suppression and closed-loop calibration, action intervals are set to merge repeated triggers. After each optimized action is executed, the risk level before the action trigger is used as a reference baseline. The direction and persistence of the risk level change within the continuous review window after the action, as well as the change in the dominant resource contribution, are combined to determine the fallback. When the risk level continuously decreases relative to the reference baseline and the dominant resource contribution decreases synchronously, the fallback is determined to be valid and a cooling-off period is entered. When the risk level does not continuously decrease or the dominant resource contribution does not decrease but a shift occurs, the fallback is determined to be invalid and a new set of actions corresponding to the dominant resource is switched to or a rollback is triggered. The time slice index before and after the action, the set of key segments, the dominant resource type, the type of action executed, and the label of the disposal result are used to form a calibration sample for updating model parameters through online gradient descent.