Dynamic API (Application Program Interface) flow limiting method and system based on multi-modal flow prediction

The dynamic API rate limiting method, which uses multimodal traffic prediction and customer priority assessment, solves the problems of poor traffic pattern adaptability and rate limiting lag in existing technologies. It achieves stability during peak periods and differentiated services for customers, and enhances the system's self-optimization capabilities.

CN121967335APending Publication Date: 2026-05-01BEIJING YULORE INNOVATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING YULORE INNOVATION TECH
Filing Date
2026-02-11
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing API rate limiting technologies cannot adapt to complex and ever-changing traffic patterns, leading to system overload during peak periods or resource waste during off-peak periods. They cannot distinguish between legitimate bursts of traffic and malicious attacks, lack differentiated handling for different customers, and have delayed responses to rate limiting adjustments.

Method used

A multimodal traffic prediction method is adopted, which uses the fusion of LSTM, Prophet and XGBoost models for traffic prediction, and combines customer priority assessment algorithm for differentiated traffic limiting. A closed-loop system of prediction-feedback-optimization is established to dynamically adjust model weights and parameters.

Benefits of technology

It improves the accuracy of traffic prediction and the system's adaptability, enables differentiated traffic limiting for customers, ensures the quality of high-value customer service, and allows the system to continuously optimize and adapt to traffic changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121967335A_ABST
    Figure CN121967335A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic API flow limiting method and system based on multi-modal flow prediction, realizes dynamic API flow limiting based on multi-modal flow prediction, effectively solves the technical limitation of traditional static flow limiting, can accurately predict future flow, realizes a differentiated flow limiting strategy based on customer value, and improves the flow limiting efficiency. And the prediction model is continuously optimized through closed-loop feedback, so that a powerful technical guarantee is provided for the stability and quality of API services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network traffic management, and in particular to a dynamic API rate limiting method and system based on multimodal traffic prediction, which is applicable to API traffic control and management for large-scale Internet applications. Background Technology

[0002] With the rapid development and widespread adoption of internet services, API call volume has exploded. Efficiently managing and controlling API request traffic has become a key technical challenge for ensuring system stability and service quality. In the current technological landscape, API rate limiting technology is widely used to prevent system overload, protect backend services, and improve overall service quality.

[0003] Traditional API rate limiting techniques mainly include static rate limiting strategies such as the token bucket algorithm and the leaky bucket algorithm. The token bucket algorithm adds tokens to the bucket at a fixed rate, consumes tokens as requests arrive, and rejects requests when there are insufficient tokens. The leaky bucket algorithm, on the other hand, stores requests in the bucket and processes them at a fixed rate, discarding requests exceeding the capacity. These methods have advantages in terms of implementation simplicity and resource consumption.

[0004] Existing advanced rate limiting technologies have begun to incorporate some simple adaptive mechanisms, dynamically adjusting rate limiting thresholds by monitoring system load metrics (such as CPU utilization, memory usage, and response time). These technologies can respond to changes in system state to some extent, but they still have significant technical limitations.

[0005] Especially when faced with complex and ever-changing traffic patterns, existing technologies often exhibit significant technical shortcomings: First, static threshold settings are rigid and cannot adapt to the periodic fluctuations in traffic, leading to system overload during peak periods or resource waste during off-peak periods; second, existing technologies struggle to distinguish between legitimate bursts of traffic and malicious attacks, easily resulting in the mistaken deletion of normal business requests; third, traditional rate limiting technologies adopt a "one-size-fits-all" approach, failing to consider the differentiated needs of customers and unable to provide priority protection for high-value customers; finally, rate limiting adjustment mechanisms that rely on manual intervention are slow to respond and cannot make timely adjustments in fault scenarios, easily leading to cascading failures.

[0006] Therefore, a technical solution is needed that can dynamically and accurately limit traffic based on traffic prediction and customer priority. Summary of the Invention

[0007] The purpose of this invention is to provide a dynamic API rate limiting method and system based on multimodal traffic prediction, so as to solve the technical problems in the prior art such as rigid static threshold settings, failure to consider differentiated customer needs, and lag in rate limiting adjustment response, and realize intelligent rate limiting based on traffic prediction.

[0008] To address the aforementioned technical problems, this invention provides a dynamic API rate limiting method based on multimodal traffic prediction, comprising the following steps: collecting historical API call traffic data, business feature data, and external event data through an API gateway monitoring system, business system logs, and an external event management system; performing linear interpolation imputation for missing values, outlier filtering, and binary feature conversion on the historical traffic data, business feature data, and external event data; further performing continuous data normalization, one-hot encoding of categorized data, and time feature construction to obtain a standardized multimodal dataset; based on the standardized multimodal dataset, using an LSTM model to extract features and capture dependencies from time-series samples in the standardized multimodal dataset to obtain basic traffic prediction values; using a Prophet model to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients; and using an XGBoost model to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset. The system obtains business weight coefficients, standardizes the basic traffic prediction value, traffic change coefficient, and business weight coefficient, and performs weighted fusion calculation based on dynamically determined fusion weights to output the traffic prediction value for the future time window. Based on the traffic prediction value and pre-collected customer profile data, a customer priority evaluation algorithm is used to calculate customer levels, resulting in different priority customers. Based on the customer levels, a traffic limiting quota allocation algorithm is used to allocate thresholds to different priority customers, outputting the traffic limiting thresholds for different priority customers. Based on real-time collected actual traffic data and the traffic prediction value, an error index is calculated using a prediction error evaluation algorithm. Based on the error index, a model weight dynamic adjustment algorithm is used to update the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation. Based on long-term accumulated error data, a parameter optimization algorithm is used to update the internal parameters of the LSTM model, Prophet model, and XGBoost model. The updated fusion weights and internal parameters are used to continuously optimize the generation process of the traffic prediction value.

[0009] Preferably, historical traffic data, business characteristic data, and external event data of API calls are collected through an API gateway monitoring system, business system logs, and an external event management system. This includes: collecting API call QPS, request response time, and request success rate through the API gateway monitoring system, with a sampling granularity of 10 seconds, to obtain the historical traffic data; collecting API interface type, interface call frequency, and associated business links through the business system logs to obtain the business characteristic data; and collecting promotional activity schedules affecting API call volume, holiday markers affecting API access patterns, and system maintenance events affecting API service availability from the business operation system, calendar service system, and system monitoring platform through the external event management system to obtain the external event data.

[0010] Preferably, the historical traffic data, business feature data, and external event data are subjected to linear interpolation imputation for missing values, outlier filtering, and binary feature conversion of event data. Further, continuous data normalization, one-hot encoding of categorized data, and construction of time features are performed to obtain a standardized multimodal dataset. This includes: using linear interpolation to imput missing values ​​in the historical traffic data, business feature data, and external event data; using the 3σ criterion to identify and remove outliers; and using a sliding window averaging method to smooth out abnormal data caused by network fluctuations to obtain a clean dataset. Based on the clean dataset, the promotional activity schedules, holiday markers, and system maintenance events in the external event data are converted into binary marker features, and the continuous data is normalized. The system includes QPS, response time, success rate from historical traffic data, and interface call frequency from business feature data. One-hot encoding is performed on categorized data, which includes interface types from the business feature data. Time features are constructed based on 10-second granular sampling timestamps from the clean dataset. The binary marker features, normalized continuous data, one-hot encoded categorized data, and time features are combined to obtain characteristic data. Based on this characteristic data, time-series samples for the LSTM model, a timestamp structured data table for the Prophet model, and a feature matrix for the XGBoost model are constructed. Based on these time-series samples, the timestamp structured data table, and the feature matrix, the standardized multimodal dataset is obtained.

[0011] Preferably, the basic traffic prediction value is obtained by extracting features and capturing dependencies from the time-series samples in the standardized multimodal dataset using an LSTM model, including: constructing a two-layer stacked LSTM network architecture based on the time-series samples in the standardized multimodal dataset, wherein the first layer LSTM has 64 units, the second layer LSTM has 64 units, and the dropout rate is 0.2; adding a fully connected layer to the output layer of the two-layer stacked LSTM network architecture; inputting the time-series samples into the two-layer stacked LSTM network architecture; encoding and extracting the input time-series features through the first layer LSTM to capture short-term time dependencies; and then... The hidden state output of the first LSTM layer is passed to the second LSTM layer, which further extracts long-term temporal dependencies and complex temporal patterns to obtain a deep temporal feature representation with a dimension of 64. This deep temporal feature representation is then input into the fully connected layer, which performs a linear transformation to map the 64-dimensional features into a single numerical output, yielding the original traffic prediction value. Based on the original traffic prediction value and pre-collected real traffic label data, the mean squared error loss function is calculated. The Adam optimizer is then used to backpropagate and update the parameters of the two-layer stacked LSTM network architecture and the fully connected layer. After iterative training and convergence, the basic traffic prediction value is obtained.

[0012] Preferably, the basic traffic prediction value, traffic change coefficient, and service weight coefficient are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic prediction value for the future time window. This includes: applying maximum-minimum normalization to the basic traffic prediction value, mapping it to the [0,1] interval, to obtain Q. LSTMnorm The traffic change coefficient and service weight coefficient are standardized using Z-score to obtain the standardized value β of the traffic change coefficient. norm The standardized value γ of the business weight coefficient norm Based on the comparison between historical prediction data and actual traffic data, the fusion weights α for the LSTM model, Prophet model, and XGBoost model are determined through cross-validation and scenario-weighted adjustment. final β final γ final And ensure α final +β final +γ final =1; Calculate the normalized fusion value: Q_pred norm =α final ×Q LSTMnorm +β final ×β norm +γ final ×γ norm ; for the standardized fusion value Q_prednorm Perform inverse normalization to obtain the traffic prediction value Q_pred for the future time window.

[0013] Preferably, in the calculation of the standardized fusion value Q_pred norm Then, regarding the Q_pred norm Before performing inverse normalization, the method further includes a step of fusion optimization using a multi-covariance learning operator: based on the Q... LSTMnorm β norm γ norm A 3×3 covariance matrix is ​​constructed, where the eigenelements of the covariance matrix are the covariances between standardized values. The angles of each eigenele are calculated to quantify the correlation angles between them, and a feature coupling graph is constructed based on these correlation angles. Based on the feature coupling graph, a Mahalanobis distance metric is constructed using the covariance matrix Σ, and the adaptive covariance weights are calculated by substituting the Mahalanobis distance metric into the adaptive covariance weights calculation formula. Based on the adaptive covariance weights, a covariance-enhanced fusion objective function is constructed. Based on the fusion objective function, the optimal fusion prediction value Q_pred_cov is solved using the conjugate gradient method, and Q_pred_cov is used as the final standardized fusion value for subsequent inverse normalization operations.

[0014] Preferably, the covariance-enhanced fusion objective function is constructed, and the optimal fusion prediction value Q_pred_cov is solved using the conjugate gradient method based on the fusion objective function. The method further includes: calculating the Frobenius norm difference Δ between the current covariance matrix and the historical covariance matrix. F The historical covariance matrix is ​​the covariance matrix of the previous time step within the sliding window; when the Δ F When the preset threshold is exceeded, the covariance adaptive weights are recalculated; a new covariance structure is constructed based on the recalculated covariance adaptive weights, and the new covariance structure is fed back into the LSTM model, Prophet model and XGBoost model to dynamically adjust the fusion weights and internal parameters of each model.

[0015] Preferably, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation are updated based on the error index using a model weight dynamic adjustment algorithm, and the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated based on long-term accumulated error data using a parameter optimization algorithm. This includes: periodically comparing the traffic prediction value with the real-time collected actual traffic data, and calculating the RMSE error index based on the root mean square error; calculating the prediction errors of the LSTM model, Prophet model, and XGBoost model in each scenario, and adjusting the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation according to the error magnitude; and periodically optimizing the number of network layers and neurons of the LSTM model, the trend change point detection frequency of the Prophet model, and the depth and number of trees of the XGBoost model based on long-term accumulated error data. The error data includes the RMSE error index recorded in time series, the corresponding scenario marker that generated the error, and timestamp information.

[0016] Preferably, based on long-term accumulated error data, the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model are periodically optimized. The error data includes RMSE error metrics recorded in time series, the corresponding scene markers that generated the error, and timestamp information. This includes: constructing a diverse parameter set containing multiple candidate parameter vectors based on the parameters of the LSTM model, the Prophet model, and the XGBoost model; generating an initial diverse parameter set using Latin hypercube sampling; the parameters of the LSTM model include the number of network layers and neurons; the parameters of the Prophet model include the trend change point detection frequency; and the parameters of the XGBoost model... The parameters include the depth and number of trees; based on the initial diversity parameter set, a parameter performance mapping matrix is ​​constructed, the covariance matrix of the mapping matrix is ​​calculated, the covariance matrix is ​​decomposed into features, and a dimension-reduced projection matrix is ​​constructed; using the dimension-reduced projection matrix and the diversity parameter set, the similarity of each pair of parameter vectors in the diversity parameter set is calculated, a diversity metric function is constructed, the diversity metric is calculated, and when the diversity metric is lower than a preset metric threshold, the parameter set is subjected to diversity enhancement processing; based on the parameter set after diversity enhancement processing and the dimension-reduced projection matrix, an objective function is constructed, the objective function is used as the optimization benchmark, the search direction is guided by the dimension-reduced projection matrix, and the parameters of multiple models are collaboratively optimized through a regularized iterative multi-point estimation strategy, outputting the optimized parameter configuration.

