Predictive capacity elastic expansion and contraction method and device

By adopting a multi-step prediction method in Kubernetes, the load prediction model is used to determine the first peak load during the prediction cycle, and adjust the number of instance replicas, solving the problems of excessive scaling and waste of resources in the prior art, and achieving efficient utilization of resources.

CN120407136APending Publication Date: 2025-08-01BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410137699.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-31
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the existing Kubernetes predictive capacity elastic scaling method, the single-step prediction method leads to excessive scaling times, and the multi-step prediction method leads to waste of resources, making it difficult to balance the scaling times and resource utilization.

Method used

Using a multi-step prediction method, the first peak load in the prediction cycle is determined through the load prediction model, and the capacity is expanded or reduced according to the number of instance copies of the peak load, the number of predictions and scaling is reduced, and the load data prediction for the next cycle is predicted at the peak moment.

Benefits of technology

Reduces the number of predictions and scaling, improves resource utilization, reduces resource waste, and balances the number of scaling and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407136A_ABST
    Figure CN120407136A_ABST
Patent Text Reader

Abstract

The invention discloses a predictive capacity elastic expansion and contraction method and device, and relates to the technical field of computers. The specific embodiment of the method comprises the following steps: determining predicted load data of a prediction period by adopting a load prediction model according to load data in a preset historical time period before the current moment; wherein the load prediction model is a model which is obtained by training historical load data and is used for obtaining predicted load data; determining a first peak load appearing for the first time in a prediction period based on the prediction load data; and determining the number of target instance copies corresponding to the first peak load of the prediction period, and carrying out capacity expansion or capacity reduction on the number of current instance copies according to the number of target instance copies. According to the embodiment, the resource utilization rate is improved while the number of times of prediction and expansion is reduced, resource waste is reduced, and the number of times of expansion and the resource utilization rate are balanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a predictive capacity elastic scaling method and apparatus. Background Art

[0002] Kubernetes is an open-source container orchestration tool for automated operation and maintenance management. It realizes application deployment by deploying containers. The built-in horizontal elastic scaling in Kubernetes can, when the application load changes dynamically, adopt a predictive scaling method to predict future load data in advance to determine whether to scale out or scale in the number of instance replicas. Predictive scaling includes a single-step prediction method that predicts only at a certain future moment each time and a multi-step prediction method that predicts at multiple future moments each time.

[0003] However, the single-step prediction method has the problem of a large number of scaling times because it only predicts the load at the next moment each time. The multi-step prediction method uses the load at the moment with the largest load among multiple future moments as the basis for resource allocation, resulting in excessive resource allocation at most moments and causing great resource waste. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a predictive capacity elastic scaling method and apparatus, which can reduce the number of predictions and scalings while improving resource utilization and reducing resource waste, thereby balancing the number of scalings and resource utilization.

[0005] To achieve the above object, according to one aspect of embodiments of the present invention, a predictive capacity elastic scaling method is provided.

[0006] A predictive capacity elastic scaling method according to an embodiment of the present invention includes:

[0007] Based on the load data within a preset historical time period before the current moment, use a load prediction model to determine the predicted load data for the prediction period; wherein, the load prediction model is a model trained using historical load data for obtaining predicted load data;

[0008] Based on the predicted load data, determine the first peak load that first appears within the prediction period;

[0009] Determine the target number of instance replicas corresponding to the first peak load of the prediction period, and scale out or scale in the current number of instance replicas according to the target number of instance replicas.

[0010] Optionally, the method further includes: determining the first peak moment corresponding to the first peak load that appears within the prediction period;

[0011] Determining the number of target instance replicas corresponding to the first peak load of the above prediction period includes:

[0012] Calculating the number of instance replicas at the first peak moment of the prediction period based on the first peak load of the above prediction period, and using the calculated number of instance replicas as the number of target instance replicas from the next moment of the current moment to the first peak moment of the above prediction period.

[0013] Optionally, calculating the number of instance replicas at the first peak moment of the prediction period based on the first peak load of the above prediction period includes:

[0014] Obtaining the current number of instance replicas and the first peak load of the current period;

[0015] Calculating the number of instance replicas at the first peak moment of the prediction period based on the ratio of the above current number of instance replicas to the first peak load of the above current period, and the first peak load of the above prediction period.

[0016] Optionally, the above method further includes at least one of the following:

[0017] In response to the current moment being the first peak moment of the current period, execute the above method of determining the predicted load data of the prediction period using the load prediction model;

[0018] In response to the current time reaching the first peak moment of the above prediction period, use the first peak moment of the above prediction period as the current moment, and repeat to obtain the predicted load data of the next prediction period for expansion or contraction.

[0019] Optionally, expanding or contracting the current number of instance replicas according to the above number of target instance replicas includes:

[0020] Comparing the above current number of instance replicas with the above number of target instance replicas;

[0021] Based on the comparison result, generating an expansion command or a contraction command to adjust the above current number of instance replicas.

[0022] Optionally, based on the comparison result, generating an expansion command or a contraction command to adjust the above current number of instance replicas includes:

[0023] In response to the comparison result indicating that the above current number of instance replicas is less than the above number of target instance replicas, generating a contraction command and performing a contraction operation based on the above contraction command;

[0024] In response to the comparison result indicating that the above current number of instance replicas is greater than the above number of target instance replicas, generating an expansion command and performing an expansion operation based on the above expansion command.

[0025] Optionally, the method for obtaining the above historical load data includes:

[0026] Monitoring the load data of each node;

[0027] Storing the load data of each above node in a target time series database;

[0028] Obtaining the above historical load data from the above target time series database.

[0029] To achieve the above object, according to another aspect of the embodiments of the present invention, a predictive capacity elastic scaling device is provided.

[0030] A predictive capacity elastic scaling device according to an embodiment of the present invention includes:

[0031] A first determination module, configured to determine predicted load data for a prediction period by using a load prediction model according to load data within a preset historical period before the current moment; wherein, the above load prediction model is a model trained by using historical load data for obtaining predicted load data;

[0032] A second determination module, configured to determine a first peak load that first appears within the prediction period based on the above predicted load data;

[0033] A scaling module, configured to determine a target instance replica number corresponding to the first peak load of the above prediction period, and perform expansion or contraction on the current instance replica number according to the above target instance replica number.

[0034] To achieve the above object, according to still another aspect of the embodiments of the present invention, an electronic device for predictive capacity elastic scaling is provided.

[0035] An electronic device for predictive capacity elastic scaling according to an embodiment of the present invention includes: one or more processors; a storage device, configured to store one or more programs, and when the above one or more programs are executed by the above one or more processors, the above one or more processors implement a predictive capacity elastic scaling method according to an embodiment of the present invention.

[0036] To achieve the above object, according to yet another aspect of the embodiments of the present invention, a computer-readable storage medium is provided.

[0037] A computer-readable storage medium according to an embodiment of the present invention, on which a computer program is stored, and when the above program is executed by a processor, a predictive capacity elastic scaling method according to an embodiment of the present invention is implemented.

[0038] One embodiment of the above invention has the following advantages or beneficial effects: Through the multi-step prediction method, the load data of one prediction cycle is obtained each time, and the load at the first peak within the prediction cycle is used as the basis for scaling judgment. The number of instance replicas at the first peak load of the prediction cycle is used to adjust the current number of instance replicas, and the prediction of the load data for the next prediction cycle is carried out again at the first peak moment of the prediction cycle. Compared with the single-step prediction method that only predicts the next moment each time, the present invention greatly reduces the number of predictions and scalings. At the same time, by using the first peak load as the scaling basis, the resource utilization rate is improved, resource waste is reduced, and the number of scalings and the resource utilization rate are balanced.

[0039] The further effects of the above non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:

[0041] Figure 1 is a schematic flowchart of a predictive capacity elastic scaling method according to an embodiment of the present invention;

[0042] Figure 2 is a schematic flowchart of a predictive capacity elastic scaling method according to another embodiment of the present invention;

[0043] Figure 3 is a schematic diagram of the main modules of a predictive capacity elastic scaling device according to an embodiment of the present invention;

[0044] Figure 4 is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0045] Figure 5 is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0046] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to assist understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description below omits the description of well-known functions and structures.

[0047] It should be noted that, without conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0048] It should be noted that in the technical solution of the present disclosure, in aspects such as the collection, gathering, update, analysis, processing, use, transmission, and storage of user personal information, it complies with the provisions of relevant laws and regulations, is used for legal purposes, and does not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to safeguard user personal information security, network security, and national security.

