Horizontal elastic scaling method, device, equipment and storage medium
By acquiring business metric data, determining its periodicity, and combining statistical and neural network models for prediction, the horizontal elastic scaling of Kubernetes Pods is optimized, solving the problems of latency and low resource utilization in existing technologies, and achieving more flexible and efficient business system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2022-06-01
- Publication Date
- 2026-05-19
AI Technical Summary
Existing Kubernetes Pod horizontal autoscalers suffer from latency and low resource utilization when responding to changes in business load, especially affecting system stability when the number of Pods fluctuates frequently.
By acquiring business indicator data, we determine whether it has periodicity, and use statistical or neural network models for prediction. We perform horizontal elastic scaling in advance, use a combination of convolutional neural networks and recurrent neural networks for feature fusion and prediction, and combine attention mechanisms to optimize model performance.
It enables more flexible and faster adjustment of the number of Pods, improves system stability and resource utilization, reduces system overhead, and provides flexibility to adapt to changes in business load.
Smart Images

Figure CN116805921B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing, and in particular to a method, apparatus, device and storage medium for horizontal elastic scaling. Background Technology
[0002] With the rapid development of cloud computing technology, Docker containers and Kubernetes have become highly sought-after technologies in cloud-native applications. Within cloud-native technologies, Docker focuses on providing container and image services, while Kubernetes excels at tasks such as container orchestration, automated deployment, resource scheduling, health monitoring, network planning, and service discovery. Therefore, Kubernetes has become an important tool for cloudification and simplified operations for many internet companies, and is being adopted by an increasing number of companies.
[0003] In existing Kubernetes implementations, if the workload within a Pod increases after its creation, new Pods can be created to ensure stable operation of the business system. Conversely, when the workload decreases, Pods can be destroyed to improve resource utilization. To address the need to adjust the number of Pods to accommodate varying workloads, a Horizontal Pod Autoscaler (HPA) based on business performance metrics has emerged. This autoscaler dynamically scales the number of Pods based on the CPU and memory usage of currently running Pods to respond to load changes. HPA can currently receive metric data from Prometheus and also allows for custom metrics, demonstrating excellent performance in autoscaling control. However, these are all "responsive scaling," meaning that Pods are passively scaled up only when observed metrics exceed thresholds. Since newly created Pods require initialization time before they can start providing services, there is a certain response latency. Furthermore, HPA has a scaling cooldown period, with a default interval of 3 minutes between scaling operations to prevent frequent fluctuations in Pod replica counts due to frequent metric changes. These two factors result in a relatively long time required to scale Pods, which can potentially have a significant impact on the system. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, device, and storage medium for horizontally flexible scaling, designed to meet the requirements for stable operation of business systems.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] In a first aspect, embodiments of this application provide a method for horizontally elastic expansion and contraction, including:
[0007] Obtain business performance data for the target business;
[0008] Based on the business indicator data, generate an indication of whether the target business has periodic results;
[0009] Based on the results, horizontal elastic scaling is performed using the business indicator data.
[0010] In the above scheme, if the result is a first result indicating that the target business has periodicity, the horizontal elastic scaling based on the business indicator data includes:
[0011] The business indicator data are predicted using a first statistical model to obtain predicted values;
[0012] Horizontal elastic scaling is performed based on the predicted values.
[0013] In the above scheme, if the result is a second result indicating that the target service does not have a periodicity, the horizontal elastic scaling based on the service indicator data includes:
[0014] The business indicator data is predicted using a second model based on a neural network to obtain predicted values;
[0015] Horizontal elastic scaling is performed based on the predicted values.
[0016] In the above scheme, the business indicator data includes at least two different types of feature data. The step of using a second neural network-based model to predict the business indicator data and obtain predicted values includes:
[0017] The feature data of at least two different types are fused based on a convolutional neural network (CNN) to obtain fused feature values;
[0018] The fused feature values are predicted based on a recurrent neural network (RNN) to obtain the predicted values.
[0019] In the above scheme, the CNN introduces an attention mechanism, and the fusion of at least two different types of feature data based on the CNN to obtain fused feature values includes:
[0020] During the process of fusing the at least two different types of feature data based on the CNN backbone network, weight values are assigned to the at least two different types of feature data based on a set attention network in the target network layer; wherein, the first feature vector output by the backbone network and the second feature vector output by the attention network have the same dimension;
[0021] The fused feature value is obtained by performing a dot product operation on the first feature vector and the second feature vector.
[0022] In the above scheme, obtaining the fused feature value based on the dot product operation of the first feature vector and the second feature vector includes:
[0023] The first feature vector and the third feature vector are multiplied by a dot product to obtain the fused feature value; wherein the third feature vector is obtained by adding 1 to the second feature vector.
[0024] In the above scheme, the horizontal elastic scaling based on the predicted value includes:
[0025] The target time for capacity expansion is determined based on the predicted values;
[0026] Based on the target time and the set advance expansion strategy, the expansion operation is executed.
[0027] In the above scheme, the step of generating a result indicating whether the target business has periodicity based on the business indicator data includes:
[0028] The business indicator data is normalized to obtain normalized sample values;
[0029] The sample values are divided into units of time, and based on the similarity between two adjacent units of time, a result indicating whether the target service is periodic is generated.
[0030] Secondly, embodiments of this application provide a horizontally elastic expansion / contraction device, comprising:
[0031] The acquisition module is used to acquire business indicator data for the target business.
[0032] A periodicity determination module is used to generate a result indicating whether the target business has a periodicity based on the business indicator data;
[0033] The scaling module is used to perform horizontal elastic scaling based on the business indicator data according to the results.
[0034] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor, when running the computer program, performs the steps of the method described in the first aspect of the embodiments of this application.
[0035] Fourthly, embodiments of this application provide a storage medium storing a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect of embodiments of this application.
[0036] The technical solution provided in this application involves acquiring business indicator data of a target business; generating a result indicating whether the target business has a periodicity based on the business indicator data; and performing horizontal elastic scaling based on the result and the business indicator data. In this way, different strategies can be adopted for horizontal elastic scaling depending on whether the target business has a periodicity, making the horizontal elastic scaling strategy flexible and better meeting the needs of stable operation of the business system. Attached Figure Description
[0037] Figure 1 This is a schematic flowchart of the horizontal elastic expansion and contraction method according to an embodiment of this application;
[0038] Figure 2 This is a schematic diagram illustrating the principle of the second model based on a neural network in an embodiment of this application;
[0039] Figure 3 This is a schematic diagram of the structure for introducing an attention mechanism in a CNN according to an embodiment of this application;
[0040] Figure 4 This is a schematic flowchart of the horizontal elastic expansion and contraction method in an application embodiment of this application;
[0041] Figure 5 This is a schematic diagram of the structure of the horizontal elastic expansion and contraction device according to an embodiment of this application;
[0042] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0043] The present application will now be described in further detail with reference to the accompanying drawings and embodiments.
[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0045] In related technologies, addressing the time latency issue in "responsive scaling" often relies on recurrent neural networks (RNNs) to predict business metrics data for the next time point, thereby responding in advance based on the predicted values. While this neural network-based prediction method effectively solves the slow response time problem, it suffers from two main issues. First, neural networks consume significant resources during training. Applying neural network training and prediction to all business processes would undoubtedly consume substantial computing resources. Therefore, for businesses with strong periodicity, neural network-based prediction would increase system overhead. For example, e-commerce flash sales have fixed purchase times, during which access volume surges dramatically, while access volume is generally stable at other times, exhibiting a clear periodicity. Second, this RNN-based prediction typically uses a single performance metric (such as CPU or memory usage) as the basis for training and prediction, neglecting the impact of other business metrics. This approach is somewhat one-sided and fails to reflect the overall business load changes.
[0046] Based on this, in various embodiments of this application, business indicator data of the target business is obtained; a result indicating whether the target business has periodicity is generated based on the business indicator data; and horizontal elastic scaling is performed based on the result and the business indicator data. In this way, different strategies can be adopted for horizontal elastic scaling depending on whether the target business has periodic results, thereby making the horizontal elastic scaling strategy flexible and better meeting the needs of stable operation of the business system.
[0047] This application provides a horizontally flexible scaling method applicable to electronic devices with data processing capabilities, such as terminal devices and servers, or it can be implemented through the cooperation of terminal devices and servers. Specifically, the terminal device can be a computer, smartphone, personal digital assistant (PDA), etc.; the server can be an application server or a web server. In actual deployment, the server can be a standalone server or a cluster server. Figure 1 As shown, the method includes:
[0048] Step 101: Obtain the business metrics data for the target business.
[0049] For example, an electronic device can read a configuration file and obtain business metric data for the target business based on the configuration file.
[0050] In one example, the configuration file can be a Yaml (YAML Ain't Markup Language) file. Users can define where the Yaml file is saved in a specified folder. Electronic devices can periodically read the Yaml file to obtain information such as the target service to be monitored, the maximum and minimum number of replicas, and the lead time for adjusting the number of replicas. For example, the Yaml file format is as follows:
[0051] serviceName:service1#The name of the monitored service
[0052] minReplicas: 3 # Minimum number of replicas, must be the same as the number of replicas set in HPA.
[0053] maxReplicas: 8 # Maximum number of replicas, must be the same as the number of replicas set in HPA.
[0054] aheadTime:5# Adjusts the advance time for replica counts, in minutes.
[0055] Understandably, electronic devices can identify target services based on read YAML files, and then obtain the target service's business metrics data.
[0056] In one example, an electronic device can acquire business metric data for a set period of time for a target service. For instance, the source of the business metric data could be the Prometheus monitoring system. By calling a specified HTTP (Hypertext Transfer Protocol) interface, the device can access historical feature data collected by the Prometheus monitoring system. Exemplarily, the acquired business metric data can be in JSON (JavaScript Object Notation) format.
[0057] The acquired business metrics data may include at least one of the following: CPU (Central Processing Unit) utilization, memory utilization, HTTP access volume, and network throughput. It should be noted that the business metrics data may also include other characteristic data, which can be configured in the configuration file according to the business type; this application embodiment does not limit this.
[0058] Step 102: Generate a result indicating whether the target business has periodicity based on the business indicator data.
[0059] For example, generating a result indicating whether the target business has periodicity based on the business indicator data includes:
[0060] The business indicator data is normalized to obtain normalized sample values;
[0061] The sample values are divided into units of time, and based on the similarity between two adjacent units of time, a result indicating whether the target service is periodic is generated.
[0062] Understandably, electronic devices can normalize and calculate similarity on the acquired business indicator data to obtain results indicating whether the target business is periodic. These results include a first result indicating that the target business is periodic and a second result indicating that the target business is not periodic.
[0063] For example, an electronic device can acquire business indicator data from the past 10 days, normalize the acquired data, and obtain normalized sample values. For instance, deviation standardization can be used to normalize the data, mapping the business indicator data to the [0, 1] interval, as shown in the following formula:
[0064]
[0065] Where, x max x represents the maximum value of the original sample data. min Let x be the minimum value of the original sample data, and let x be the sample value to be processed. * This represents the sample value after deviation standardization; the original sample data is the obtained business indicator data.
[0066] In some embodiments, considering that abnormal fluctuations may exist in the original sample data, which could lead to abnormal weight shifts during neural network training and thus affect the model's prediction results, preprocessing such as data cleaning can be performed on the original sample data before normalization. For example, outliers in the original sample data can be replaced as needed. For instance, the average value before and after the outlier can be used to replace the outlier; then, the preprocessed original sample data is normalized to map feature data of different categories and sizes to the same distribution interval, for example, to the interval [0, 1].
[0067] Here, similarity is calculated based on the normalized sample values, including:
[0068] The sample values are divided into units of time, and based on the similarity between two adjacent units of time, a result indicating whether the target service is periodic is generated.
[0069] For example, the normalized sample values are divided into 10 units, with each unit being a day. Then, the similarity between each two consecutive days is calculated, and the mean similarity is calculated. This mean similarity is then compared with a set threshold. If the mean similarity is greater than or equal to the set threshold, a first result indicating that the target service is periodic is generated; if the mean similarity is less than the set threshold, a second result indicating that the target service is not periodic is generated.
[0070] For example, the similarity between two adjacent time units can be calculated using the following formula:
[0071]
[0072] Where, x i For any sample value of the first unit of time, y is the mean of the sample values for the first unit of time. i For any sample value of the second unit of time, γ represents the mean of the sample values for the second unit of time, and γ is the similarity. The first unit of time and the second unit of time are adjacent.
[0073] It should be noted that the above-mentioned unit duration is based on days. In other embodiments, the unit duration can be other durations, and this application embodiment does not limit this.
[0074] Step 103: Based on the results, perform horizontal elastic scaling up and down based on the business indicator data.
[0075] Understandably, depending on whether the target business has cyclical results, electronic devices can adopt different strategies for horizontal elastic scaling, thereby making the horizontal elastic scaling strategy flexible and better meeting the needs of stable operation of business systems.
[0076] For example, if the result is a first result indicating that the target business has periodicity, the horizontal elastic scaling based on the business indicator data includes:
[0077] The business indicator data are predicted using a first statistical model to obtain predicted values;
[0078] Horizontal elastic scaling is performed based on the predicted values.
[0079] It should be noted that, for periodic target businesses, the embodiments of this application use a first statistical model to predict business indicator data, which can effectively reduce resource consumption.
[0080] For example, the first model can be an autoregressive model (AR model) in statistics, and the formula for the AR model is as follows:
[0081]
[0082] Among them, y t These are predicted values, μ is a constant term, and γ is a predicted value. i It is the autocorrelation coefficient, ε t The error is white noise, p is an order in the model, indicating how many periods of historical data are used for prediction, i is the index of the historical data, t is the index of the predicted value, and t > p.
[0083] It is understandable that the business indicator data input into the first model can be the sample values after the aforementioned normalization process.
[0084] For example, after obtaining the predicted value, the electronic device can determine the time point when the Pod needs to be scaled up based on the predicted value, so that it can call the Kubernetes API interface for the specified business in advance and adjust the size of the RC (Replication Controller) to increase the number of replicas.
[0085] For example, if the result is a second result indicating that the target service does not have a periodicity, the horizontal elastic scaling based on the service indicator data includes:
[0086] The business indicator data is predicted using a second model based on a neural network to obtain predicted values;
[0087] Horizontal elastic scaling is performed based on the predicted values.
[0088] Traditional RNN-based prediction typically uses a single performance metric (such as CPU or memory usage) as the basis for training and prediction, without considering the impact of other business metrics. This approach is somewhat one-sided and fails to reflect the overall changes in business load. Therefore, in this embodiment, as... Figure 2 As shown, the business indicator data includes at least two different types of feature data. The step of using a second neural network-based model to predict the business indicator data and obtain predicted values includes:
[0089] The feature values are obtained by fusing at least two different types of feature data based on CNN.
[0090] The fused feature values are predicted based on the RNN to obtain the predicted values.
[0091] It is understood that the second model in this application embodiment is a model based on CNN and RNN. CNN can express business indicator data with many features at a higher level and in a more abstract way, while RNN can focus only on the time-varying features of the data and then predict the predicted value at the next moment.
[0092] It is understandable that the business indicator data input into the second model can be the sample values after the aforementioned normalization process.
[0093] For example, the CNN introduces an attention mechanism, and the CNN-based fusion of at least two different types of feature data to obtain fused feature values includes:
[0094] During the process of fusing the at least two different types of feature data based on the CNN backbone network, weight values are assigned to the at least two different types of feature data based on a set attention network in the target network layer; wherein, the first feature vector output by the backbone network and the second feature vector output by the attention network have the same dimension;
[0095] The fused feature value is obtained by performing a dot product operation on the first feature vector and the second feature vector.
[0096] It's worth noting that CNNs, leveraging the advantages of attention mechanisms and convolutional operations, can represent raw data with numerous features at a higher level and with greater abstraction. This allows them to extract more useful information from various business metrics and assign greater weight to important features. Finally, the resulting weighted high-level feature values are input into an RNN suitable for processing time-series data prediction, which can predict the number of Pod replicas needed at the next time step.
[0097] For example, refer to Figure 2 The second model in this application embodiment includes the following four units: input unit, CNN unit, RNN unit and output unit.
[0098] In the input unit, the input at each time point is a vector containing m features. Each feature represents a business metric at that point in time.
[0099] In a CNN unit, it mainly consists of two parts: a backbone network and an attention network. The attention network is a branching subnetwork of the backbone network with a specific network layer (i.e., the target network layer) as its node. See [link to CNN unit structure] for details. Figure 3 Understandably, CNNs are composed of multiple stacked one-dimensional networks, which can extract one-dimensional feature vectors. This process extracts deeper, more representative information from the feature vectors and, combined with an attention network, assigns greater weight to important features to "attention" to the more useful information within the feature vectors while filtering out useless information. The attention network consists of multiple stacked one-dimensional convolutional and pooling layers, with the last layer using a sigmoid function to constrain the values between 0 and 1. The first feature vector output from the backbone network and the second feature vector output from the attention network are multiplied to obtain the fused feature value.
[0100] In the RNN unit, the information extracted by the CNN unit (i.e., the fused feature values) is used as the RNN input, so that the RNN only focuses on the time-varying features of the data and does not need to pay too much attention to the extraction of data features. The predicted value obtained by the RNN unit is output by the output unit.
[0101] It should be noted that while adding an attention network to a CNN can achieve good results, simply stacking attention networks also has some drawbacks. For example, the feature values output by the attention network are between 0 and 1. Multiplying these features by the output features of the backbone network weakens the backbone network's output response, meaning the output feature values become smaller, affecting the gradient backpropagation effect. Therefore, in some embodiments, the step of obtaining the fused feature value based on the dot product operation of the first feature vector and the second feature vector includes:
[0102] The first feature vector and the third feature vector are multiplied by a dot product to obtain the fused feature value; wherein the third feature vector is obtained by adding 1 to the second feature vector.
[0103] For example, the fused feature values can be calculated using the following formula:
[0104] H(x)=T(x)*(1+W(x)) (4)
[0105] Where H(x) is the fused feature value, T(x) is the first feature vector, and W(x) is the second feature vector. The value of W(x) is between 0 and 1. Adding W(x) to 1 can effectively solve the problem of reducing the feature value mentioned above, so that the output of the attention network will not suppress the output response of the backbone network.
[0106] For example, the horizontal elastic scaling based on the predicted value includes:
[0107] The target time for capacity expansion is determined based on the predicted values;
[0108] Based on the target time and the set advance expansion strategy, the expansion operation is executed.
[0109] For example, the predicted value output by the second model can be the predicted number of Pods for the service at the next time point. Based on this predicted number of Pods, a comparison can be made with the current number of Pods for the service to determine whether Pods need to be scaled up. For services that need to scale up the number of Pods, the Kubernetes API interface is called in advance, according to the scaling lead time set in the YAML file, to adjust the size of the Replication Controller (RC) and scale up the number of replicas before the scheduled time.
[0110] The present application will be further described in detail below with reference to application examples.
[0111] like Figure 4 As shown, the horizontal elastic scaling method in this application embodiment includes the following steps:
[0112] Step 1) Read the defined YAML file to obtain the services that need to be monitored, as well as the maximum and minimum number of replicas when the service is expanded.
[0113] Step 2) Collect corresponding business indicator data according to the business defined in the Yaml file, and clean and normalize the data.
[0114] Step 3) Calculate the similarity of adjacent period data for the 10-day business indicator data on a daily basis, and determine whether the business indicator data has periodicity based on the set threshold.
[0115] For example, the similarity between two consecutive days is calculated, the average similarity is calculated based on the calculated similarity, and the average similarity is compared with a set threshold. If the average similarity is greater than or equal to the set threshold, a first result indicating that the target service has periodicity is generated, and subsequent step 5) is executed; if the average similarity is less than the set threshold, a second result indicating that the target service does not have periodicity is generated, and subsequent step 4) is executed.
[0116] Step 4) If the business indicator data is not periodic, use 10 days of data as the training set and improve the neural network model. Based on the improved model, predict the trend of change in the next time period, and determine the time point when expansion is needed based on the predicted trend. Expand the number of replicas a certain time in advance.
[0117] Here, the improved model can be understood as the aforementioned second model based on neural networks. This second model is based on CNN and RNN, and the CNN introduces an attention mechanism, which allows the CNN to fuse at least two different types of feature data.
[0118] Preferably, the output formula of the CNN with the attention mechanism is improved so that the feature value range of the attention network output changes from 0 to 1 to 1 to 2, so that the output of the attention network does not inhibit the output response of the backbone network. For details, please refer to the foregoing description, which will not be repeated here.
[0119] Step 5) If the business indicator data is periodic, predict the trend of business indicator changes according to statistical methods, and determine the time point when expansion is needed based on the predicted trend, and expand the number of replicas a certain time in advance.
[0120] Here, the process of predicting the changing trends of business indicators based on statistics can be referred to the aforementioned prediction process based on the first model, and will not be repeated here.
[0121] Understandably, the horizontally flexible scaling method in this application embodiment introduces a dual attention mechanism. Firstly, based on the first "attention mechanism," the similarity of business metrics is calculated periodically to determine if they exhibit periodicity, thus "noticing" some periodic business activities. Subsequently, statistical methods can be used instead of neural network methods for periodic businesses to reduce system overhead. Secondly, based on the second "attention mechanism," the system employs a Convolutional Neural Network (CNN) with better static data feature extraction performance to extract deeper and more abstract feature data from numerous metric data, thus "noticing" feature data that better reflects the overall business load. Based on the feature data extracted by the CNN, the subsequent use of an RNN suitable for processing dynamic time-series data prediction can predict its trend, improving prediction accuracy. Thirdly, the output formula of the CNN with the attention mechanism is improved, changing the range of the attention network's output feature values from 0-1 to 1-2, ensuring that the attention network's output does not suppress the output response of the backbone network.
[0122] In order to implement the method of the embodiments of this application, the embodiments of this application also provide a horizontal elastic expansion and contraction device, which corresponds to the above-mentioned horizontal elastic expansion and contraction method. The steps in the above-mentioned horizontal elastic expansion and contraction method embodiments are also fully applicable to the embodiments of this horizontal elastic expansion and contraction device.
[0123] like Figure 5 As shown, the horizontally flexible scaling device includes: an acquisition module 501, a periodicity judgment module 502, and a scaling module 503; wherein, the acquisition module 501 is used to acquire business indicator data of the target service; the periodicity judgment module 502 is used to generate a result indicating whether the target service has periodicity based on the business indicator data; and the scaling module 503 is used to perform horizontally flexible scaling based on the business indicator data according to the result.
[0124] In some embodiments, if the result is a first result indicating that the target service has periodicity, the scaling up / down module 503 is specifically used for:
[0125] The business indicator data are predicted using a first statistical model to obtain predicted values;
[0126] Horizontal elastic scaling is performed based on the predicted values.
[0127] In some embodiments, if the result is a second result indicating that the target service does not have periodicity, the scaling up / down module 503 is specifically used for:
[0128] The business indicator data is predicted using a second model based on a neural network to obtain predicted values;
[0129] Horizontal elastic scaling is performed based on the predicted values.
[0130] In some embodiments, the business indicator data includes at least two different types of feature data. The scaling module 503 uses a second neural network-based model to predict the business indicator data and obtain predicted values, including:
[0131] The feature values are obtained by fusing at least two different types of feature data based on CNN.
[0132] The fused feature values are predicted based on the RNN to obtain the predicted values.
[0133] In some embodiments, an attention mechanism is introduced into the CNN, and the scaling module 503 fuses the at least two different types of feature data based on the CNN to obtain fused feature values, including:
[0134] During the process of fusing the at least two different types of feature data based on the CNN backbone network, weight values are assigned to the at least two different types of feature data based on a set attention network in the target network layer; wherein, the first feature vector output by the backbone network and the second feature vector output by the attention network have the same dimension;
[0135] The fused feature value is obtained by performing a dot product operation on the first feature vector and the second feature vector.
[0136] In some embodiments, the scaling module 503 obtains the fused feature value based on the dot product operation of the first feature vector and the second feature vector, including:
[0137] The first feature vector and the third feature vector are multiplied by a dot product to obtain the fused feature value; wherein the third feature vector is obtained by adding 1 to the second feature vector.
[0138] In some embodiments, the scaling module 503 performs horizontal elastic scaling based on the predicted value, including:
[0139] The target time for capacity expansion is determined based on the predicted values;
[0140] Based on the target time and the set advance expansion strategy, the expansion operation is executed.
[0141] In some embodiments, the periodic judgment module 502 is specifically used for:
[0142] The business indicator data is normalized to obtain normalized sample values;
[0143] The sample values are divided into units of time, and based on the similarity between two adjacent units of time, a result indicating whether the target service is periodic is generated.
[0144] In practical applications, the acquisition module 501, the periodic judgment module 502, and the expansion / shrinkage module 503 can be implemented by the processor in the horizontally flexible expansion / shrinkage device. Of course, the processor needs to run the computer program in the memory to implement its functions.
[0145] It should be noted that the horizontal flexible expansion and contraction device provided in the above embodiments is only illustrated by the division of the above-described program modules. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. Furthermore, the horizontal flexible expansion and contraction device and the horizontal flexible expansion and contraction method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0146] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device. Figure 6 The diagram shows only an exemplary structure of the electronic device, not the entire structure; implementation is possible as needed. Figure 6 The structure shown may be part or all of the structure.
[0147] like Figure 6As shown, the electronic device 600 provided in this application embodiment includes: at least one processor 601, a memory 602, a user interface 603, and at least one network interface 604. The various components in the electronic device 600 are coupled together via a bus system 605. It can be understood that the bus system 605 is used to implement communication between these components. In addition to a data bus, the bus system 605 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 6 The general designated all buses as Bus System 605.
[0148] The user interface 603 may include a monitor, keyboard, mouse, trackball, click wheel, buttons, touchpad, or touch screen.
[0149] The memory 602 in this embodiment is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.
[0150] The horizontal scaling method disclosed in this application can be applied to or implemented by processor 601. Processor 601 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the horizontal scaling method can be completed by integrated logic circuits in the hardware of processor 601 or by instructions in software form. The processor 601 can be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 601 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software modules can be located in a storage medium, specifically memory 602. Processor 601 reads information from memory 602 and, in conjunction with its hardware, completes the steps of the horizontal scaling method provided in the embodiments of this application.
[0151] In an exemplary embodiment, the electronic device may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.
[0152] It is understood that memory 602 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.
[0153] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 602 that stores a computer program. The computer program can be executed by a processor 601 of an electronic device to complete the steps described in the method of this application embodiment. The computer-readable storage medium can be a ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM, etc.
[0154] It should be noted that terms such as "first" and "second" are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0155] Furthermore, the technical solutions described in the embodiments of this application can be combined arbitrarily without conflict.
[0156] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for horizontal elastic expansion and contraction, characterized in that, include: Obtain business performance data for the target business; Based on the business indicator data, generate an indication of whether the target business has periodic results; Based on the results, horizontal elastic scaling up and down is performed using the business indicator data. If the result is a first result indicating that the target service has a periodicity, the horizontal elastic scaling based on the service indicator data includes: The business indicator data are predicted using a first statistical model to obtain predicted values; Horizontal elastic expansion and contraction are performed based on the predicted values; If the result is a second result indicating that the target service does not have a periodicity, the horizontal elastic scaling based on the service indicator data includes: The business indicator data is predicted using a second model based on a neural network to obtain predicted values; Horizontal elastic scaling is performed based on the predicted values.
2. The method according to claim 1, characterized in that, The business indicator data includes at least two different types of feature data. The step of using a second neural network-based model to predict the business indicator data and obtain predicted values includes: The at least two different types of feature data are fused based on a convolutional neural network (CNN) to obtain fused feature values. The fused feature values are predicted based on a recurrent neural network (RNN) to obtain the predicted values.
3. The method according to claim 2, characterized in that, The CNN introduces an attention mechanism, and the CNN-based fusion of at least two different types of feature data to obtain fused feature values includes: During the process of fusing the at least two different types of feature data based on the CNN backbone network, weight values are assigned to the at least two different types of feature data based on a set attention network in the target network layer; wherein, the first feature vector output by the backbone network and the second feature vector output by the attention network have the same dimension; The fused feature value is obtained by performing a dot product operation on the first feature vector and the second feature vector.
4. The method according to claim 3, characterized in that, The dot product operation based on the first feature vector and the second feature vector to obtain the fused feature value includes: The first feature vector and the third feature vector are multiplied by a dot product to obtain the fused feature value; wherein the third feature vector is obtained by adding 1 to the second feature vector.
5. The method according to claim 1, characterized in that, The horizontal elastic scaling based on the predicted value includes: The target time for capacity expansion is determined based on the predicted values; Based on the target time and the set advance expansion strategy, the expansion operation is executed.
6. The method according to claim 1, characterized in that, The step of generating a result indicating whether the target business has a periodicity based on the business indicator data includes: The business indicator data is normalized to obtain normalized sample values; The sample values are divided into units of time, and based on the similarity between two adjacent units of time, a result indicating whether the target service is periodic is generated.
7. A horizontally elastic expansion / contraction device, characterized in that, include: The acquisition module is used to acquire business indicator data for the target business. A periodicity determination module is used to generate a result indicating whether the target business has a periodicity based on the business indicator data; The scaling module is used to perform horizontal elastic scaling based on the results and the business indicator data. If the result is a first result indicating that the target service has a periodicity, the scaling up / down module is specifically used for: The business indicator data are predicted using a first statistical model to obtain predicted values; Horizontal elastic expansion and contraction are performed based on the predicted values; If the result is a second result indicating that the target service does not have a periodicity, the scaling up / down module is specifically used for: The business indicator data is predicted using a second model based on a neural network to obtain predicted values; Horizontal elastic scaling is performed based on the predicted values.
8. An electronic device, characterized in that, include: A processor and memory for storing computer programs that can run on the processor, wherein, The processor, when running a computer program, performs the steps of the method according to any one of claims 1 to 6.
9. A storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.