[0017] This invention also provides a dynamic API rate limiting system based on multimodal traffic prediction, comprising: a multimodal dataset construction module, used to collect historical traffic data, business feature data, and external event data of API calls through an API gateway monitoring system, business system logs, and an external event management system; performing linear interpolation imputation for missing values, outlier filtering, and binary feature conversion of event data on the historical traffic data, business feature data, and external event data; and further performing continuous data normalization, one-hot encoding of categorized data, and time feature construction to obtain a standardized multimodal dataset; and a traffic prediction module, used to perform feature extraction and dependency capture on time-series samples in the standardized multimodal dataset using an LSTM model to obtain basic traffic prediction values; perform trend analysis and impact identification on the timestamp structured data table in the standardized multimodal dataset using a Prophet model to obtain traffic change coefficients; and perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset using an XGBoost model to obtain business weights. The system employs a weighted coefficient module to standardize the basic traffic prediction value, traffic change coefficient, and business weight coefficient, and performs weighted fusion calculation based on dynamically determined fusion weights to output the traffic prediction value for future time windows. A rate limiting threshold calculation module calculates customer levels based on the traffic prediction value and pre-collected customer profile data using a customer priority evaluation algorithm, obtaining customers with different priorities. Based on these customer levels, a rate limiting quota allocation algorithm is used to allocate thresholds to customers with different priorities, outputting the rate limiting thresholds for each priority customer. A closed-loop feedback optimization module calculates an error index based on real-time collected actual traffic data and the traffic prediction value using a prediction error evaluation algorithm. Based on this error index, a model weight dynamic adjustment algorithm is used to update the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation. Based on long-term accumulated error data, a parameter optimization algorithm is used to update the internal parameters of the LSTM model, Prophet model, and XGBoost model. The updated fusion weights and internal parameters are then used to continuously optimize the generation process of the traffic prediction value.

[0018] Compared with the prior art, the technical solution of the present invention has the following beneficial effects: 1. This invention employs a multimodal data and multi-model fusion method for traffic prediction, integrating the temporal dependency features captured by the LSTM model, the event impact identified by the Prophet model, and the business features analyzed by the XGBoost model, which significantly improves the accuracy of traffic prediction, especially during peak periods and special events.

[0019] 2. This invention implements a differentiated rate limiting strategy based on customer priority. By using customer profiles and priority calculations, different rate limiting thresholds are assigned to customers with different priorities, thus ensuring the service quality of high-value customers.

[0020] 3. This invention establishes a closed-loop system of prediction-feedback-optimization. By comparing real-time traffic data with predicted values, the model weights and parameters are dynamically adjusted, enabling the system to continuously optimize itself and adapt to changes in traffic patterns.

[0021] 4. This invention introduces a multi-covariance learning operator for fusion optimization, which takes into account the interrelationship between the outputs of different models, further improving the prediction accuracy and the system's response to sudden traffic fluctuations.

[0022] 5. This invention applies an improved RIME algorithm for parameter optimization. Through diversity enhancement mechanisms and covariance structure guidance, it achieves more efficient global parameter search and avoids getting trapped in local optima. Attached Figure Description

[0023] Figure 1 This is a flowchart of the dynamic API rate limiting method based on multimodal traffic prediction in Embodiment 1 of the present invention; Figure 2 This is a structural diagram of the dynamic API flow limiting system based on multimodal flow prediction in Embodiment 2 of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0025] Example 1 like Figure 1 As shown, this embodiment provides a dynamic API rate limiting method based on multimodal traffic prediction, including the following steps: Historical traffic data, business characteristic data, and external event data of API calls are collected through the API gateway monitoring system, business system logs, and external event management system. Missing value linear interpolation filling, outlier filtering, and binary feature conversion of event data are performed on the historical traffic data, business characteristic data, and external event data. Furthermore, continuous data normalization, one-hot encoding of categorized data, and construction of time features are performed to obtain a standardized multimodal dataset. Based on the standardized multimodal dataset, the LSTM model is used to extract features and capture dependencies from the time-series samples in the standardized multimodal dataset to obtain basic traffic prediction values. The Prophet model is used to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients. The XGBoost model is used to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset to obtain business weight coefficients. The basic traffic prediction values, traffic change coefficients, and business weight coefficients are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic prediction values ​​for future time windows. Based on the traffic prediction value and the pre-collected customer profile data, the customer level is calculated by the customer priority evaluation algorithm to obtain customers with different priorities. Based on the customer level, the threshold is allocated to customers with different priorities by the traffic limit quota allocation algorithm, and the traffic limit threshold of different priority customers is output. Based on real-time collected actual traffic data and the traffic prediction value, an error index is calculated using a prediction error evaluation algorithm. Based on the error index, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation are updated using a model weight dynamic adjustment algorithm. Based on long-term accumulated error data, the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated using a parameter optimization algorithm. The updated fusion weights and internal parameters are used to continuously optimize the process of generating the traffic prediction value.

[0026] Traffic prediction is the core of this invention, employing three complementary models for collaborative prediction to fully leverage the advantages of each. LSTM (Long Short-Term Memory) is a variant of recurrent neural networks specifically designed for processing sequential data, effectively addressing the vanishing gradient problem in traditional RNNs when learning long sequences. The core mechanism of LSTM consists of a memory unit composed of an input gate, a forget gate, and an output gate. The input gate controls the degree to which new information enters the memory unit, the forget gate determines which old information is discarded, and the output gate controls the amount of information passed out of the memory unit. This design enables LSTM to "remember" important information in long sequences and "forget" irrelevant information, making it particularly suitable for capturing long-term temporal dependencies in API traffic.

[0027] In this invention, the LSTM model employs a two-layer stacked network architecture. Both the first and second layers contain 64 LSTM units, and a dropout rate of 0.2 is set to prevent overfitting. The model input is a time-series sample containing various feature sequences within a certain time window (e.g., 24 hours). The first LSTM layer performs initial feature encoding to capture short-term dependencies (e.g., minute-level traffic changes). The hidden state output of the first layer is passed to the second LSTM layer to further extract long-term dependencies (e.g., hourly or day-level periodic patterns). Finally, a fully connected layer maps the 64-dimensional deep time-series features to a single traffic prediction value. The model training process uses mean squared error as the loss function, employs the Adam optimizer for parameter updates, and sets the initial learning rate to 0.001 with a learning rate decay strategy. The LSTM model output is the basic traffic prediction value, serving as the foundation for the overall prediction.

[0028] Prophet is a time series forecasting model developed by Facebook, particularly suitable for data with strong seasonality and influenced by multiple external factors. The core idea of ​​Prophet is to decompose a time series into three main components: a trend term g(t), a seasonal term s(t), and a holiday term h(t), which are then used for forecasting using an additive model y(t) = g(t) + s(t) + h(t) + ε, where ε is the error term. The trend term captures long-term non-periodic changes in the data and can be a linear or logistic growth pattern; the seasonal term captures periodic changes, typically using Fourier series fitting for daily, weekly, and yearly cycles; and the holiday term simulates the impact of specific events (such as promotional activities and holidays) on the time series.

[0029] In this invention, the input to the Prophet model is a timestamp-structured data table containing historical time points, corresponding QPS values, and various event markers. The model first identifies long-term trends in the time series, such as the year-on-year increase in API call volume as business grows; then it analyzes multiple seasonal cycles, such as traffic differences between weekdays and weekends, and the alternation of daily peaks and troughs; finally, it quantifies the impact of external events, such as a potential 50% increase in traffic during promotional activities. The output of the Prophet model is the traffic variation coefficient β, which reflects the combined results of trends, seasonality, and event impacts obtained after time series decomposition, and serves as an important adjustment factor for the base forecast values.

[0030] XGBoost (eXtreme Gradient Boosting) is an ensemble learning algorithm based on decision trees. It corrects errors in previous trees by continuously training new decision trees, ultimately forming a powerful predictive model. Key features of XGBoost include: using second-order derivatives for loss function optimization, significantly improving convergence speed; incorporating multiple regularization techniques to prevent overfitting; supporting parallel computing to accelerate training; automatically handling missing values; and implementing tree pruning strategies to reduce model complexity. These characteristics make XGBoost excellent at handling high-dimensional features and discovering complex nonlinear relationships.

[0031] In this invention, the input to the XGBoost model is a feature matrix, containing business features (such as interface type and call frequency), temporal features, and other auxiliary features. The model progressively improves prediction accuracy by constructing multiple decision trees (typically 100-500), each tree focusing on correcting the residuals of all preceding trees. XGBoost can automatically assess the importance of each feature and discover complex correlation patterns between business features and traffic, such as the traffic variation patterns of a certain type of interface in a specific business scenario. The output of the XGBoost model is the business weight coefficient γ, which reflects the adjusting effect of business features on traffic prediction and can capture business correlation factors that LSTM and Prophet models may overlook.

[0032] Model fusion is a key step in combining the strengths of various models to improve overall prediction accuracy. First, the outputs of each model are standardized: the basic flow prediction value output by LSTM is normalized using min-max normalization, mapped to the [0,1] interval, to obtain Q. LSTMnorm The traffic variation coefficient β output by Prophet and the service weight coefficient γ output by XGBoost are standardized using Z-score to obtain β. norm and γ norm Standardization ensures that the outputs of different models can be compared and fused at the same scale.

[0033] The fusion weights are determined using a dynamic adaptive strategy. Based on the comparison between historical prediction data and actual traffic data, the fusion weights α for the three models LSTM, Prophet, and XGBoost are determined through cross-validation and scenario weight adjustment techniques. final β final and γ final These weights reflect the prediction accuracy of each model in different scenarios and satisfy α. final +β final +γ finalThe normalization condition is 1. In practical applications, the system continuously monitors the performance of each model under different traffic patterns and dynamically adjusts the fusion weights. For example, it increases the weight of LSTM during stable traffic periods, increases the weight of Prophet during promotional periods, and increases the weight of XGBoost in complex business scenarios.

[0034] Finally, the standardized fusion prediction value Q_pred is obtained through weighted fusion calculation. norm = α final ×Q LSTMnorm +β final ×β norm + γ final ×γ norm Then, inverse normalization is performed to obtain the final future time window traffic forecast value Q_pred. This multi-model fusion forecasting method combines the advantages of three dimensions: time series pattern capture, trend seasonality analysis, and business feature correlation mining, which significantly improves the accuracy and robustness of traffic forecasting, especially performing excellently in complex and ever-changing real-world business environments.

[0035] Based on the traffic prediction value and the pre-collected customer profile data, the customer level is calculated by the customer priority evaluation algorithm to obtain customers with different priorities. Based on the customer level, the threshold is allocated to customers with different priorities by the traffic limit quota allocation algorithm, and the traffic limit threshold of different priority customers is output. Customer priority-based differentiated rate limiting is a key application of this invention, achieving the goal of intelligently allocating API resources based on customer value. Customer profile data is a structured description of the multi-dimensional characteristics of API call customers, typically including three core types of information: customer level, determined by business contracts or internal ratings, such as Diamond, Gold, and Standard; historical call volume, a normalized metric recording the total number of API calls made by the customer recently (usually 30 days); and payment amount, a normalized value of the total amount paid by the customer for API services in the recent period. This customer profile data is usually stored in a customer relationship management system or a dedicated customer profile database, linked to API calls through customer identifiers.

[0036] The customer priority assessment algorithm is a method for calculating customer importance weights based on customer profile data. The algorithm uses a weighted average model, comprehensively considering multiple customer characteristics, and is typically expressed as: Customer Priority Weight = w1 × Customer Level + w2 × Historical Call Volume + w3 × Payment Amount, where w1, w2, and w3 are the weight coefficients of each factor, reflecting the degree of importance the business strategy places on different factors. In practical applications, these weights may be dynamically adjusted according to business strategies; for example, the weight of payment amount may be increased during the business expansion phase, while the weight of historical call volume may be increased during the stable operation phase.

[0037] In practice, the first step is to extract three core customer characteristic data from the customer relationship management system: customer level, historical call volume, and payment amount. Customer level is determined based on the service agreement signed between the customer and the platform, typically divided into three discrete levels: large customers (corresponding to a weight coefficient of 1.0), ordinary customers (corresponding to a weight coefficient of 0.5), and new customers (corresponding to a weight coefficient of 0.3). Historical call volume is the normalized value of the customer's total API calls over the most recent 30 calendar days. The normalization method is to divide the customer's call volume by the maximum call volume among all customers during the same period, obtaining a continuous value between 0 and 1. Payment amount also undergoes normalization over a 30-day window, scaled proportionally based on the maximum payment amount during the same period.

[0038] The customer priority weight W is calculated using a weighted linear combination model, specifically: the weight coefficient for customer level is set to 0.5, the weight coefficient for historical call volume is set to 0.3, and the weight coefficient for payment amount is set to 0.2. This weight allocation reflects the business strategy's prioritization of commercial contract value while also considering customer activity and contribution. The calculated weight value W is discretized and classified according to two thresholds: when W is greater than or equal to 0.8, the customer is classified as a high-priority customer (P1 level); when W is greater than or equal to 0.5 and less than 0.8, the customer is classified as a medium-priority customer (P2 level); and when W is less than 0.5, the customer is classified as a low-priority customer (P3 level). This classification result will be directly used for the differentiated allocation of subsequent traffic limiting quotas.