[0049] Figure 1 It is a schematic diagram of the main steps of the predictive capacity elastic scaling method according to an embodiment of the present invention.

[0050] As Figure 1 shown, the predictive capacity elastic scaling method according to an embodiment of the present invention mainly includes the following steps:

[0051] Step S101, based on the load data within a preset historical time period before the current moment, use a load prediction model to determine the predicted load data for the prediction period; wherein, the above load prediction model is a model trained using historical load data for obtaining predicted load data;

[0052] Step S102, based on the above predicted load data, determine the first peak load that appears for the first time within the prediction period;

[0053] Step S103, determine the target instance replica number corresponding to the first peak load of the above prediction period, and scale up or scale down the current instance replica number according to the above target instance replica number.

[0054] Use a pre-trained load prediction model for multi-step prediction, take the load data within the preset historical time period of the current moment as the input of the load prediction model, and obtain the predicted load data for the prediction period according to the output of the load prediction model. The current moment can be the first peak moment of the current period.

[0055] Generally speaking, the time of each period can be preset according to the actual situation. As an example, the time of each period is T moments. Among them, when predicting with a time granularity of minutes, T = 5 means that the duration of each period is 5 minutes and the duration of each moment is 1 minute; when predicting with a time granularity of seconds, T = 5 means that the duration of each period is 5 seconds and the duration of each moment is 1 second. Optionally, the load can be characterized by CPU usage rate.

[0056] The preset historical time period can be set according to the actual situation. As an example, the preset historical time period can be the historical period of the current period, or the past n moments of the first moment of the current period.

[0057] Obtain the predicted load data for the prediction period based on the output of the load prediction model, and determine the first peak load corresponding to the first occurrence of the load peak within the prediction period. Determine the target instance replica number corresponding to the first peak load of the prediction period, and use the target instance replica number as the instance replica number from the next moment of the current moment to the first peak moment of the prediction period to scale up or down the current instance replica number of the current moment. Here, the instance replica number is the Pod replica number, the next moment of the current moment is the first moment of the prediction period, and the first peak moment of the prediction period represents the moment corresponding to the first peak load of the prediction period.

[0058] Among them, there may be multiple load peaks within the prediction period. Here, the load of the first peak of the multi-step prediction is used as the basis for scaling judgment, and only the instance replica number corresponding to the first peak load of the prediction period is calculated, thereby reducing the number of scaling operations compared to single-step prediction and improving resource utilization compared to the multi-step prediction method of finding the maximum load.

[0059] In an alternative embodiment, the method further includes: determining the first peak moment corresponding to the first peak load within the above-mentioned prediction period;

[0060] The above-mentioned determination of the target instance replica number corresponding to the first peak load of the prediction period includes:

[0061] Calculate the instance replica number at the first peak moment of the prediction period based on the first peak load of the prediction period, and use the calculated instance replica number as the target instance replica number from the next moment of the current moment to the first peak moment of the above-mentioned prediction period.

[0062] Specifically, each moment within the period corresponds to a load data, and the moment when the first peak load of the prediction period appears is the first peak moment of the prediction period.

[0063] When the first peak load and the first peak moment of the prediction period are determined, the instance replica number required at the first peak moment of the prediction period can be calculated and used as the target instance replica number from the first moment to the first peak moment of the prediction period, thereby adjusting the current instance replica number.

[0064] In an alternative embodiment, the above-mentioned calculation of the instance replica number at the first peak moment of the prediction period based on the first peak load of the prediction period includes:

[0065] Obtain the current instance replica number and the first peak load of the current period;

[0066] Calculate the number of instance replicas at the first peak moment of the prediction period based on the ratio of the above-mentioned current instance replica number to the first peak load of the above-mentioned current period, and the first peak load of the above-mentioned prediction period.

[0067] Specifically, obtain the number of instance replicas at the first peak of the current period and the first peak load of the current period. Here, when the current moment is the first peak moment of the current period, the number of instance replicas at the first peak of the current period is the current instance replica number, and the first peak load of the current period is the load at the current moment.

[0068] Multiply the ratio of the first peak load of the prediction period to the first peak load of the current period by the number of instance replicas at the first peak of the current period, and round up to obtain the number of instance replicas at the first peak moment of the prediction period. The calculation method is as follows:

[0069]