[0039] Based on calculated weight values, the system categorizes customers into different priority levels. A three-tiered approach is typically used: high priority (P1) customers with a weight ≥ 0.8, usually important business partners or core paying customers; medium priority (P2) customers with a weight between 0.5 and 0.8, usually stable long-term customers; and low priority (P3) customers with a weight < 0.5, usually new customers or free users. This priority classification considers both business value and customer loyalty, balancing short-term gains and long-term value.

[0040] The rate-limiting quota allocation algorithm is the core mechanism for rationally allocating API resources based on customer priority and system-predicted traffic. The algorithm first determines the quota ratio for different priority customers, such as P1 customers receiving 50% of the total predicted traffic, P2 customers receiving 30%, and P3 customers receiving 20%. This ratio reflects the business's resource allocation strategy for different customer groups, ensuring high-value customers receive stable service quality. Then, based on the traffic prediction value Q_pred calculated in the previous step, the specific rate-limiting threshold for each priority customer is calculated. For example, if the predicted average QPS for the next 10 minutes is 5000, then the rate-limiting threshold for P1 customers is 5000 × 50% = 2500, for P2 customers it is 5000 × 30% = 1500, and for P3 customers it is 5000 × 20% = 1000.

[0041] In practice, the first step is to determine the quota allocation for each priority customer. High-priority customers (P1) are allocated 50% of the predicted traffic quota, medium-priority customers (P2) are allocated 30%, and low-priority customers (P3) are allocated 20%. This allocation ensures that high-value customers receive sufficient resources while reserving basic service capabilities for medium and low-priority customers.

[0042] The specific rate limiting threshold calculation formula for each priority customer is as follows: the rate limiting value for that priority is equal to the predicted traffic value multiplied by the quota percentage for that priority. For example, when the predicted average QPS for the future time window is 4364, the rate limiting threshold for customer P1 is 4364 multiplied by 50%, which is 2182 QPS; the rate limiting threshold for customer P2 is 4364 multiplied by 30%, which is 1309 QPS; and the rate limiting threshold for customer P3 is 4364 multiplied by 20%, which is 873 QPS.

[0043] The algorithm also includes a dynamic adjustment mechanism. It monitors the average API response time and request success rate in real time. When a response time increases by more than 50% compared to the baseline or a success rate decreases by more than 5%, a protective adjustment is triggered: the rate limiting threshold for P1 customers remains unchanged, the rate limiting threshold for P2 customers is reduced by 10%, and the rate limiting threshold for P3 customers is reduced by 20%, prioritizing service quality for high-priority customers. Once the system load returns to normal, the rate limiting thresholds are restored proportionally.

[0044] To address business fluctuations and changes in system pressure, the rate limiting quota allocation algorithm also includes a dynamic adjustment mechanism. The system continuously monitors key performance indicators (such as CPU utilization, memory usage, and response time). When it detects excessive system load, it automatically triggers protective adjustments, such as lowering the overall rate limiting threshold or adjusting priority quota ratios. For example, when the system load exceeds 80%, the overall rate limiting threshold may be reduced to 90% of the predicted value, and the rate limiting quotas for each priority customer may be adjusted accordingly. This dynamic adjustment ensures that the system remains stable under high pressure while prioritizing service quality for high-value customers.

[0045] At the rate limiting execution level, this invention implements differentiated processing strategies for customers with different priorities. For high-priority customers (P1), requests exceeding the rate limiting threshold enter a special queuing queue, are processed with delay but not directly rejected, ensuring that important customers' requests are eventually processed; for medium-priority customers (P2), excess requests return a specific "retry later" prompt with a recommended retry time, guiding customers to re-initiate requests at a better time; for low-priority customers (P3), excess requests are directly rejected and a rate limiting prompt is returned. This tiered processing strategy not only ensures the overall stability of the system but also provides differentiated service experiences for customers of different values, maximizing the utilization of API resources.

[0046] Based on real-time collected actual traffic data and the traffic prediction value, an error index is calculated using a prediction error evaluation algorithm. Based on the error index, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation are updated using a model weight dynamic adjustment algorithm. Based on long-term accumulated error data, the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated using a parameter optimization algorithm. The updated fusion weights and internal parameters are used to continuously optimize the process of generating the traffic prediction value.

[0047] Closed-loop feedback optimization is the key mechanism for continuous self-optimization in this invention, ensuring that the system can continuously learn and adapt to changes in traffic patterns. The prediction error assessment algorithm compares predicted traffic values ​​with actual traffic data to evaluate prediction accuracy. The system collects actual traffic data from the API gateway in real time and periodically (usually every 5 minutes) compares it with predicted values ​​from the same period, calculating various error metrics. RMSE (Root Mean Square Error) is the core metric, calculated by averaging the squared differences between the predicted and actual values ​​and then taking the square root. This effectively measures prediction accuracy and is more sensitive to larger errors. In addition to RMSE, the system also calculates auxiliary metrics such as MAE (Mean Absolute Error) and MAPE (Mean Absolute Percentage Error) to evaluate prediction quality from different perspectives.

[0048] In practice, a fixed evaluation period of 5 minutes is used, and error calculation is performed at the end of each period. First, the actual traffic flow data within that period is collected, and the arithmetic mean of the actual QPS within that period is calculated. At the same time, the traffic flow prediction value output by the model during the same period is extracted. The prediction error uses the root mean square error (RMSE) as the core evaluation indicator. The calculation process is as follows: calculate the difference between the predicted value and the actual value, square the difference, sum the squared errors over all sample points within the evaluation period, divide by the sample size, and finally take the square root of the result to obtain the RMSE value.

[0049] To support refined model optimization, the algorithm also performs scenario-based error analysis. Traffic scenarios are divided into three categories: stable daily scenarios, promotional activity scenarios, and low-traffic stable scenarios. Stable daily scenarios refer to normal weekday hours without special events; promotional activity scenarios refer to the activity period marked according to the promotional activity schedule and its preceding and following buffer periods; low-traffic stable scenarios refer to periods such as 0:00 to 6:00 AM, when traffic is significantly lower than the daily average. The RMSE value is calculated for each scenario, forming a scenario-error mapping table to identify prediction bias patterns in specific scenarios.

[0050] Error data is stored in a time-series structure, with each record containing a timestamp, scene label, RMSE value, and independent prediction errors from the three base models. This dataset serves as the input data source for dynamic adjustment of model weights and parameter optimization.

[0051] These error metrics are not only used for overall prediction evaluation, but are also broken down into different traffic scenarios (such as daily scenarios, promotional scenarios, and off-peak scenarios) and different time granularities (minute-level, hour-level, and day-level), forming a multi-dimensional prediction performance profile. This detailed analysis can accurately pinpoint the strengths and weaknesses of different models in various scenarios, providing precise guidance for subsequent model optimization.

[0052] The dynamic model weight adjustment algorithm is a mechanism that adaptively updates the fusion weights of multiple models based on prediction errors. The algorithm calculates the independent prediction errors of the LSTM, Prophet, and XGBoost models in each scenario and applies the "inverse error weighting" principle, meaning that the model with the smaller prediction error receives a higher fusion weight. Specifically, assuming the RMSE of the three models in a certain scenario are e LSTM e Prophet and e XGBoost The corresponding fusion weights can be calculated as follows: α = (1 / e LSTM ) / S, β = (1 / e Prophet ) / S, γ = (1 / e XGBoost ) / S, where S = 1 / e LSTM + 1 / e Prophet + 1 / eXGBoost It is a normalization factor that ensures α + β + γ = 1.

[0053] To avoid drastic fluctuations in weights, a smooth update strategy is typically adopted in practical applications. This is calculated as: New Weight = (1-μ) × Old Weight + μ × Calculated Weight, where μ is the update rate parameter, controlling the speed of weight updates, and is usually set between 0.1 and 0.3. Furthermore, the system automatically adjusts the weight update strategy based on traffic patterns, using a smaller update rate during periods of stable traffic and a larger update rate during periods of sudden traffic changes, thereby improving the system's response speed to abnormal situations.

[0054] In its implementation, the algorithm first extracts the RMSE error data of each base model (LSTM, Prophet, XGBoost) in various scenarios within the most recent evaluation period. The initial fusion weights are calculated using the inverse error weighting principle: the inverse of the RMSE for each model is calculated, and the three inverses are summed to obtain a normalization factor. The initial weight of each model is equal to the inverse of its RMSE divided by the normalization factor. This principle ensures that models with smaller prediction errors receive higher fusion weights.

[0055] To avoid drastic fluctuations in weights that could lead to unstable prediction results, the algorithm introduces a smoothing update mechanism. Let the current fused weights be the old weights, and the previously calculated weights be the initial weights. The new weights are equal to the old weights multiplied by the smoothing coefficient (1 minus the update rate) plus the initial weights multiplied by the update rate. The update rate parameter is typically set between 0.1 and 0.3. A smaller value (0.1) is used during periods of stable traffic to ensure smoothness, while a larger value (0.3) is used during periods of sudden traffic changes to accelerate response.

[0056] The algorithm also includes scenario-adaptive logic. It detects the scenario to which the current traffic pattern belongs. If the current activity is a promotional period and historical data shows that the Prophet model's RMSE is significantly lower than other models in this scenario, the Prophet model's fusion weight is temporarily increased by 20%, while the weights of other models are proportionally reduced. When switching scenarios, the weights transition gradually using a smooth mechanism to avoid abrupt changes.

[0057] The updated fusion weights must satisfy the normalization constraint, meaning the sum of the weights of the three models must equal 1. The weight update results are applied in real time to the multi-model fusion calculation in the next prediction period, forming a closed loop of error feedback to weight optimization.

[0058] The parameter optimization algorithm is a mechanism that periodically optimizes the internal parameters of each prediction model based on long-term accumulated error data. The system stores the RMSE error index, corresponding scene labels, and timestamp information recorded in time series, forming a complete error dataset. Based on this data, the system periodically (usually weekly or monthly) triggers the model parameter optimization process, with the goal of finding the optimal parameter combination that minimizes the prediction error.

[0059] For LSTM models, the main parameters to be optimized include the number of network layers (affecting model complexity and fitting ability), the number of neurons per layer (affecting feature extraction ability), and the learning rate (affecting training convergence speed and stability). For Prophet models, the main optimizations include the frequency of trend change point detection (affecting sensitivity to trend changes), the seasonality strength parameter (controlling the influence of seasonal components), and the holiday effect parameter (adjusting the weight of the influence of special events). For XGBoost models, the optimizations include the depth of the trees (affecting model complexity), the number of trees (affecting ensemble performance), the learning rate, and the regularization parameters (controlling the risk of overfitting).

[0060] In practice, the algorithm executes on a weekly or monthly basis, triggering the optimization process based on the accumulated error dataset from the past three months. First, a parameter search space is constructed for each model: for the LSTM model, the parameters to be optimized include the number of network layers (search range 1 to 3 layers), the number of neurons per layer (search range 32 to 128), the initial learning rate (search range 0.0001 to 0.01), and the input window size (search range 12 hours to 48 hours); for the Prophet model, the parameters to be optimized include the frequency of trend change point detection (search range 3 to 14 days), the annual seasonal Fourier order (search range 5 to 15), the weekly seasonal Fourier order (search range 2 to 5), and the daily seasonal Fourier order (search range 2 to 6); for the XGBoost model, the parameters to be optimized include the maximum tree depth (search range 3 to 10 layers), the number of trees (search range 50 to 500), the learning rate (search range 0.01 to 0.3), and the subsampling rate (search range 0.6 to 1.0).

[0061] The algorithm employs Latin hypercube sampling to generate an initial candidate parameter set in the parameter space, ensuring a uniform distribution of samples within the parameter space. For each candidate parameter configuration, five-fold cross-validation is performed using a historical dataset, and the average RMSE on the validation set is calculated as the performance score for that parameter configuration.

[0062] To improve search efficiency, the algorithm introduces a diversity enhancement mechanism. The cosine similarity between parameter vectors in the candidate parameter set is calculated. When the diversity measure of the parameter set (defined as 1 minus the average cosine similarity) is lower than a preset threshold of 0.6, a diversity enhancement operation is triggered: the best-performing one-third of the parameter vectors are retained, and the remaining vectors are regenerated through random perturbation or cross-combination in the parameter space, ensuring that the search covers different regions of the parameter space.

[0063] Parameter selection employs a regularization evaluation criterion, adding a model complexity penalty term to the performance score to avoid overfitting caused by excessively complex parameter configurations. The parameter configuration with the optimal overall score is ultimately selected as the optimization result, and a smooth transition strategy is used to gradually update the model in the production environment, ensuring the continuity of the prediction service.

[0064] This invention innovatively introduces an improved RIME (Regularized Iterative Multiple Estimation) algorithm based on covariance learning and diversity enhancement for parameter optimization. The algorithm first uses Latin hypercube sampling to uniformly generate an initial set of diverse parameters in the parameter space, ensuring a comprehensive exploration of the parameter space. The core idea of ​​Latin hypercube sampling is to divide the range of each parameter into N equal intervals, then randomly select a point within each interval, and randomly combine sampling points of different parameters, guaranteeing uniform distribution and diversity of the samples.

[0065] The algorithm then constructs a parameter performance mapping matrix, recording the model's predictive performance under each parameter configuration. It calculates the covariance matrix of this matrix and performs eigenvalue decomposition to obtain the main directions of change, constructing a dimensionality-reduced projection matrix. The purpose of this step is to identify the most important dimensions in the parameter space, simplifying subsequent optimization searches.

[0066] To ensure diversity in parameter exploration, the algorithm calculates the similarity of each pair of parameter vectors in the parameter set and constructs a diversity metric function to evaluate the overall diversity of the parameter set. When the diversity metric falls below a preset threshold, diversity enhancement processing is triggered, which increases the diversity of the parameter set by perturbing existing parameters or introducing new random parameters, thus preventing the search process from getting trapped in local optima.

[0067] Finally, guided by the dimensionality reduction projection matrix, the algorithm employs a regularized iterative multi-point estimation strategy to collaboratively optimize the parameters of multiple models. This strategy selects multiple promising parameter points for evaluation in each iteration, updates the search direction and step size based on the evaluation results, and applies regularization techniques to prevent overfitting. The final output is a parameter configuration that performs well across multiple scenarios.

[0068] Feedback loop execution is the process of applying the optimization results to the prediction system, employing a multi-timescale update strategy: short-cycle feedback is executed once an hour, mainly updating the model fusion weights to quickly respond to changes in traffic patterns; medium-cycle feedback is executed once a day, using 24-hour accumulated error data to fine-tune key model parameters, such as the learning rate of LSTM and the seasonal intensity of Prophet; long-cycle feedback is executed once a week or month, comprehensively updating model parameters based on the results of parameter optimization algorithms, and may even adjust the model structure.

[0069] This multi-layered closed-loop optimization ensures that the system can adapt to traffic changes at different time scales: quickly responding to sudden traffic fluctuations in the short term, adjusting the understanding of seasonal patterns in the medium term, and continuously improving overall predictive capabilities in the long term. Simultaneously, the system saves historical model configurations, allowing for rapid rollback when new configurations underperform, ensuring the continued reliable operation of the prediction system.

[0070] Through the coordinated efforts of the four key steps described above, this invention achieves dynamic API rate limiting based on multimodal traffic prediction, effectively overcoming the technical limitations of traditional static rate limiting. The system can accurately predict future traffic, implement differentiated rate limiting strategies based on customer value, and continuously optimize the prediction model through closed-loop feedback, providing strong technical support for the stability and quality of API services.

[0071] In this embodiment, historical traffic data, business characteristic data, and external event data of API calls are collected through an API gateway monitoring system, business system logs, and an external event management system. This includes: collecting API call QPS, request response time, and request success rate through the API gateway monitoring system, with a sampling granularity of 10 seconds, to obtain the historical traffic data; collecting API interface type, interface call frequency, and associated business links through the business system logs to obtain the business characteristic data; and collecting promotional activity schedules affecting API call volume, holiday markers affecting API access patterns, and system operation and maintenance events affecting API service availability from the business operation system, calendar service system, and system monitoring platform through the external event management system to obtain the external event data.

[0072] Multi-source data collection is a fundamental aspect of this invention, employing three core systems to gather comprehensive traffic-related data. The API gateway monitoring system, serving as the pathway for all API requests, accurately records detailed information for each API call. Call QPS (Queries Per Second) directly reflects the system's load; request response time (RTG) is the time interval between receiving a request and receiving a response, a key metric for API performance; and request success rate (RPR) is the proportion of successfully processed requests out of total requests, reflecting service reliability. These three metrics collectively constitute the core dimensions of historical traffic data. High-precision 10-second sampling ensures sensitivity to short-term fluctuations while providing sufficiently detailed time-series characteristics for subsequent models.

[0073] Business system logs are a crucial source for understanding the business context of API calls. By structured parsing of these logs, various business-dimensional characteristics can be extracted. Interface type categorizes API functions, such as user interfaces, order interfaces, and payment interfaces; different types of interfaces typically exhibit different traffic patterns. Interface call frequency records the number of times each interface is called within a specific time period, reflecting business activity. Related business chains describe the position and relationship of API calls within the complete business process, such as the "product search → add to cart → place order → payment" chain in an e-commerce scenario. This information helps in understanding and predicting the traffic correlation between different stages of the business process.

[0074] The external event management system integrates multiple external data sources, collecting information on various events that may affect API traffic. The business operations system provides a detailed schedule of promotional activities, recording the type, start and end times, and scope of impact of these activities, which typically lead to a significant increase in traffic. The calendar service system provides holiday markers, including weekends, public holidays, and special dates (such as Chinese New Year and National Day), with different types of dates often exhibiting different traffic patterns. The system monitoring platform records system maintenance events, including server maintenance, system upgrades, and network adjustments—technical activities that may affect service availability and can cause abnormal traffic fluctuations. Integrating these three types of external event data provides crucial environmental and contextual information for traffic prediction, particularly essential for understanding and predicting unconventional traffic changes.

[0075] During data acquisition, this invention employs multiple technologies to ensure data integrity and accuracy. For API gateway monitoring data, distributed log collection and real-time stream processing technologies are used to guarantee data acquisition stability under high concurrency scenarios. For business system logs, structured log parsing and semantic extraction technologies are used to accurately extract the required features from semi-structured or unstructured logs. For external event data, event synchronization and data integration technologies are employed to ensure the temporal consistency and integrity of event information across different systems. These technical measures collectively guarantee the quality of multi-source data acquisition, laying a solid foundation for subsequent data processing and model training.

[0076] In this embodiment, the historical traffic data, business feature data, and external event data undergo linear interpolation imputation for missing values, outlier filtering, and binary feature conversion of event data. Further, continuous data normalization, one-hot encoding of categorized data, and time feature construction are performed to obtain a standardized multimodal dataset. This includes: using linear interpolation to imput missing values ​​in the historical traffic data, business feature data, and external event data; using the 3σ criterion to identify and remove outliers; and using a sliding window averaging method to smooth out abnormal data caused by network fluctuations, resulting in a clean dataset. Based on the clean dataset, the promotional activity schedules, holiday markers, and system maintenance events in the external event data are converted into binary marker features. Continuous data is then normalized. Based on the QPS, response time, success rate from the historical traffic data and the interface call frequency from the business feature data, one-hot encoding is performed on the categorized data, which includes the interface types from the business feature data. Time features are constructed based on the 10-second granular sampling timestamps from the clean dataset. The binary marker features, normalized continuous data, one-hot encoded categorized data, and time features are combined to obtain characteristic data. Based on the characteristic data, time series samples for the LSTM model, a timestamp structured data table for the Prophet model, and a feature matrix for the XGBoost model are constructed respectively. Based on the time series samples, the timestamp structured data table, and the feature matrix, the standardized multimodal dataset is obtained.

[0077] Data preprocessing is a crucial step in transforming raw data into high-quality modeling data, encompassing three main stages: data cleaning, feature transformation, and format reconstruction. First, the data cleaning stage addresses data quality issues, primarily including missing value imputation, outlier handling, and data smoothing. Missing values ​​are a common problem during data acquisition, potentially caused by sensor malfunctions, network interruptions, or storage errors. This invention employs a linear interpolation imputation method to handle missing values. Its basic principle is to establish a linear relationship between two known data points for interpolation. Specifically, for a missing value at time point t, the nearest non-missing value time points t1 and t2 are found, and then imputed using the formula v(t) = v(t1) + (t - t2). The interpolation is calculated using (v(t2) - v(t1)) / (t2 - t1). This method is particularly suitable for handling missing data in time series because it preserves the temporal continuity and trend of the data.

[0078] Outliers are data points that significantly deviate from the normal data distribution, possibly caused by system failures, network attacks, or extreme events. This invention uses the 3σ criterion from statistics to identify outliers. This criterion is based on the characteristics of a normal distribution and considers data points falling within the mean ± 3 standard deviations to have a 99.73% probability; data points outside this range are considered outliers. In practice, the mean μ and standard deviation σ of the dataset are first calculated, and then data points satisfying the condition |x - μ| > 3σ are identified as outliers. For identified outliers, this invention employs three processing strategies: if the outlier is an isolated point and the surrounding data is normal, the mean of neighboring points is used as a replacement; if the outlier appears within a continuous time period, historical data from the same period is used as a replacement; if the outlier represents a real special event (such as a surge in traffic due to a promotional activity), it is retained and an event tag is added.

[0079] Data jitter caused by network fluctuations is a common interference factor in time series data analysis. This invention employs a sliding window averaging method for smoothing. This method slides a fixed-size window (e.g., 5 minutes) along the time axis, replacing the original value at the window's center point with the average value of the data points within the window. The choice of sliding window size needs to strike a balance between preserving data trends and filtering noise; a window that is too small may not effectively remove noise, while a window that is too large may mask important short-term changes. After missing value imputation, outlier handling, and data smoothing, the original data is transformed into a cleaner, more continuous, and reliable dataset, laying the foundation for subsequent feature engineering.

[0080] The feature transformation stage converts clean data into a feature form that can be effectively utilized by machine learning models. For external event data, a binary label transformation is used to map event information such as promotional activity schedules, holiday markers, and system maintenance events into binary features, where "1" indicates that an event has occurred and "0" indicates that no event has occurred. This transformation simplifies the representation of events while preserving the event's temporal information. For continuous data, such as QPS, response time, success rate, and API call frequency, normalization processing is required. This invention uses the min-max normalization method to map the original value x to the [0,1] interval, i.e., x... norm = (x - x min ) / (x max - x min This normalization ensures that features of different dimensions have the same weight during model training, preventing certain features from dominating the model learning process due to their large values.

[0081] For categorized data such as API types, this invention employs one-hot encoding to convert categorical variables into binary feature vectors. For example, if API interface types include "user," "order," and "payment," they can be encoded into three binary features: [1,0,0] (user interface), [0,1,0] (order interface), and [0,0,1] (payment interface). Time feature construction is based on 10-second sampling timestamps, extracting multiple time dimensions, including hour (0-23), day of the week (1-7), month (1-12), season (1-4), weekday (0 / 1), and beginning / middle / end of month (0 / 1). These time features can capture periodic traffic patterns, such as the difference between weekdays and weekends, and traffic fluctuations at different times of the day.

[0082] The processed binary tag features, normalized continuous data, one-hot encoded categorical data, and constructed temporal features are combined to form complete feature data. This feature data comprehensively describes the various dimensions of API calls, providing rich information input for different models.

[0083] In the format reconstruction stage, for different prediction models, the feature data is transformed into a data structure suitable for their respective input requirements. For LSTM models, time-series samples are constructed. Typically, a sliding window method is used to organize the feature data within continuous time periods into a fixed-length sequence. The window size (e.g., 24 hours or 8640 10-second sampling points) determines the length of time dependencies the model can learn. For Prophet models, a structured data table containing timestamps, actual QPS, and event markers is constructed, with each row representing an observation at a given time point and its related event information. For XGBoost models, a feature matrix is ​​constructed, where rows represent samples (time points), and columns represent feature dimensions, including business features, time features, and historical traffic values.

[0084] Through the above data preprocessing, feature transformation and format reconstruction steps, the original multi-source data is transformed into a standardized multimodal dataset, providing high-quality, multi-perspective data input for subsequent multi-model traffic prediction, which greatly improves the learning efficiency and prediction accuracy of the prediction model.

[0085] Based on the standardized multimodal dataset, the LSTM model is used to extract features and capture dependencies from the time-series samples in the standardized multimodal dataset to obtain basic traffic prediction values. The Prophet model is used to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients. The XGBoost model is used to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset to obtain business weight coefficients. The basic traffic prediction values, traffic change coefficients, and business weight coefficients are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic prediction values ​​for future time windows.

[0086] In this embodiment, a basic traffic prediction value is obtained by extracting features and capturing dependencies from time-series samples in the standardized multimodal dataset using an LSTM model. This includes: constructing a two-layer stacked LSTM network architecture based on the time-series samples in the standardized multimodal dataset, where the first and second LSTM layers each have 64 LSTM units and a dropout rate of 0.2; adding a fully connected layer to the output layer of the two-layer stacked LSTM network architecture; inputting the time-series samples into the two-layer stacked LSTM network architecture; and using the first LSTM layer to encode and extract the input time-series features to capture short-term temporal dependencies. The hidden state output of the first LSTM layer is passed to the second LSTM layer. The second LSTM layer further extracts long-term temporal dependencies and complex temporal patterns, resulting in a deep temporal feature representation with a dimension of 64. This deep temporal feature representation is then input into the fully connected layer. The fully connected layer performs a linear transformation to map the 64-dimensional features into a single numerical output, obtaining the original traffic prediction value. Based on the original traffic prediction value and pre-collected real traffic label data, the mean squared error loss function is calculated. The Adam optimizer is used to backpropagate and update the parameters of the two-layer stacked LSTM network architecture and the fully connected layer. After iterative training and convergence, the basic traffic prediction value is obtained.

[0087] LSTM (Long Short-Term Memory) is a specially designed variant of recurrent neural networks (RNNs) specifically designed to address the vanishing and exploding gradient problems faced by traditional RNNs when processing long-sequence data. LSTM effectively learns long-term dependencies by introducing memory cells and three gating mechanisms (input gate, forget gate, and output gate). In API traffic forecasting, LSTM models can capture complex patterns and long-term dependencies in time-series data, which is crucial for accurately predicting API traffic that exhibits periodicity, trends, and irregular fluctuations.