[0070] Among them, targetPodNum represents the number of instance replicas at the first peak moment of the prediction period; maxCpuUtil represents the first peak load of the prediction period; setCpuUtil represents the first peak load of the current period; NowPodNum represents the number of instance replicas at the first peak of the current period; ceil() represents the rounding-up function.

[0071] Use the calculated number of instance replicas at the first peak moment of the prediction period as the target number of instance replicas from the next moment of the current moment to the first peak moment of the prediction period.

[0072] In an alternative embodiment, the above method further includes at least one of the following:

[0073] In response to the current moment being the first peak moment of the current period, execute the above-mentioned determination of the predicted load data of the prediction period using the load prediction model;

[0074] In response to the current time reaching the first peak moment of the above-mentioned prediction period, use the first peak moment of the above-mentioned prediction period as the current moment, and repeatedly obtain the predicted load data of the next prediction period for expansion or contraction.

[0075] Specifically, continuously repeat the above steps S101 to S103. Whenever the current time reaches the first peak moment of a period, use this period as the current period and the first peak moment of this period as the current moment, and start to obtain the predicted load data of the next period (prediction period) for multi-step prediction, so as to achieve elastic capacity scaling.

[0076] In an alternative embodiment, expanding or shrinking the current instance replicas according to the number of target instance replicas includes:

[0077] Comparing the current instance replicas with the target instance replicas;

[0078] Based on the comparison result, generating an expansion command or a shrinkage command to adjust the current instance replicas.

[0079] In an alternative embodiment, the generating an expansion command or a shrinkage command based on the comparison result to adjust the current instance replicas includes:

[0080] In response to the comparison result indicating that the current instance replicas are less than the target instance replicas, generating a shrinkage command and performing a shrinkage operation based on the shrinkage command;

[0081] In response to the comparison result indicating that the current instance replicas are greater than the target instance replicas, generating an expansion command and performing an expansion operation based on the expansion command.

[0082] After calculating the number of target instance replicas, compare the current instance replicas with the target instance replicas, and generate an expansion command or a shrinkage command according to the comparison result. When the current instance replicas are less than the target instance replicas, generate a shrinkage command, reduce the current instance replicas to the target instance replicas according to the shrinkage command, and recycle the redundant instance replicas to ensure the full utilization of resources and avoid wasting resources; when the current instance replicas are greater than the target instance replicas, generate an expansion command, perform resource scheduling according to the expansion command, and increase the current instance replicas to the target instance replicas to enable the node to have sufficient resources to ensure the stable operation of the application or service.

[0083] In an alternative embodiment, the method for obtaining the historical load data includes:

[0084] Monitoring the load data of each node;

[0085] Storing the load data of each node in a target time series database;

[0086] Obtaining the historical load data from the target time series database.

[0087] As an example, the Prometheus monitoring system is used to monitor the load data of each node in the Kubernetes cluster. Here, the node refers to the Node node in the Kubernetes cluster. Each Node node includes the resources required to start the Pod replicas. Scaling the Pod replicas in the Node node up or down actually means adjusting the number of Pod replicas in the Node node to meet the application requirements. The monitored load data of the Node node is stored in the target time series database for easy invocation. Optionally, the target time series database can be the InfluxDB time series database. When it is necessary to view the load data in the target time series database, Grafana can be used for visual viewing. Thus, the monitoring, storage, and invocation and viewing of the load data of each node in the Kubernetes cluster are realized.

[0088] In an alternative embodiment, the method for constructing the load prediction model includes: obtaining historical load data from the above-mentioned target time series database, and using the historical load data as the original data set, and dividing it into a training set, a validation set, and a test set; training the initial model with the training set, where the initial model can be selected from a long short-term memory network (LSTM), a gated recurrent unit model (GRU), a sequence generation model (Seq2Seq), etc. Any model that can realize the prediction of load data can be selected, and no detailed limitation is made here. Here, the historical load data refers to part or all of the load data stored in the target time series database as of the start of constructing the load prediction model, and it can be decided according to needs which part of the above load data is used as the historical load data for model training. Verifying the model performance with the validation set to adjust the hyperparameters, and testing the performance of the trained model with the test set; when the model performance meets the user's expectations, the load prediction model is obtained. If the model performance does not meet the user's expectations, the model training is restarted.

[0089] The following uses a specific embodiment to elaborate in detail on the process of predictive capacity elastic scaling:

[0090] As Figure 2 shown, the current moment t represents the first peak moment of the current cycle. Each cycle includes m moments, where m = 10. At the current moment t, based on the load data within a preset historical time period before the current moment, the load prediction model is used to predict the load data for the next m moments.

[0091] Determine the load data for the moments from t + 1 to t + m as {P(t + 1), P(t + 2), …… P(t + 10)} = {15%, 17%, 19%, 25%, 23%, 22%, 27%, 29%, 18%, 16%}.

[0092] Determine the first peak load P(t + k) that first appears within the prediction period from time t + 1 to time t + 10, where (1 < k < m). Here, the first peak load of the prediction period is P(t + 4) = 25%.

[0093] Obtain that the first peak load of the current period is 30% and the number of instance copies of the first peak of the current period is 12.

[0094] Based on the first peak load of 25% in the prediction period, the first peak load of 30% in the current period, and the number of instance copies of 12 of the first peak in the current period, calculate that the number of instance copies at the first peak moment of the prediction period is 10.

[0095] Take the number of instance copies of 10 at the first peak moment of the prediction period as the target number of instance copies from time t + 1 to time t + 4, and compare the size of the target number of instance copies of 10 and the current number of instance copies of 12.

[0096] Since the target number of instance copies is less than the current number of instance copies, generate a scaling-down command, and scale down the current number of instance copies according to the scaling-down command, adjusting the number of instance copies from 12 to 10.

[0097] When the current time reaches the first peak moment t + 4 of the prediction period, take the prediction period as the current period, and take the first peak moment of the prediction period as the current moment. Repeat the above steps at time t + 4 to predict the predicted load data {P(t + 5), P(t + 6), …… P(t + 14)} of the next prediction period, and repeat the expansion or scaling down of the number of instance copies from the first moment to the first peak moment of the next prediction period.

[0098] Continuously repeat the above steps until the process is stopped as needed.

[0099] It can be seen from the predictive capacity elastic scaling method according to the embodiments of the present invention that through the multi-step prediction method, the load data of one prediction period is obtained each time, and the load of the first peak within the prediction period is used as the basis for scaling judgment. According to the number of instance copies of the first peak load in the prediction period, the current number of instance copies is adjusted, and the load data of the next prediction period is predicted again at the first peak moment of the prediction period. Compared with the single-step prediction method that only predicts the next moment each time, the method of the present invention greatly reduces the number of predictions and scalings. At the same time, by using the first peak load as the scaling basis, the resource utilization rate is improved, resource waste is reduced, and the number of scalings and resource utilization rate are balanced.

[0100] Figure 3Schematic diagram of the main modules of a predictive capacity elastic scaling device according to an embodiment of the present invention.

[0101] As Figure 3 shown, the predictive capacity elastic scaling device 300 according to an embodiment of the present invention includes:

[0102] A first determination module 301, configured to determine predicted load data for a prediction period by using a load prediction model according to load data within a preset historical time period before the current moment; wherein, the load prediction model is a model trained by using historical load data for obtaining predicted load data;

[0103] A second determination module 302, configured to determine a first peak load that first appears within the prediction period based on the predicted load data;

[0104] A scaling module 303, configured to determine the number of target instance replicas corresponding to the first peak load of the prediction period, and scale up or down the current number of instance replicas according to the number of target instance replicas.

[0105] In an optional embodiment of the present invention, the second determination module 302 is further configured to: determine a first peak time corresponding to the first peak load that appears within the prediction period;

[0106] The scaling module 303 is further configured to: calculate the number of instance replicas at the first peak time of the prediction period according to the first peak load of the prediction period, and use the calculated number of instance replicas as the number of target instance replicas from the next moment of the current moment to the first peak time of the prediction period.

[0107] In an optional embodiment of the present invention, calculating the number of instance replicas at the first peak time of the prediction period according to the first peak load of the prediction period includes: obtaining the current number of instance replicas and the first peak load of the current period; calculating the number of instance replicas at the first peak time of the prediction period based on the ratio of the current number of instance replicas to the first peak load of the current period and the first peak load of the prediction period.

[0108] In an optional embodiment of the present invention, the device 300 further includes: a repetition module, configured to execute determining the predicted load data for the prediction period by using the load prediction model in response to the current moment being the first peak time of the current period;