[0088] This invention employs a two-layer stacked LSTM network architecture. This multi-layer design enables the abstraction and extraction of temporal features layer by layer. The first LSTM layer contains 64 LSTM units, each with its own memory state and gating mechanism. The first layer is primarily responsible for the initial encoding and feature extraction of the input temporal features, effectively capturing short-term temporal dependencies, such as minute-level traffic fluctuation patterns. The input gate in the LSTM unit determines how much new information is allowed to be written to the memory unit; the forget gate controls how much information from the previous time step is retained in the memory unit; and the output gate determines how much information from the current memory unit is output. The coordinated operation of these three gates allows the LSTM to selectively remember important information and forget irrelevant information, thereby effectively learning patterns in temporal data.

[0089] The second layer also contains 64 LSTM units, receiving the hidden state output of the first LSTM layer as input. The role of the second LSTM layer is to further extract and abstract temporal features, capturing longer-term time dependencies and more complex temporal patterns, such as hourly or daily periodic changes. Stacking two LSTM layers enables the model to form hierarchical feature representations, with the lower layer capturing basic patterns and the higher layer capturing complex structures, significantly improving the model's ability to model complex temporal data.

[0090] Dropout is an important regularization technique used to prevent overfitting in neural networks. This invention sets a dropout rate of 0.2 between LSTM layers, meaning that during training, 20% of neuron connections are randomly deactivated each time parameters are updated. This random deactivation mechanism forces the network to learn more robust feature representations, reducing the model's dependence on specific neurons and effectively preventing overfitting. The principle behind dropout is that during forward propagation, the output of neurons is set to 0 with a certain probability (0.2 in this example), and during backpropagation, only the parameters of those neurons that were not deactivated are updated. During the prediction phase, all neurons are activated, but their outputs are scaled according to the dropout rate to maintain consistency with the expected values ​​of the outputs from the training phase.

[0091] Fully connected layers are standard components of neural networks, used to map features from the previous layer to the desired output dimension. In this invention, a fully connected layer is connected after a second LSTM layer, mapping a 64-dimensional deep temporal feature representation to a single numerical output, namely, a traffic prediction value. Each neuron in the fully connected layer is connected to all neurons in the previous layer, learning the complex relationship between features and the prediction target through weight parameters. The mathematical expression of a fully connected layer is y = Wx + b, where x is the input feature vector, W is the weight matrix, b is the bias vector, and y is the output vector. In this embodiment, x is a 64-dimensional LSTM feature vector, and y is a 1-dimensional traffic prediction value.

[0092] During model training, time-series samples are first fed into a two-layer stacked LSTM network. These time-series samples are constructed from standardized multimodal datasets using a sliding window method, containing a series of consecutive time points and their corresponding feature vectors. Each sample contains a certain length of historical data (e.g., data from the past 24 hours) to predict traffic values ​​at the next time point. Each time point in the sample includes traffic features such as API call QPS, response time, and success rate, as well as business features such as interface type and call frequency, along with time features and external event markers.

[0093] The first LSTM layer receives these time-series samples, processes the features at each time point, and captures short-term dependencies. The memory mechanism of the LSTM units allows them to "remember" important information in the sequence, such as traffic spikes and intraday peak patterns. The hidden state output of the first LSTM layer, containing the pre-processed time-series features, is passed to the second LSTM layer for deeper processing. The second LSTM layer, based on the output of the first layer, can discover more complex time-series patterns, such as traffic differences between weekdays and weekends, and traffic trends across different time periods. After processing by two LSTM layers, the original time-series data is transformed into a 64-dimensional deep time-series feature representation, which contains the key time-series information and dependencies from the original data.

[0094] The deep temporal feature representation is then fed into a fully connected layer, where a linear transformation maps the 64-dimensional features into a single numerical output—the raw traffic prediction value. This raw value represents a prediction of the average QPS within a future time window (e.g., the next 10 minutes) based on historical data. Prediction accuracy is measured by comparing it to actual traffic label data, using Mean Squared Error (MSE) as the loss function. MSE calculates the squared difference between the predicted and actual values, then averages the results; this effectively measures prediction accuracy and is more sensitive to larger errors.

[0095] The model is trained using the Adam optimizer for parameter updates. Adam (Adaptive Moment Estimation) is an adaptive learning rate optimization algorithm that combines the advantages of momentum and RMSProp, enabling it to adaptively adjust the learning rate for each parameter. The Adam algorithm maintains first-order moment estimates (exponential moving averages of the gradient) and second-order moment estimates (exponential moving averages of the squared gradients), dynamically adjusting the learning rate for each parameter based on these estimates. This adaptive characteristic makes Adam perform exceptionally well when handling sparse gradients and noisy data, making it highly suitable for the traffic prediction scenario in this invention.

[0096] Parameter updates are achieved through backpropagation, which first calculates the gradient of the loss function with respect to the output layer, then uses the chain rule to propagate the gradient backward layer by layer, finally calculating the gradient of each parameter and updating the parameters. For LSTM networks, backpropagation becomes more complex because it needs to consider time-dependent relationships; this special form of backpropagation is called "Backpropagation Through Time" (BPTT). BPTT unfolds the LSTM network in the time dimension and then applies the standard backpropagation algorithm, but this can lead to unstable gradients over long time series. To address this issue, truncated BPTT is typically used, propagating the gradient backward only for a fixed time step, balancing computational efficiency and the ability to learn long-term dependencies.

[0097] Model training is an iterative process. Each iteration processes a batch of samples (called a mini-batch), calculates the loss, and updates the parameters. Training continues until convergence conditions are met, such as the loss function no longer decreasing significantly or the preset number of iterations is reached. To monitor the training process and prevent overfitting, the dataset is typically divided into training and validation sets. The training set is used to update model parameters, and the validation set is used to evaluate the model's generalization ability. When performance on the validation set no longer improves or begins to decline, training can be stopped early; this technique is called early stopping.

[0098] After model training is complete, time-series samples are input into the trained LSTM network, and the output becomes the base traffic prediction value. This prediction value represents the traffic prediction benchmark based on historical time-series patterns and is an important component of multi-model fusion prediction. In subsequent steps, this base traffic prediction value will be combined with the traffic change coefficient of the Prophet model and the service weight coefficient of the XGBoost model to generate the final traffic prediction value.

[0099] In this embodiment, the basic traffic prediction value, traffic change coefficient, and service weight coefficient are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic prediction value for the future time window. This includes: applying maximum-minimum normalization to the basic traffic prediction value, mapping it to the [0,1] interval, to obtain Q. LSTMnorm The traffic change coefficient and service weight coefficient are standardized using Z-score to obtain the standardized value β of the traffic change coefficient. norm The standardized value γ of the business weight coefficient norm Based on the comparison between historical prediction data and actual traffic data, the fusion weights α for the LSTM model, Prophet model, and XGBoost model are determined through cross-validation and scenario-weighted adjustment. final βfinal γ final And ensure α final +β final +γ final =1; Calculate the normalized fusion value: Q_pred norm =α final ×Q LSTMnorm +β final ×β norm +γ final ×γ norm ; for the standardized fusion value Q_pred norm Perform inverse normalization to obtain the traffic prediction value Q_pred for the future time window.

[0100] Multi-model fusion is a method that comprehensively utilizes the advantages of different models to improve overall prediction accuracy; it is also known as ensemble learning. In this invention, three different types of models—LSTM, Prophet, and XGBoost—are fused to capture temporal dependencies, temporal decomposition patterns, and business feature associations, respectively. To effectively fuse the outputs of these models, standardization is first required to transform outputs of different scales and distributions to the same standard, making them comparable during fusion.

[0101] Min-Max Normalization (MMR) is a commonly used linear transformation method that maps the original values ​​to the interval [0,1], preserving the original data distribution shape. Its calculation formula is: x norm = (x - min) / (max - min), where x is the original value, and min and max are the minimum and maximum values ​​in the dataset, respectively. This invention uses max-min normalization to convert the basic traffic prediction values ​​output by the LSTM model into Q... LSTMnorm The advantage of min-max normalization is its simplicity and intuitiveness, which preserves the relative relationships of the original data and is suitable for situations where the data distribution is relatively uniform and the range is known. The disadvantage is that it is sensitive to outliers and may cause most normal values ​​to be compressed into a very small range.

[0102] Z-score standardization (also known as standardization or standardized score transformation) transforms raw data into a standard normal distribution with a mean of 0 and a standard deviation of 1. Its calculation formula is: x norm = (x - μ) / σ, where x is the original value, μ is the mean of the dataset, and σ is the standard deviation of the dataset. This invention performs Z-score standardization on the traffic change coefficient output by the Prophet model and the business weight coefficient output by the XGBoost model to obtain β. norm and γ normThe advantages of Z-score standardization are that it considers the distribution of data, allowing data from different distributions to be compared on the same scale; it is less sensitive to outliers than max-min normalization; and it is suitable for situations where the exact range of the data is unknown or outliers exist. Its disadvantage is that the transformed value is not limited to a specific interval and can theoretically be any real number, requiring additional processing in some applications that require value range constraints.

[0103] Determining the fusion weights is a core step in multi-model fusion, directly impacting the accuracy of the final prediction. This invention employs a dynamic weight allocation strategy based on historical performance, assigning appropriate fusion weights to each model by analyzing its historical prediction performance. Cross-validation is a statistical method for evaluating model performance. It involves dividing the data into multiple subsets, using one subset as the validation set and the remainder as the training set, evaluating model performance multiple times, and then taking the average as the final performance metric. In this embodiment, cross-validation is used to evaluate the prediction accuracy of the three models on historical data, assigning initial weights to each model.

[0104] Scenario-weighted adjustment is one of the innovations of this invention. Based on the performance differences of each model under different traffic scenarios, the fusion weights are dynamically adjusted. Traffic scenarios can be divided into various types, such as daily stable scenarios, promotional activity scenarios, low-peak stable scenarios, and sudden peak scenarios. The system records the prediction errors of each model under different scenarios and generates a scenario-model performance matrix. When the system detects that the current traffic pattern belongs to a specific scenario, it refers to the historical performance of each model under that scenario and adjusts the fusion weights, increasing the weight of better-performing models and decreasing the weight of poorer-performing models. For example, in a promotional activity scenario, if historical data shows that the Prophet model's predictions are more accurate, its weight β is increased. final During periods of stable flow, if the LSTM model performs better, its weight α is increased. final .

[0105] Once the weights are determined, the system will ensure α final +β final +γ final =1, meaning the sum of the three weights is 1, which is to maintain the scale consistency of the fusion result. This normalization process also makes the weights more interpretable, and can be understood as the proportion of each model's contribution to the final prediction.

[0106] The standardized fusion value is calculated by weighting and summing the outputs of the three standardized models according to a defined weight. The formula is: Q_pred norm = α final ×Q LSTMnorm + β final ×β norm + γ final ×γnorm This linear weighted fusion method is simple, effective, computationally inexpensive, and easy to interpret and implement. The advantage of weighted fusion lies in its ability to combine the strengths of each model, offsetting the weaknesses of a single model, and improving the stability and accuracy of predictions, especially when dealing with complex and variable traffic patterns.

[0107] Finally, the standardized fusion value Q_pred needs to be... norm Converting back to actual flow values ​​involves inverse normalization. Inverse normalization is the inverse operation of normalization, mapping values ​​in the [0,1] interval back to the original scale. The formula is: Q_pred = Q_pred norm × (max - min) + min, where max and min are the maximum and minimum values ​​of the original traffic data. After inverse normalization, the system output Q_pred is the predicted QPS value within the future time window (e.g., the next 10 minutes), which is directly used for subsequent traffic limiting quota allocation.

[0108] In this embodiment, the normalized fusion value Q_pred is calculated. norm Then, regarding the Q_pred norm Before performing inverse normalization, the method further includes a step of fusion optimization using a multi-covariance learning operator: based on the Q... LSTMnorm β norm γ norm A 3×3 covariance matrix is ​​constructed, where the eigenelements of the covariance matrix are the covariances between standardized values. The angles of each eigenele are calculated to quantify the correlation angles between them, and a feature coupling graph is constructed based on these correlation angles. Based on the feature coupling graph, a Mahalanobis distance metric is constructed using the covariance matrix Σ, and the adaptive covariance weights are calculated by substituting the Mahalanobis distance metric into the adaptive covariance weights calculation formula. Based on the adaptive covariance weights, a covariance-enhanced fusion objective function is constructed. Based on the fusion objective function, the optimal fusion prediction value Q_pred_cov is solved using the conjugate gradient method, and Q_pred_cov is used as the final standardized fusion value for subsequent inverse normalization operations.

[0109] The multi-covariance learning operator is one of the core innovations of this invention. It is used to optimize the simple linear weighted fusion method, achieving more refined and accurate fusion by considering the covariance structure between model outputs. Traditional linear weighted fusion methods assume that the outputs of each model are independent, ignoring the possible correlations and interactions between them. However, in practical applications, the outputs of different models often exhibit correlations. Reasonably utilizing this correlation information can significantly improve the fusion effect.

[0110] The covariance matrix is ​​a matrix that describes the degree of linear correlation among multiple random variables, where the diagonal elements are the variances of each variable, and the off-diagonal elements are the covariances between two variables. In this embodiment, Q is output based on three standardized models. LSTMnorm β norm and γ norm Construct a 3×3 covariance matrix Σ. The calculation of the covariance matrix is ​​usually based on historical data, recording the changes of these three values ​​in historical predictions, and then calculating the covariance between them.

[0111] Specifically, the elements σ of the covariance matrix Σ ij σ represents the covariance between the output of the i-th model and the output of the j-th model. For the case i=j, σ ii σ represents the variance of the i-th model output, measuring its degree of fluctuation; for the case i≠j, σ ij This represents the covariance between the outputs of the i-th and j-th models. Positive values ​​indicate positive correlation (an increase in one model leads to an increase in the other), negative values ​​indicate negative correlation (an increase in one model leads to a decrease in the other), and zero values ​​indicate no correlation. By analyzing the covariance matrix, we can gain a deeper understanding of the relationships between the outputs of each model, providing a basis for more accurate fusion.

[0112] The angle between feature elements is a geometric concept that measures the difference in direction between two vectors, and can be calculated using the inner product and magnitude of the vectors. In this embodiment, the angle is used to quantify the direction and strength of the correlation between different model outputs. Specifically, the calculation method treats each model output as a vector in a multi-dimensional space and calculates the angle between the vectors. For example, Q... LSTMnorm and β norm The angle θ between them can be calculated using their inner product and modulus. An angle θ close to 0 degrees indicates a highly positive correlation, close to 180 degrees indicates a highly negative correlation, and close to 90 degrees indicates almost no correlation.

[0113] Based on computational perspectives, a feature coupling graph is constructed. This graph structure visualizes the relationships between different model outputs, where nodes represent model outputs and edges represent the strength of their correlation. The feature coupling graph helps to intuitively understand the interaction patterns between model outputs and identify strongly correlated model groups and independent model groups. This graph structure not only aids in understanding the relationships between models but also provides a topological foundation for subsequent adaptive weight calculations.

[0114] Mahalanobis distance is a distance metric that considers the covariance structure of data and can calculate a "standardized" distance that takes into account the correlation between variables. Compared to Euclidean distance, Mahalanobis distance has the advantage of considering the correlation between features, assigning smaller weights to combinations of highly correlated features, thereby avoiding double counting of information. In this embodiment, a Mahalanobis distance metric is constructed using the covariance matrix Σ to measure the "distance" between the combination of model outputs and the ideal prediction.

[0115] Based on Mahalanobis distance, the covariance adaptive weights are calculated using the formula. These weights take into account the covariance structure between model outputs, automatically reducing the weight proportion of highly correlated models and increasing the weight proportion of models rich in independent information. This avoids information redundancy and redundant calculations, achieving more efficient information utilization. For example, if the outputs of LSTM and Prophet models are highly correlated, while the XGBoost model provides independent information, the covariance adaptive weights will correspondingly reduce the weights of LSTM and Prophet and increase the weight of XGBoost, making the fusion more effective.

[0116] The covariance-enhanced fusion objective function is an optimization objective that considers the covariance structure, typically including a prediction error minimization term and a covariance regularization term. The prediction error minimization term ensures that the fusion result is as close as possible to the true value, while the covariance regularization term encourages the use of correlation information between models to achieve more effective fusion. This objective function design upgrades the fusion process from a simple linear combination to an optimization problem that considers the complex interactions between models, enabling a more comprehensive exploitation of the complementary advantages of each model.

[0117] The conjugate gradient method is an iterative algorithm for solving linear equations, and it is more efficient than the standard gradient descent method when solving large-scale optimization problems. Its core idea is that in each iteration, not only the current gradient direction is considered, but also the conjugate direction of the previous step, making the search directions conjugate (or orthogonal) and accelerating the convergence process. In this embodiment, the conjugate gradient method is applied to solve the covariance-enhanced fusion objective function to find the optimal fusion prediction value Q_pred_cov.

[0118] The implementation of the conjugate gradient method includes the following steps: First, initialize the fusion weights and residuals; then, calculate the initial search direction; next, iteratively perform the following operations until convergence: calculate the optimal step size, update the fusion weights, calculate the new residuals, determine the conjugate coefficients, and update the search direction. This algorithm typically converges to a high-precision solution within a relatively small number of iterations, making it particularly suitable for the optimization problem in this embodiment.

[0119] The Q_pred_cov obtained after optimization using the multi-covariance learning operator is used as the final standardized fusion value for subsequent inverse normalization operations. This optimization method significantly improves the accuracy of fusion prediction, especially when facing complex traffic patterns and highly correlated outputs of multiple models. It can more effectively integrate the advantages of each model, offset the limitations of a single model, and generate more accurate and stable traffic prediction results.

[0120] Experimental results show that, compared with simple linear weighted fusion, multi-covariance learning operator fusion can reduce prediction error by 15%-25%, especially performing better during periods of traffic surges and in complex business scenarios. This high-precision traffic prediction provides a reliable foundation for subsequent customer priority rate limiting, ensuring that the system can maintain stable operation and high-quality service under various traffic conditions.

[0121] In this embodiment, a covariance-enhanced fusion objective function is constructed. Based on the fusion objective function, the optimal fusion prediction value Q_pred_cov is solved using the conjugate gradient method. The method also includes calculating the Frobenius norm difference Δ between the current covariance matrix and the historical covariance matrix. F The historical covariance matrix is ​​the covariance matrix of the previous time step within the sliding window; when the Δ F When the preset threshold is exceeded, the covariance adaptive weights are recalculated; a new covariance structure is constructed based on the recalculated covariance adaptive weights, and the new covariance structure is fed back into the LSTM model, Prophet model and XGBoost model to dynamically adjust the fusion weights and internal parameters of each model.

[0122] Dynamic covariance structure adjustment is a key innovation of this invention, used to monitor and respond to changes in model output relationships in real time, ensuring that the fusion process remains optimal. In real-world applications, API traffic patterns frequently change, leading to variations in the performance and interrelationships of different prediction models. Static fusion methods cannot adapt to such dynamic changes, while the dynamic covariance adjustment mechanism introduced in this embodiment continuously evaluates and updates the covariance structure between models, maintaining fusion efficiency.

[0123] The Frobenius norm is a type of matrix norm used to measure the difference between two matrices. It is calculated by taking the square root of the sum of the squares of all elements in the matrix, i.e., the Frobenius norm ||A|| of matrix A. F = (∑ i,j |a i,j |²). In this embodiment, the Frobenius norm is used to quantify the degree of difference between the current covariance matrix and the historical covariance matrix, i.e., Δ. F = ‖Σ current - Σhistory || F , where Σ current It is the covariance matrix calculated at the current time, Σ history It is the covariance matrix of the previous time step within the sliding window.

[0124] The sliding window is a commonly used time series processing technique. By moving a fixed-size window along the time axis, it focuses only on the data within the window, thus capturing local temporal characteristics. In this invention, the sliding window is used to maintain and update the covariance matrix. The window size is typically set to a certain time span (e.g., 30 minutes or 1 hour) to ensure that the covariance calculation reflects the latest model relationships while maintaining a certain degree of stability, avoiding excessive influence from short-term fluctuations.

[0125] Frobenius norm difference Δ F Exceeding a preset threshold triggers a recalculation of the covariance structure, indicating a significant change in the model's output relationship and necessitating an update to the fusion weights. The preset threshold is a system parameter, typically determined based on historical data analysis. It must be sensitive enough to capture significant changes, but not so sensitive as to trigger frequent recalculations, increasing the computational burden. A reasonable threshold setting strategy is to use percentage changes; for example, when Δ... F Recalculation is triggered when the value exceeds 15% of the Frobenius norm of the historical covariance matrix.

[0126] The recalculation of covariance adaptive weights is based on the latest covariance matrix, using the aforementioned method to recalculate the fusion weights. Compared to the initial calculation, the recalculation process is more efficient because the system already has the computational pipeline and parameter settings. The core of the recalculation is to generate a new weight configuration that reflects the current model relationships based on the updated Mahalanobis distance metric. This real-time update ensures that the fusion weights keep pace with changes in model relationships, maintaining the accuracy of the fusion predictions.

[0127] The novel covariance structure is not only used to update the fusion weights but also fed back into each prediction model to adjust their internal parameters and training strategies. This feedback mechanism is a major innovation of this invention, enabling bidirectional information flow from the fusion layer to the prediction models, thus forming a closed-loop optimization structure for the entire prediction system. For example, when the covariance structure shows increased correlation between the LSTM model and other models, the system may increase the dropout rate of the LSTM model to reduce the risk of overfitting; when the unique information provided by the Prophet model increases, the system may improve its sensitivity to detecting trend change points, better capturing trend changes.

[0128] The implementation of covariance structure feedback involves several key steps: First, based on the new covariance matrix, the "unique information contribution" of each model is calculated, which is the amount of predictive information provided by this model that other models cannot provide; then, these unique information contributions are transformed into model-specific adjustment signals; finally, each model dynamically modifies its internal parameters or training strategy according to the received adjustment signals. For example, for an LSTM model, the learning rate, dropout rate, or attention mechanism weights may be adjusted; for a Prophet model, seasonality intensity or event impact parameters may be adjusted; and for an XGBoost model, regularization parameters or feature sampling rate may be adjusted.

[0129] This dynamic covariance adjustment mechanism delivers significant performance improvements. Experiments show that, compared to static fusion methods, dynamic covariance adjustment can reduce peak traffic prediction errors by 20%-30%, especially when traffic patterns change abruptly or new business scenarios emerge. Furthermore, this mechanism enhances the system's robustness and adaptability, enabling it to operate continuously and efficiently in changing business environments without frequent manual intervention or adjustments.

[0130] In this embodiment, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation are updated based on the error index using a model weight dynamic adjustment algorithm. Furthermore, the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated based on long-term accumulated error data using a parameter optimization algorithm. This includes: periodically comparing the predicted traffic value with real-time collected actual traffic data, and calculating the RMSE error index based on the root mean square error (RMSE); calculating the prediction errors of the LSTM model, Prophet model, and XGBoost model in each scenario, and adjusting the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation according to the error magnitude; and periodically optimizing the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model based on long-term accumulated error data. The error data includes the RMSE error index recorded in a time series, the corresponding scenario marker that generated the error, and timestamp information.

[0131] Dynamic model weight adjustment is a mechanism based on real-time performance evaluation and adaptively updates the model fusion weights. It is a key element of this invention in maintaining the high accuracy of the prediction system. In the field of API traffic prediction, different models perform differently under different traffic patterns, and static fixed weights cannot adapt to such changes. The dynamic weight adjustment method in this embodiment can dynamically allocate fusion weights according to the real-time performance of each model, ensuring that the prediction system always adopts the optimal model combination strategy.

[0132] RMSE (Root Mean Square Error) is a commonly used metric for evaluating the performance of prediction models. It is calculated by taking the square root of the mean of the squares of the differences between predicted and actual values. RMSE is more sensitive to larger errors and effectively reflects abnormal deviations in predictions, making it particularly suitable for API traffic prediction scenarios, where large deviations can lead to system overload or resource waste. In this embodiment, the system calculates the RMSE between predicted and actual traffic periodically (typically every 5 minutes) as the primary evaluation metric for model performance.

[0133] The RMSE calculation process includes the following steps: First, collect the predicted and actual flow rates within the same time window; then, calculate the prediction error (predicted value minus actual value) for each time point; next, square each error value to eliminate the offsetting effect of positive and negative values; subsequently, calculate the average of these squared errors; finally, take the square root of the average to obtain the RMSE value. For example, if the system predicts an average QPS of 5000 for the next 10 minutes, while the actual measured average QPS is 5500, then the prediction error is -500, which squares to 250000. If there is only this one time point, the RMSE is 500.

[0134] In addition to the overall RMSE, the system also calculates the independent prediction RMSE of the three base models (LSTM, Prophet, and XGBoost) without fusion. These metrics are used to evaluate the individual performance of each model and provide a basis for weight adjustment. To more comprehensively evaluate model performance, the system also records RMSE under various traffic scenarios, such as daily stable scenarios, promotional activity scenarios, peak traffic scenarios, and low-traffic stable scenarios. Through scenario segmentation, the system can more accurately understand the predictive ability of each model under specific conditions and achieve more refined weight adjustment.

[0135] The model weight dynamic adjustment algorithm is based on the "inverse error weighting" principle, meaning that models with smaller prediction errors receive higher fusion weights. In its implementation, the system first detects which predefined scenario the current traffic pattern belongs to, and then extracts the historical RMSE of each model within that scenario. Based on these RMSE values, the initial weights are calculated: initial weight i = (1 / RMSEi) / ∑j(1 / RMSEj), where i and j represent different models. For example, if the RMSEs of LSTM, Prophet, and XGBoost are 100, 150, and 200 respectively, their initial weight ratio is (1 / 100):(1 / 150):(1 / 200) = 0.01:0.0067:0.005, which, after normalization, becomes 0.46:0.31:0.23.

[0136] To avoid drastic fluctuations in weights, the system employs a smooth update strategy: New weight = (1-μ) × Old weight + μ × Initial weight, where μ is a smoothing factor that controls the speed of weight updates, typically set between 0.1 and 0.3. A smaller μ value means smoother weight changes, which is beneficial for system stability; a larger μ value allows the system to adapt to changing traffic patterns more quickly, improving response speed. In practical applications, the μ value can be dynamically adjusted according to the rate of traffic change; for example, a smaller μ value can be used during periods of stable traffic, while a larger μ value can be used during periods of sudden traffic changes.

[0137] The accumulated error data over a long period is a continuous record of prediction errors by the system, including RMSE values, corresponding scene markers, and timestamp information. This data forms a time-series database, which is an important basis for optimizing model parameters. By analyzing long-term error data, the system can identify the optimal configuration of model parameters under various traffic patterns and optimize the model structure accordingly. To ensure the representativeness and timeliness of the data, the system typically retains error data from the most recent period (e.g., 3 months) and gives higher weight to recent data.