[0109] Or,

[0110] In response to the current time reaching the first peak time of the prediction period, taking the first peak time of the prediction period as the current moment, and repeatedly obtaining the predicted load data for the next prediction period for scaling up or down.

[0111] In an alternative embodiment of the present invention, the above-mentioned scaling module 303 is further configured to: compare the number of current instance replicas with the number of target instance replicas; generate a scaling-up command or a scaling-down command based on the comparison result to adjust the number of current instance replicas.

[0112] In an alternative embodiment of the present invention, the generating a scaling-up command or a scaling-down command based on the comparison result to adjust the number of current instance replicas includes: in response to the comparison result indicating that the number of current instance replicas is less than the number of target instance replicas, generating a scaling-down command and performing a scaling-down operation based on the scaling-down command; in response to the comparison result indicating that the number of current instance replicas is greater than the number of target instance replicas, generating a scaling-up command and performing a scaling-up operation based on the scaling-up command.

[0113] In an alternative embodiment of the present invention, the above-mentioned apparatus 300 further includes a data acquisition module, which is configured to monitor the load data of each node; store the load data of each node in a target time series database; and obtain the historical load data from the target time series database.

[0114] It can be seen from the predictive capacity elastic scaling apparatus according to the embodiments of the present invention that, through the multi-step prediction method, the load data of one prediction period is obtained each time, and the load at the first peak within the prediction period is used as the basis for scaling judgment. The number of instance replicas at the first peak load of the prediction period is used to adjust the number of current instance replicas, and the prediction of the load data for the next prediction period is performed again at the first peak moment of the prediction period. Compared with the single-step prediction method that only predicts the next moment each time, the apparatus of the present invention greatly reduces the number of predictions and scalings. At the same time, by using the first peak load as the scaling basis, the resource utilization rate is improved, the waste of resources is reduced, and the number of scalings and the resource utilization rate are balanced.

[0115] Figure 4 An exemplary system architecture 400 is shown to which the predictive capacity elastic scaling method or the predictive capacity elastic scaling apparatus according to the embodiments of the present invention can be applied.

[0116] As Figure 4 shown, the system architecture 400 may include nodes 401, 402, 403 in a Kubernetes cluster, a network 404, and a server 405. The network 404 is used to provide a medium for communication links between the nodes 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0117] For each of the nodes 401, 402, and 403, according to the load data within a preset historical time period before the current moment, a load prediction model is used to determine the predicted load data of the current node within the prediction period, and interact with the server 405 through the network 404 to determine the first peak load when the load peak first appears within the prediction period of each node, etc. Various communication client applications can be installed on the terminal devices 401, 402, and 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0118] The server 405 can be a server that provides various services. For example, according to the predicted load data, determine the first peak load of each of the nodes 401, 402, and 403 within the prediction period, and then determine the number of target instance replicas corresponding to the first peak load of each node's prediction period, and scale the current number of instance replicas of each node up or down according to the number of target instance replicas.

[0119] It should be noted that the predictive capacity elastic scaling method provided by the embodiments of the present invention is generally executed by the server 405. Correspondingly, the predictive capacity elastic scaling device is generally set in the server 405.

[0120] It should be understood that Figure 4 the numbers of the terminal devices, networks, and servers in

[0121] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 5 Shown below with reference to Figure 5 is a schematic structural diagram of a computer system 500 of a terminal device suitable for implementing the embodiments of the present invention.

[0122] As Figure 5 shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage section 508 into the random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.

[0123] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.

[0124] Specifically, according to an embodiment disclosed by the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment disclosed by the present invention includes a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 509, and / or installed from the removable medium 511. When the computer program is executed by a central processing unit (CPU) 501, the above-described functions defined in the system of the present invention are executed.

[0125] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.

[0126] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0127] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a first determination module, a second determination module, and a scaling module. Among them, the names of these modules do not constitute a limitation on the module itself in some cases. For example, the first determination module can also be described as "a module that determines the predicted load data for a prediction period using a load prediction model based on the load data within a preset historical time period before the current moment".

[0128] As another aspect, the present invention also provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: determining the predicted load data for a prediction period using a load prediction model based on the load data within a preset historical time period before the current moment; wherein, the load prediction model is a model trained using historical load data for obtaining predicted load data; determining the first peak load that first appears within the prediction period based on the predicted load data; determining the number of target instance replicas corresponding to the first peak load of the prediction period, and scaling up or down the current number of instance replicas according to the number of target instance replicas.