[0138] Model parameter optimization is a process of periodically adjusting the internal structure and parameters of each prediction model based on long-term error data. For LSTM models, the main parameters optimized include the number of network layers and the number of neurons per layer. The number of network layers determines the depth of the model; deeper networks can learn more complex features and temporal dependencies, but also increase the risk of overfitting and computational complexity. The number of neurons determines the width of a single network layer; more neurons provide stronger expressive power, but also increase the risk of overfitting. In this embodiment, the system will try different configurations of the number of layers (1-3 layers) and the number of neurons (32-128), evaluate performance based on historical error data, and select the optimal configuration.

[0139] For the Prophet model, a key optimization parameter is the trend change detection frequency. A change point is the location in a time series where the trend changes significantly; accurately detecting these points is crucial for capturing turning points in traffic trends. The trend change detection frequency controls the model's sensitivity to trend changes; too high a frequency leads to overfitting to noise, while too low a frequency misses important trend changes. The system adjusts this parameter to its optimal value by analyzing actual trend changes in historical data, typically between 1 / 4 and 1 / 2 of the business cycle. For example, if API traffic exhibits a clear weekly pattern, the change point detection frequency might be set to once every 3-4 days.

[0140] For the XGBoost model, the main parameters to optimize are the depth and number of trees. Tree depth determines the complexity of a single decision tree; deeper trees can capture more complex feature interactions, but also increase the risk of overfitting. The number of trees determines the overall complexity and learning ability of the model; more trees generally provide better predictive performance, but also increase computational cost and the risk of overfitting. The system will try different depth (3-10 layers) and number (50-500 trees) configurations, evaluate performance based on cross-validation, and select the optimal balance.

[0141] The parameter optimization process employs automated hyperparameter search methods, such as Bayesian optimization, random search, or grid search. Bayesian optimization is particularly suitable for computationally expensive parameter optimization scenarios because it can intelligently select the next parameter configuration to be evaluated based on the performance of already evaluated points, reducing unnecessary trials. During the optimization process, the system maintains a parameter-performance mapping table, recording the model's performance under each parameter configuration in various scenarios, and ultimately selects the parameter configuration with the best overall performance.

[0142] Parameter optimization typically involves long execution cycles, such as weekly or monthly, because this type of optimization is computationally expensive and the optimal model structure does not change frequently. After optimization, the system smoothly transitions to the new parameter configuration to avoid predictive instability caused by sudden changes in model structure. This smooth transition is usually achieved through model fusion, which involves running models with both old and new parameters simultaneously for a period of time, gradually increasing the weight of the new model until it completely replaces the old model.

[0143] Dynamic adjustment of model weights and parameter optimization form two optimization loops with different time scales: the weight adjustment loop is fast-responding and frequent (minute to hourly), ensuring that the system can quickly adapt to short-term traffic changes; the parameter optimization loop is slow-responding and infrequent (weekly to monthly), ensuring that the system can optimize the model structure according to long-term traffic patterns. These two loops work together to enable the prediction system to maintain optimal performance across various time scales.

[0144] In this embodiment, based on long-term accumulated error data, the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model are periodically optimized. The error data includes RMSE error metrics recorded in time series, the corresponding scene markers that generated the error, and timestamp information. This includes: constructing a diverse parameter set containing multiple candidate parameter vectors based on the parameters of the LSTM model, the Prophet model, and the XGBoost model; generating an initial diverse parameter set using Latin hypercube sampling; the parameters of the LSTM model include the number of network layers and neurons; the parameters of the Prophet model include the trend change point detection frequency; and the XGBoost model... The parameters include the depth and number of trees; based on the initial diversity parameter set, a parameter performance mapping matrix is ​​constructed, the covariance matrix of the mapping matrix is ​​calculated, the covariance matrix is ​​decomposed into features, and a dimension-reduced projection matrix is ​​constructed; using the dimension-reduced projection matrix and the diversity parameter set, the similarity of each pair of parameter vectors in the diversity parameter set is calculated, a diversity metric function is constructed, and a diversity metric is calculated. When the diversity metric is lower than a preset metric threshold, the parameter set is subjected to diversity enhancement processing; based on the parameter set after diversity enhancement processing and the dimension-reduced projection matrix, an objective function is constructed. Using the objective function as the optimization benchmark, the search direction is guided by the dimension-reduced projection matrix, and the parameters of multiple models are collaboratively optimized through a regularized iterative multi-point estimation strategy, outputting the optimized parameter configuration.

[0145] Parameter optimization is a crucial step in continuously improving model performance. This embodiment employs an innovative multi-model collaborative parameter optimization method, which not only optimizes the parameters of each model independently but also considers the mutual influence between models, achieving a globally optimal parameter configuration. This method is particularly suitable for multi-model fusion prediction systems, as it can uncover parameter synergy effects that cannot be detected by individual optimization.

[0146] A diverse parameter set is a collection containing multiple candidate parameter vectors, each representing a set of possible model parameter configurations. In this embodiment, the parameter vectors include three key parameters of the model: the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model. To effectively explore the high-dimensional parameter space, the system needs to construct an initial parameter set with sufficient coverage and diversity as the starting point for the optimization search.

[0147] Latin Hypercube Sampling (LHS) is an efficient experimental design method for generating uniformly distributed sampling points in a high-dimensional space. Its core idea is to divide the range of each parameter into N equal intervals, then randomly select a point within each interval, and randomly combine sampling points with different parameters to form N sample points. Compared to traditional grid sampling, LHS can cover the parameter space more uniformly with fewer sample points, improving sampling efficiency. In this embodiment, LHS is used to generate an initial diverse parameter set, typically containing 50-200 different parameter configurations, covering various possible parameter combinations.

[0148] The parameter performance mapping matrix is ​​a two-dimensional table that records the performance of each parameter configuration under different scenarios or evaluation metrics. The rows of the matrix represent different parameter configurations, the columns represent different evaluation scenarios or metrics, and the matrix elements are the performance scores of the corresponding parameters in the corresponding scenarios (e.g., the reciprocal of the predicted RMSE). This matrix comprehensively records the mapping relationship between the parameter space and the performance space, serving as the foundational data for subsequent optimization analysis. During the construction process, the system evaluates each parameter configuration, typically using cross-validation techniques to test its performance on historical data to ensure the reliability and representativeness of the evaluation results.

[0149] Covariance matrix calculation involves performing covariance analysis on the column vectors of the parameter performance mapping matrix to reveal the correlation between different scenarios or indicators. The element (i,j) of this matrix represents the degree of performance correlation between the i-th and j-th scenarios; a larger covariance indicates a stronger correlation, while a covariance close to zero indicates almost no correlation. By analyzing the covariance matrix, the system can identify which scenarios have similar parameter sensitivities and which scenarios have unique parameter requirements, providing a basis for subsequent dimensionality reduction and optimization.

[0150] Eigenvalue decomposition (EVD) is the process of decomposing the covariance matrix into eigenvalues ​​and eigenvectors to discover the main directions of variation in the data. In EVD, the eigenvectors corresponding to larger eigenvalues ​​represent dimensions that contain more information in the data. By retaining the eigenvectors corresponding to the larger eigenvalues, effective dimensionality reduction can be achieved while preserving most of the information in the data. In this embodiment, the system typically retains the top few eigenvectors that can explain 80%-90% of the total variance, forming the dimensionality-reduced projection matrix.

[0151] A dimension reduction projection matrix is ​​a matrix composed of selected eigenvectors used to project the original high-dimensional parameter space onto a lower-dimensional space, simplifying the optimization search process. The projected lower-dimensional space retains the most important directions of change in the original space, filtering out a large amount of noise and redundant information, enabling the optimization algorithm to search for the optimal solution more effectively. In practical applications, the system typically reduces the original parameter space (which may have 10-20 dimensions) to 3-5 dimensions, significantly reducing the complexity of the optimization while retaining sufficient information.

[0152] Parameter vector similarity calculation is a method for measuring the distance between different configurations within a parameter set, used to assess the diversity of the parameter set. In a reduced-dimensional space, the distance between two parameter vectors is typically calculated using cosine similarity or Euclidean distance. Cosine similarity measures the similarity between the directions of two vectors, while Euclidean distance measures the straight-line distance between two points in space. The system calculates the similarity between all parameter vector pairs, constructing a similarity matrix as the basis for diversity measurement.

[0153] A diversity measure is a mathematical function that comprehensively evaluates the coverage and uniformity of a parameter set. Commonly used diversity measures include average minimum distance, coverage volume ratio, and cluster distribution uniformity. Average minimum distance calculates the average distance from each parameter vector to its nearest neighbor; a larger value indicates greater dispersion among the points. Coverage volume ratio calculates the proportion of the parameter set's coverage volume in the parameter space relative to the total volume. Cluster distribution uniformity assesses whether the distribution of parameter points across different clusters is balanced. The system integrates these metrics to construct a weighted diversity measure function, comprehensively evaluating the parameter set's exploration capabilities.

[0154] Diversity enhancement is the process of increasing the diversity of a parameter set by adjusting or adding parameter vectors when the set lacks diversity. Common methods include: perturbing existing parameter vectors by adding random noise to generate new parameter configurations; adding new points in low-density regions to identify sparse areas in the parameter space and selectively increasing sampling points in these regions; and cross operations, which exchange some features of different parameter vectors to generate new combinations. Through these diversity enhancement operations, the system can construct a diverse parameter set that evenly covers the parameter space, laying the foundation for global optimization.

[0155] The objective function is the core function guiding parameter search, comprehensively considering prediction performance, model complexity, and diversity requirements. In this embodiment, the objective function typically includes three parts: a prediction performance term, which minimizes prediction error (e.g., RMSE); a regularization term, which controls model complexity and prevents overfitting; and a diversity reward term, which encourages the exploration of different parameter configurations. These three terms are combined into a unified objective function through weighted coefficients, and the system's task is to find parameter configurations that minimize (or maximize) this function.

[0156] Dimensionality reduction projection matrix-guided search direction is a technique that leverages data structure information to improve search efficiency. Traditional parameter search methods operate in the original high-dimensional space, easily getting trapped in local optima or wasting significant computational resources. This method, however, first identifies the main directions of change in the parameter space using a dimension reduction projection matrix, and then primarily searches along these directions, significantly improving efficiency. Specifically, the system generates search directions in the dimension reduction space and then maps them back to the original parameter space using the transpose of the projection matrix, guiding parameter updates.

[0157] Regularized Iterative Multiple Estimation (RIME) is a highly efficient global optimization algorithm, particularly suitable for parameter optimization of complex models. Unlike traditional single-point search methods, RIME maintains and updates multiple candidate solutions simultaneously, evaluating multiple potential parameter points in each iteration, significantly increasing the probability of finding the global optimum. The regularization mechanism controls the magnitude and direction of parameter changes by adding appropriate penalty terms, avoiding overfitting or unstable solutions. During iteration, the algorithm continuously adjusts its search strategy based on the evaluation results, such as narrowing or expanding the search range and changing the search step size, achieving adaptive parameter optimization.

[0158] The implementation of RIME includes the following steps: First, initialize a set of candidate parameter vectors, typically selecting the best individuals from a diverse parameter set; then, iteratively perform the following operations until convergence: generate multiple mutation vectors for each candidate vector, evaluate the objective function values ​​of these vectors, select the best few vectors as the next generation candidate set, and apply regularization constraints to prevent excessive parameter variations; finally, select the parameter vector with the optimal objective function value from the final candidate set as the output. The entire process typically sets a maximum number of iterations and convergence conditions to ensure the algorithm can complete within a reasonable timeframe.

[0159] The core innovation of this method lies in the collaborative optimization of parameters across multiple models. Instead of simply optimizing each model independently, it considers the interactions between models to find the overall optimal parameter combination. This collaborative optimization can uncover synergistic effects that cannot be detected by individual optimizations; for example, a certain LSTM configuration performs exceptionally well when combined with specific Prophet and XGBoost configurations. The key to achieving collaborative optimization is constructing a unified objective function that comprehensively considers the performance and complexity of multiple models, and then using the RIME algorithm to search for the optimal solution in the joint parameter space.

[0160] After the optimization process is complete, the system outputs the optimized parameter configuration, including key parameters such as the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model. These optimized parameters will be used to update the structure and configuration of each model, improving overall prediction performance. To ensure system stability, parameter updates typically employ a smooth transition strategy, such as gradually transitioning from old parameters to new parameters over a period of time, avoiding prediction instability caused by sudden parameter changes.

[0161] Through this complex and sophisticated parameter optimization method, this invention can maintain high prediction accuracy in a dynamic API traffic environment, adapting to constantly changing traffic patterns and business needs, and achieving a truly adaptive and self-optimizing prediction system. Experiments show that compared to traditional independent parameter optimization methods, this method can further reduce prediction errors by 10%-15%, with particularly significant effects in multi-model fusion scenarios. This performance improvement directly translates into more accurate rate limiting strategies, more efficient resource utilization, and a better user experience, providing a solid guarantee for the stability and quality of API services.

[0162] Example 2 like Figure 2 As shown, this embodiment provides a dynamic API rate limiting system based on multimodal traffic prediction, including: The multimodal dataset construction module is used to collect historical traffic data, business feature data, and external event data of API calls through the API gateway monitoring system, business system logs, and external event management system. It performs linear interpolation to fill missing values, outlier filtering, and binary feature conversion of event data on the historical traffic data, business feature data, and external event data. Furthermore, it performs continuous data normalization, one-hot encoding of categorized data, and construction of time features to obtain a standardized multimodal dataset. The traffic prediction module is used to extract features and capture dependencies from time-series samples in the standardized multimodal dataset using an LSTM model to obtain basic traffic prediction values. It then uses a Prophet model to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients. Finally, it uses an XGBoost model to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset to obtain business weight coefficients. The module standardizes the basic traffic prediction values, traffic change coefficients, and business weight coefficients, and performs weighted fusion calculations based on dynamically determined fusion weights to output traffic prediction values ​​for future time windows. The traffic limiting threshold calculation module is used to calculate customer levels based on the traffic prediction value and pre-collected customer profile data, obtain customers with different priorities through a customer priority evaluation algorithm, allocate thresholds to customers with different priorities based on the customer levels through a traffic limiting quota allocation algorithm, and output the traffic limiting thresholds for customers with different priorities. The closed-loop feedback optimization module is used to calculate an error index based on the real-time collected actual traffic data and the traffic prediction value through a prediction error evaluation algorithm. Based on the error index, it updates the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation through a model weight dynamic adjustment algorithm. Based on the long-term accumulated error data, it updates the internal parameters of the LSTM model, Prophet model, and XGBoost model through a parameter optimization algorithm. The updated fusion weights and internal parameters are used to continuously optimize the process of generating the traffic prediction value.

Claims

1. A dynamic API rate limiting method based on multimodal traffic prediction, characterized in that, Includes the following steps: Historical traffic data, business characteristic data, and external event data of API calls are collected through the API gateway monitoring system, business system logs, and external event management system. Missing value linear interpolation filling, outlier filtering, and binary feature conversion of event data are performed on the historical traffic data, business characteristic data, and external event data. Furthermore, continuous data normalization, one-hot encoding of categorized data, and construction of time features are performed to obtain a standardized multimodal dataset. Based on the standardized multimodal dataset, the LSTM model is used to extract features and capture dependencies from the time-series samples in the standardized multimodal dataset to obtain basic traffic prediction values. The Prophet model is used to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients. The XGBoost model is used to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset to obtain business weight coefficients. The basic traffic prediction values, traffic change coefficients, and business weight coefficients are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic prediction values ​​for future time windows. Based on the traffic prediction value and the pre-collected customer profile data, the customer level is calculated by the customer priority evaluation algorithm to obtain customers with different priorities. Based on the customer level, the threshold is allocated to customers with different priorities by the traffic limit quota allocation algorithm, and the traffic limit threshold of different priority customers is output. Based on real-time collected actual traffic data and the traffic prediction value, an error index is calculated using a prediction error evaluation algorithm. Based on the error index, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation are updated using a model weight dynamic adjustment algorithm. Based on long-term accumulated error data, the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated using a parameter optimization algorithm. The updated fusion weights and internal parameters are used to continuously optimize the process of generating the traffic prediction value.

2. The method according to claim 1, characterized in that, Historical traffic data, business characteristic data, and external event data of API calls are collected through the API gateway monitoring system, business system logs, and external event management system, including: The API gateway monitoring system collects API call QPS, request response time, and request success rate, with a sampling granularity of 10 seconds, to obtain the historical traffic data. The business characteristic data is obtained by collecting API interface types, interface call frequencies, and associated business links from the business system logs. The external event management system collects promotional activity schedules that affect API call volume, holiday markers that affect API access patterns, and system maintenance events that affect API service availability from the business operation system, calendar service system, and system monitoring platform to obtain the external event data.

3. The method according to claim 2, characterized in that, The historical traffic data, business characteristic data, and external event data are subjected to linear interpolation imputation for missing values, outlier filtering, and binary feature transformation of event data. Further, continuous data normalization, one-hot encoding of categorized data, and temporal feature construction are performed to obtain a standardized multimodal dataset, including: The missing values ​​in the historical traffic data, business characteristic data and external event data are filled by linear interpolation. The 3σ criterion is used to identify and remove outliers. The sliding window averaging method is used to smooth the abnormal data caused by network fluctuations to obtain a clean dataset. Based on the cleaning dataset, the promotional activity schedule, holiday markers, and system maintenance events in the external event data are converted into binary marker features. Continuous data is normalized, including QPS, response time, success rate in the historical traffic data, and interface call frequency in the business feature data. Categorized data is one-hot encoded, including interface types in the business feature data. Time features are constructed based on 10-second granular sampling timestamps in the cleaning dataset. The binary marker features, normalized continuous data, one-hot encoded categorized data, and time features are combined to obtain characteristic data. Based on the aforementioned feature data, time-series samples for the LSTM model, a timestamp structured data table for the Prophet model, and a feature matrix for the XGBoost model are constructed respectively. Based on the time-series samples, the timestamp structured data table, and the feature matrix, the standardized multimodal dataset is obtained.

4. The method according to claim 3, characterized in that, The basic traffic prediction values ​​are obtained by extracting features and capturing dependencies from time-series samples in the standardized multimodal dataset using an LSTM model, including: Based on the time-series sequence samples in the standardized multimodal dataset, a two-layer stacked LSTM network architecture is constructed, wherein the first layer has 64 LSTM units, the second layer has 64 LSTM units, and the dropout rate is 0.

2. A fully connected layer is added to the output layer of the two-layer stacked LSTM network architecture. The time-series sample is input into the two-layer stacked LSTM network architecture. The first LSTM layer encodes and extracts the input time-series features to capture short-term time dependencies. The hidden state output of the first LSTM layer is passed to the second LSTM layer. The second LSTM layer further extracts long-term time dependencies and complex time-series patterns to obtain a deep time-series feature representation with a dimension of 64. The deep temporal feature representation is input into the fully connected layer, and the 64-dimensional feature is mapped to a single numerical output through linear transformation by the fully connected layer to obtain the original value of the traffic prediction. Based on the original traffic prediction values ​​and the pre-collected real traffic label data, the mean squared error loss function is calculated. The Adam optimizer is used to backpropagate and update the parameters of the two-layer stacked LSTM network architecture and the fully connected layer. After iterative training and convergence, the basic traffic prediction values ​​are obtained.

5. The method according to claim 1, characterized in that, The basic traffic forecast, traffic change coefficient, and service weight coefficient are standardized, and a weighted fusion calculation is performed based on dynamically determined fusion weights to output the traffic forecast for future time windows, including: The basic flow prediction value is normalized to a minimum and then mapped to the [0,1] interval to obtain Q. LSTMnorm The traffic change coefficient and service weight coefficient are standardized using Z-score to obtain the standardized value β of the traffic change coefficient. norm The standardized value γ of the business weight coefficient norm ; Based on the comparison results of historical prediction data and actual traffic data, the fusion weights α for the LSTM model, Prophet model, and XGBoost model were determined through cross-validation and scenario-weighted adjustment. final β final γ final And ensure α final +β final +γ final =1; Calculate the normalized fusion value: Q_pred norm =a final ×Q LSTMnorm +b final ×b norm +g final ×c norm ; For the standardized fusion value Q_pred norm Perform inverse normalization to obtain the traffic prediction value Q_pred for the future time window.

6. The method according to claim 5, characterized in that, The calculation of the normalized fusion value Q_pred norm Then, regarding the Q_pred norm Before performing inverse normalization, the method further includes a step of fusion optimization using a multi-covariance learning operator: Based on the Q LSTMnorm β norm γ norm Construct a 3×3 covariance matrix, where the feature elements of the covariance matrix are the covariances between each standardized value. Calculate the angle of each feature element to quantify the correlation angle between feature elements. Construct a feature coupling graph based on the correlation angle. Based on the feature coupling graph, a Mahalanobis distance metric is constructed using the covariance matrix Σ, and based on the Mahalanobis distance metric, the covariance adaptive weight is calculated by substituting it into the covariance adaptive weight calculation formula. Based on the covariance adaptive weights, a covariance-enhanced fusion objective function is constructed. Based on the fusion objective function, the optimal fusion prediction value Q_pred_cov is solved using the conjugate gradient method. Q_pred_cov is then used as the final standardized fusion value for subsequent inverse normalization operations.

7. The method according to claim 6, characterized in that, Constructing a covariance-enhanced fusion objective function, and based on the fusion objective function, applying the conjugate gradient method to solve for the optimal fusion prediction value Q_pred_cov, further includes: Calculate the Frobenius norm difference Δ between the current covariance matrix and the historical covariance matrix. F The historical covariance matrix is ​​the covariance matrix of the previous time step within the sliding window; When the Δ F When the preset threshold is exceeded, the covariance adaptive weights are recalculated; A new covariance structure is constructed based on the recalculated adaptive covariance weights, and the new covariance structure is fed back into the LSTM model, Prophet model, and XGBoost model to dynamically adjust the fusion weights and internal parameters of each model.

8. The method according to claim 1, characterized in that, Based on the error metric, the weights of the LSTM model, Prophet model, and XGBoost model in the fusion computation are updated using a model weight dynamic adjustment algorithm. Furthermore, based on long-term accumulated error data, the internal parameters of the LSTM model, Prophet model, and XGBoost model are updated using a parameter optimization algorithm, including: The predicted traffic volume is periodically compared with the actual traffic volume data collected in real time, and the RMSE error index is calculated based on the root mean square error of RMSE. Calculate the prediction errors of the LSTM model, Prophet model and XGBoost model in each scenario, and adjust the weights of the LSTM model, Prophet model and XGBoost model in the fusion calculation according to the error magnitude. Based on long-term accumulated error data, the number of network layers and neurons of the LSTM model, the trend change point detection frequency of the Prophet model, and the depth and number of trees of the XGBoost model are optimized periodically. The error data includes the RMSE error index recorded in time series, the corresponding scene label that generated the error, and timestamp information.

9. The method according to claim 8, characterized in that, Based on long-term accumulated error data, the number of network layers and neurons in the LSTM model, the trend change point detection frequency in the Prophet model, and the depth and number of trees in the XGBoost model are periodically optimized. The error data includes RMSE error metrics recorded in time series, the corresponding scene markers that generated the error, and timestamp information, including: A diverse parameter set containing multiple candidate parameter vectors is constructed based on the parameters of the LSTM model, the Prophet model, and the XGBoost model. The initial diverse parameter set is generated using Latin hypercube sampling. The parameters of the LSTM model include the number of network layers and the number of neurons. The parameters of the Prophet model include the frequency of trend change point detection. The parameters of the XGBoost model include the depth and number of trees. Based on the initial set of diversity parameters, a parameter performance mapping matrix is ​​constructed, the covariance matrix of the mapping matrix is ​​calculated, the covariance matrix is ​​decomposed into features, and a dimension-reduced projection matrix is ​​constructed. Using the dimensionality reduction projection matrix and the diversity parameter set, the similarity of each pair of parameter vectors in the diversity parameter set is calculated, a diversity measurement function is constructed, and the diversity measurement is calculated. When the diversity measurement is lower than a preset measurement threshold, the parameter set is subjected to diversity enhancement processing. Based on the parameter set after diversity enhancement and the dimensionality reduction projection matrix, an objective function is constructed. Using the objective function as the optimization benchmark, the search direction is guided by the dimensionality reduction projection matrix. The parameters of multiple models are collaboratively optimized through a regularized iterative multi-point estimation strategy, and the optimized parameter configuration is output.

10. A dynamic API rate limiting system based on multimodal traffic prediction, characterized in that, include: The multimodal dataset construction module is used to collect historical traffic data, business feature data, and external event data of API calls through the API gateway monitoring system, business system logs, and external event management system. It performs linear interpolation to fill missing values, outlier filtering, and binary feature conversion of event data on the historical traffic data, business feature data, and external event data. Furthermore, it performs continuous data normalization, one-hot encoding of categorized data, and construction of time features to obtain a standardized multimodal dataset. The traffic prediction module is used to extract features and capture dependencies from time-series samples in the standardized multimodal dataset using an LSTM model to obtain basic traffic prediction values. It then uses a Prophet model to perform trend analysis and influence identification on the timestamp structured data table in the standardized multimodal dataset to obtain traffic change coefficients. Finally, it uses an XGBoost model to perform correlation analysis and weight calculation on the feature matrix in the standardized multimodal dataset to obtain business weight coefficients. The module standardizes the basic traffic prediction values, traffic change coefficients, and business weight coefficients, and performs weighted fusion calculations based on dynamically determined fusion weights to output traffic prediction values ​​for future time windows. The traffic limiting threshold calculation module is used to calculate customer levels based on the traffic prediction value and pre-collected customer profile data, obtain customers with different priorities through a customer priority evaluation algorithm, allocate thresholds to customers with different priorities based on the customer levels through a traffic limiting quota allocation algorithm, and output the traffic limiting thresholds for customers with different priorities. The closed-loop feedback optimization module is used to calculate an error index based on the real-time collected actual traffic data and the traffic prediction value through a prediction error evaluation algorithm. Based on the error index, it updates the weights of the LSTM model, Prophet model, and XGBoost model in the fusion calculation through a model weight dynamic adjustment algorithm. Based on the long-term accumulated error data, it updates the internal parameters of the LSTM model, Prophet model, and XGBoost model through a parameter optimization algorithm. The updated fusion weights and internal parameters are used to continuously optimize the process of generating the traffic prediction value.