[0129] According to the technical solution of the embodiments of the present invention, through a multi-step prediction method, the load data for each prediction period is obtained each time, and the load of the first peak within the prediction period is used as the basis for scaling judgment. The number of instance replicas of the first peak load of the prediction period is used to adjust the current number of instance replicas, and the prediction of the load data for the next prediction period is performed again at the first peak moment of the prediction period. Compared with the single-step prediction method that only predicts the next moment each time, the present invention greatly reduces the number of predictions and scalings. At the same time, by using the first peak load as the scaling basis, the resource utilization rate is improved, the waste of resources is reduced, and the balance between the number of scalings and the resource utilization rate is achieved.

[0130] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A predictive capacity elastic scaling method, characterized in that, Including: Based on the load data within a preset historical time period before the current moment, use a load prediction model to determine the predicted load data for the prediction period; wherein, the load prediction model is a model trained using historical load data for obtaining predicted load data; Based on the predicted load data, determine the first peak load that first appears within the prediction period; Determine the target number of instance replicas corresponding to the first peak load of the prediction period, and scale up or scale down the current number of instance replicas according to the target number of instance replicas.

2. The predictive capacity elastic scaling method according to claim 1, wherein The method further includes: Determine the first peak moment corresponding to the first peak load within the prediction period; The determining the target number of instance replicas corresponding to the first peak load of the prediction period includes: Calculate the number of instance replicas at the first peak moment of the prediction period based on the first peak load of the prediction period, and use the calculated number of instance replicas as the target number of instance replicas from the next moment of the current moment to the first peak moment of the prediction period.

3. The predictive capacity elastic scaling method according to claim 2, wherein The calculating the number of instance replicas at the first peak moment of the prediction period based on the first peak load of the prediction period includes: Obtain the current number of instance replicas and the first peak load of the current period; Based on the ratio of the current number of instance replicas to the first peak load of the current period, and the first peak load of the prediction period, calculate the number of instance replicas at the first peak moment of the prediction period.

4. The predictive capacity elastic scaling method according to claim 2, wherein The method further includes at least one of the following: In response to the current moment being the first peak moment of the current period, execute the step of using the load prediction model to determine the predicted load data for the prediction period; In response to the current time reaching the first peak moment of the prediction period, use the first peak moment of the prediction period as the current moment, and repeatedly obtain the predicted load data for the next prediction period for scaling up or scaling down.

5. The predictive capacity elastic scaling method according to claim 3, wherein The scaling up or scaling down the current number of instance replicas according to the target number of instance replicas includes: Compare the current number of instance replicas with the target number of instance replicas; Based on the comparison result, generate a scale-up command or a scale-down command to adjust the current number of instance replicas.

6. The predictive capacity elastic scaling method according to claim 5, wherein The generating a scale-up command or a scale-down command based on the comparison result to adjust the current number of instance replicas includes: In response to the comparison result indicating that the current number of instance replicas is less than the target number of instance replicas, generate a scale-down command, and perform a scale-down operation based on the scale-down command; In response to the comparison result indicating that the current number of instance replicas is greater than the target number of instance replicas, generate a scale-up command, and perform a scale-up operation based on the scale-up command.

7. The predictive capacity elastic scaling method according to claim 1, wherein The method for obtaining the historical load data includes: Monitor the load data of each node; Store the load data of each node in a target time series database; Obtain the historical load data from the target time series database.

8. A predictive capacity elastic scaling device, characterized in that Including: A first determination module, configured to determine predicted load data for a prediction period by using a load prediction model based on load data within a preset historical time period before the current moment; wherein, the load prediction model is a model trained by using historical load data and used to obtain predicted load data; A second determination module, configured to determine a first peak load that first appears within the prediction period based on the predicted load data; A scaling module, configured to determine a target instance replica number corresponding to the first peak load in the prediction period, and scale up or scale down the current instance replica number according to the target instance replica number.

9. An electronic device for predictive capacity elastic scaling, characterized in that, Comprising: One or more processors; A storage device, configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-7.

10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-7 is implemented.

Citation Information

Cited By

  • Resource capacity expansion and contraction method and system

    CN120896866A