System cluster capacity expansion and contraction processing method, device, equipment, medium and product
By fitting and adjusting the predicted value of the historical token data of the system cluster, determining the final predicted value based on the actual value sequence, dynamically performing the scaling operation, and using the unwake-up silent replica of the server to quickly respond to traffic changes, the traditional solution is solved The problem of low prediction accuracy and waste of resources has achieved more efficient server resource management and business reliability.
Patent Information
- Application Number
- CN202411346842.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-10
AI Technical Summary
During the dynamic scaling process of traditional system clusters, due to the low traffic prediction accuracy, it is difficult to accurately adjust the number of server replicas, waste of resources or unavailable services.
By fitting predicted values based on historical token data, adjust the predicted values to improve accuracy, and determine the final predicted values based on the actual value sequence, dynamically perform scaling operations, retaining unwake-up silent copies of the server to quickly respond to traffic change.
It improves the prediction accuracy of the system cluster in dynamic scaling capacity, ensures that the number of server replicas meets actual needs, reduces resource waste, and improves system response speed and business reliability.
Smart Images

Figure CN119292775A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of Internet of Things, and in particular, relates to a system cluster expansion and contraction processing method, device, equipment, medium and product. Background Art
[0002] The system cluster includes multiple servers, and different servers are used to provide different services. In order to meet usage requirements, the system cluster will replicate servers to establish server copies to respond to more service requests. In actual applications, the number of service requests in different token cycles is different. Too many server copies will lead to waste of resources, and too few server copies cannot guarantee the normal operation of the business. Therefore, the system cluster needs to dynamically expand and shrink the servers that provide corresponding services, that is, add and delete server copies.
[0003] At present, the traffic data of the target period is usually predicted through historical traffic, and dynamic expansion and contraction is completed based on the predicted traffic data. However, traffic data fluctuates, and the predicted value is inevitably different from the actual value. In addition, it is easy to cause errors in judgment due to the influence of large traffic data, which shows that the prediction accuracy of traditional solutions is limited, resulting in expansion and contraction operations that do not meet actual needs. Summary of the invention
[0004] The embodiments of the present application provide a system cluster expansion and contraction processing method, device, equipment, medium and product, which can improve prediction accuracy, so that the expansion and contraction operations meet actual needs.
[0005] On the one hand, an embodiment of the present application provides a system cluster expansion and contraction processing method, including:
[0006] Predicting the number of requests for a target service in a next token cycle based on historical token data of the system cluster to obtain a first prediction value;
[0007] Obtain a predicted value sequence and an actual value sequence of the number of requests for the target service for multiple historical token cycles;
[0008] Based on the actual value sequence, the predicted value sequence is fitted to obtain a fitting cost function;
[0009] Based on the fitting cost function, adjusting the first prediction value to obtain a second prediction value of the number of requests for the target service in the next token cycle;
[0010] Determine a final predicted value of the number of requests for the target service in a next token cycle based on the second predicted value and a first actual value of the number of requests for the target service in a previous token cycle;
[0011] Based on the difference between the final prediction value and the number of requests for the target service that the system cluster can currently bear, a capacity expansion operation or a capacity reduction operation is performed on the system cluster.
[0012] On the other hand, the system cluster reserves at least a preset number of server silent copies for each server inside; the server silent copies are server copies that have not been awakened;
[0013] After determining a final predicted value of the number of requests for the target service in a next token cycle based on the second predicted value and the first actual value of the number of requests for the target service in a previous token cycle, the method further includes:
[0014] When the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, the silent copy of the server is awakened to provide the target service.
[0015] On the other hand, performing a capacity expansion operation or a capacity reduction operation on the system cluster based on a difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster includes:
[0016] When the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, performing a capacity expansion operation;
[0017] When the final predicted value is less than the number of requests for the target service that can be currently carried by the system cluster, a scaling-down operation is performed.
[0018] On the other hand, when the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, performing a capacity expansion operation includes:
[0019] Determine a first number of the server replicas currently lacking based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server replica can carry;
[0020] When the first number is not zero, comparing the first number with the number of silent copies of the server;
[0021] When the number of silent copies of the server is not less than the first number, waking up the first number of silent copies of the server;
[0022] When the number of silent replicas of the server is greater than the first number, performing the following operations:
[0023] awakening all silent copies of the server;
[0024] Obtain a first difference between the number of silent replicas of the server and the first number;
[0025] Obtaining the sum of the first difference and the preset number to obtain a target number;
[0026] Copy the target number of server copies; wake up the first difference number of server copies.
[0027] On the other hand, determining the first number of the server replicas currently lacking based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server replica can carry includes:
[0028] Obtaining a second difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster;
[0029] The first number is determined based on the second difference and the number of requests for the target service that can be handled by a single server or a server replica.
[0030] On the other hand, when the final predicted value is less than the number of requests for the target service that can be currently carried by the system cluster, performing a scaling-down operation includes:
[0031] When the number of silent copies of the server is greater than the preset number, the silent copies of the server are cleared according to preset rules.
[0032] On the other hand, when the number of silent copies of the server is greater than the preset number, clearing the silent copies of the server according to a preset rule includes:
[0033] Reading the status of each of the server silent copies;
[0034] Determining a second number of silent replicas of the server that have not been used within a preset time period;
[0035] determining a third difference between the number of silent replicas of the server and the second number;
[0036] When the third difference is greater than the preset number, clearing all server silent copies that have not been used within the preset time period;
[0037] When the third difference is not greater than the preset number, some of the server silent copies that have not been used within the preset time period are cleared to retain the preset number of server silent copies.
[0038] On the other hand, the fitting cost function includes a weight matrix;
[0039] The adjusting the first prediction value based on the fitting cost function to obtain a second prediction value of the number of requests for the target service in the next token cycle includes:
[0040] Initializing the weight matrix;
[0041] For the matrix parameters at each position of the weight matrix, the following operations are performed respectively until the final weight matrix is obtained: taking the first matrix parameter as a variable parameter and the second matrix parameter as a constant, solving the parameter value of the first matrix parameter; the first matrix parameter is the matrix parameter at any position of the weight matrix, and the second matrix parameter is the remaining matrix parameters in the weight matrix except the first matrix parameter;
[0042] Based on the solved weight matrix, the first prediction value is adjusted to obtain the second prediction value.
[0043] On the other hand, determining a final predicted value of the number of requests for the target service in a next token cycle based on the second predicted value and a first actual value of the number of requests for the target service in a previous token cycle includes:
[0044] Obtaining a weight coefficient; the weight coefficient represents the weight of each of the second predicted value and the first actual value when determining the final predicted value;
[0045] The final predicted value is determined based on the weight coefficient, the second predicted value and the first actual value.
[0046] On the other hand, the historical token data includes a service name, a number of token uses, a total number of token issuances, and a number of request discards;
[0047] The step of predicting the number of requests for a target service in a next token cycle based on the historical token data of the system cluster to obtain a first prediction value includes:
[0048] Collect the service name, the number of tokens used, the total number of tokens issued, and the number of requests discarded in the gateway log information;
[0049] The first prediction value is predicted based on the service name, the number of token uses, the total number of token issuances, and the number of discarded requests.
[0050] On the other hand, an embodiment of the present application provides a system cluster expansion and contraction processing device, including:
[0051] A prediction module, configured to predict the number of requests for a target service in a next token cycle based on historical token data of the system cluster, and obtain a first prediction value;
[0052] An acquisition module, used for acquiring a predicted value sequence and an actual value sequence of the number of requests for the target service for a plurality of historical token cycles;
[0053] A fitting module, used for fitting the predicted value sequence based on the actual value sequence to obtain a fitting cost function;
[0054] An adjustment module, configured to adjust the first prediction value based on the fitting cost function to obtain a second prediction value of the number of requests for the target service in a next token cycle;
[0055] a determination module, configured to determine a final prediction value of the number of requests for the target service in a next token cycle based on the second prediction value and a first actual value of the number of requests for the target service in a previous token cycle;
[0056] An execution module is used to perform a capacity expansion operation or a capacity reduction operation on the system cluster based on a difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster.
[0057] In another aspect, an embodiment of the present application provides a system cluster expansion and contraction processing device, comprising: a processor and a memory storing computer program instructions;
[0058] When the processor executes the computer program instructions, the system cluster expansion and contraction processing method as described above is implemented.
[0059] On the other hand, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the system cluster expansion and contraction processing method as described above is implemented.
[0060] On the other hand, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the system cluster expansion and contraction processing method as described above.
[0061] A system cluster expansion and contraction processing method according to an embodiment of the present application is to fit a predicted value sequence based on an actual value sequence to adjust a first predicted value, and then determine a final predicted value based on a second predicted value and a first actual value, and then perform an expansion operation or a contraction operation on the system cluster based on the final predicted value. The embodiment of the present application avoids errors caused by large traffic data by predicting the number of requests for the target service. After the embodiment of the present application performs the first prediction to obtain the first predicted value, the predicted value sequence is also fitted by the actual value sequence to obtain a fitting cost function. The fitting cost function can characterize the difference between the actual value sequence and the predicted value sequence, so the first predicted value is adjusted by the fitting cost function, thereby further improving the accuracy of the predicted value. In addition, when determining the final predicted value, the first actual value is also referred to to ensure the reliability of the final predicted value. It can be seen that the final predicted value obtained by this scheme has a high accuracy, thereby ensuring that the expansion and contraction operation meets actual needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0063] Figure 1 A schematic diagram of a process flow of a system cluster expansion and contraction processing method provided by an embodiment of the present application is shown;
[0064] Figure 2 A schematic diagram of a system cluster framework provided in an embodiment of the present application;
[0065] Figure 3 A schematic diagram of interaction logic between a real-time processing module and a deep learning module provided in an embodiment of the present application;
[0066] Figure 4 A schematic diagram of a predicted value sequence and an actual value sequence provided in an embodiment of the present application;
[0067] Figure 5 A capacity expansion flow chart provided for an embodiment of the present application;
[0068] Figure 6 A schematic diagram of the structure of a system cluster expansion and contraction processing device provided in an embodiment of the present application is shown;
[0069] Figure 7 A schematic diagram of the hardware structure of a system cluster expansion and contraction processing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0070] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0071] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "include..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0072] The system cluster includes multiple servers, and different servers are used to provide different services. In order to cope with the changing number of service requests, it is necessary to scale the server, that is, add or reduce the corresponding server replicas.
[0073] In order to solve the problems of the traditional solution, the embodiment of the present application provides a system cluster expansion and contraction processing method, device, equipment, medium and product. The system cluster expansion and contraction processing method provided by the embodiment of the present application is first introduced below. Figure 1 FIG. 1 is a flow chart showing a method for processing system cluster expansion and contraction provided by an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:
[0074] S101: Predicting the number of requests for a target service in a next token cycle based on historical token data of a system cluster to obtain a first prediction value.
[0075] In actual applications, in order to avoid a sudden overload of data that causes the entire server to crash, a token bucket algorithm can be used for current limiting. Set an upper limit on the number of service requests that a single server or server replica can handle each time. When limiting the current, limit it based on the server dimension. Each server or server replica has a number of tokens that can be called. One service request corresponds to one token. After the token is used up, the remaining requests are discarded. Usually, servers and server replicas that provide the same service can handle the same number of requests.
[0076] Tokens are generated at fixed time intervals, and the interval between two time intervals is a token cycle. The number of generated tokens is dynamically adjusted. Before generation, the number of requests for the target service that the entire system cluster can withstand is read, and the corresponding number of tokens is generated. When a service request comes in, a token is sent to it until all tokens are used up.
[0077] The number of requests for the target service that the entire system cluster can withstand is determined based on the number of corresponding server copies. Generally, a single server and corresponding multiple server copies provide the target service. The more server copies there are, the more requests can be sustained. If the number of server copies is too large, it will lead to a waste of resources. If the number of server copies is too small, it will lead to the inability to complete the service normally. Therefore, the number of server copies needs to be kept within a reasonable range.
[0078] In actual application, the number of requests for the target service varies with different token cycles, so it is necessary to adjust the number of server copies in real time, that is, to scale up or down. In order to make the scaling operation conform to the actual situation, it is necessary to predict the number of requests for the target service in the next token cycle. The specific prediction method is not limited here. The service name, number of tokens used, total number of tokens issued, and number of requests discarded in the historical token cycle can be obtained for prediction to obtain the first prediction value.
[0079] However, the first predicted value obtained by the above scheme may be biased, which may lead to unreasonable expansion and contraction operations. Therefore, the first predicted value needs to be adjusted to make it closer to the actual value.
[0080] S102: Obtain a predicted value sequence and an actual value sequence of the number of requests for a target service in multiple historical token cycles.
[0081] In practical applications, there is a deviation between the predicted value and the actual value. In order to make the prediction result more accurate, the first predicted value needs to be adjusted. In this embodiment, the difference between the predicted value and the actual value is found by fitting a function, and then the first predicted value is adjusted.
[0082] In each historical token cycle, there is a number of requests corresponding to the target service, and the number of requests has an actual value and a predicted value. This embodiment obtains a predicted value sequence and an actual value sequence of multiple historical token cycles as the data basis for fitting.
[0083] The multiple historical token periods corresponding to the predicted value sequence and the actual value sequence are usually N consecutive historical token periods before the current moment, where N is a positive integer. The lengths of the predicted value sequence and the actual value sequence are generally the same, and the specific lengths of the two (i.e., the value of N) are not limited and are set according to actual needs.
[0084] S103: Based on the actual value sequence, the predicted value sequence is fitted to obtain a fitting cost function.
[0085] In this embodiment, the predicted value sequence is fitted by the actual value sequence, and the difference between the actual value sequence and the predicted value sequence can be characterized by the fitting cost function. The specific fitting process is not limited here and can be determined according to actual conditions.
[0086] S104: Based on the fitting cost function, adjust the first prediction value to obtain a second prediction value of the number of requests for the target service in the next token period.
[0087] After obtaining the fitting cost function, the corresponding adjustment parameter (such as the weight matrix) can be solved based on the fitting cost function, and then the first predicted value can be adjusted according to the adjustment parameter so that the obtained second predicted value is closer to the actual value.
[0088] S105: Determine a final predicted value of the number of requests for the target service in a next token period based on the second predicted value and a first actual value of the number of requests for the target service in a previous token period.
[0089] In practical applications, in order to avoid the situation where the predicted value deviates too much from the actual value, the embodiment of the present application also considers the first actual value of the number of requests for the target service in the previous token cycle when predicting. That is, based on the second predicted value and the first actual value of the number of requests for the target service in the previous token cycle, the final predicted value of the number of requests for the target service in the next token cycle is determined, so that the final predicted value is more reasonable.
[0090] S106: Based on the difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster, perform an expansion operation or a reduction operation on the system cluster.
[0091] After obtaining the final prediction value, it is necessary to determine the difference between the final prediction value and the number of requests for the target service that the system cluster can currently carry, that is, whether the number of requests for the target service that the system cluster can currently carry can cope with the number of service requests in the next token cycle. Then it is known whether the number of corresponding server replicas is appropriate. If adjustment is required, it should be added (expanded) or reduced (reduced).
[0092] A method for processing expansion and contraction of a system cluster in an embodiment of the present application first fits the predicted value sequence based on the actual value sequence to adjust the first predicted value, then determines the final predicted value based on the second predicted value and the first actual value, and then performs expansion or contraction operations on the system cluster based on the final predicted value. The embodiment of the present application avoids errors caused by large traffic data by predicting the number of requests for the target service. After the embodiment of the present application performs the first prediction to obtain the first predicted value, the predicted value sequence is also fitted by the actual value sequence to obtain a fitting cost function. The fitting cost function can characterize the difference between the actual value sequence and the predicted value sequence, so the first predicted value is adjusted by the fitting cost function, thereby further improving the accuracy of the predicted value. In addition, when determining the final predicted value, the first actual value is also referred to to ensure the reliability of the final predicted value. It can be seen that the final predicted value obtained by this scheme has a high accuracy, thereby ensuring that the expansion and contraction operations meet actual needs.
[0093] In actual applications, the number of service requests changes at any time. If the number of service requests in the next token cycle increases, causing the current server copy of the system cluster to be unable to meet usage needs, a new server copy needs to be enabled. However, the server copy provides services and needs to copy the corresponding server before it can be enabled. The copying process takes a long time, resulting in a slow response of the system cluster.
[0094] Therefore, an embodiment of the present application provides a solution, whereby the system cluster retains at least a preset number of server silent copies corresponding to each server inside; the server silent copies are server copies that have not been awakened.
[0095] Because the embodiment of the present application retains a preset number of server silent copies for any server, after determining the final prediction value of the number of requests for the target service in the next token cycle based on the second prediction value and the first actual value of the number of requests for the target service in the previous token cycle, if the final prediction value is greater than the number of requests for the target service that the system cluster can currently carry, the server silent copy can be awakened first to provide the target service.
[0096] That is, in the solution proposed in the embodiment of the present application, for any server in the system cluster, in addition to the server copy currently in use, an unused server silent copy is also reserved as a backup server copy. When the number of service requests increases suddenly, the server silent copy is directly awakened to provide services, saving the copy process and thus improving the response speed.
[0097] It should be noted that in the embodiment of the present application, there is no limitation on the specific value of the preset number, which can be set according to actual needs and can be set to 1.
[0098] By retaining the silent copy of the server, the embodiment of the present application can directly wake up the silent copy of the server to provide services when the number of service requests increases suddenly, avoiding the problem of time-consuming re-copying of the server copy, and ensuring that there are services in use in the system cluster at any time. By enabling the silent copy of the server, a quick response can be achieved, thereby ensuring that the task is completed normally.
[0099] The above embodiment mentions that it is necessary to perform an expansion operation or a reduction operation on the system cluster based on the difference between the final prediction value and the number of requests for the target service that the system cluster can currently carry, but the specific determination method is not limited in actual application. For example, if the difference between the final prediction value and the number of requests for the target service that the system cluster can currently carry exceeds a threshold, then the corresponding operation is selected to be performed.
[0100] The embodiment of the present application provides a specific implementation scheme. When the final prediction value is greater than the number of requests for the target service that the system cluster can currently carry, an expansion operation is performed. When the final prediction value is less than the number of requests for the target service that the system cluster can currently carry, a reduction operation is performed.
[0101] By comparing the final predicted value with the current load-bearing capacity of the system cluster, the embodiment of the present application can preliminarily determine whether the capacity should be expanded or reduced, thereby executing corresponding operations to ensure that the number of server copies of the system cluster meets actual usage requirements.
[0102] The above embodiment mentions that when the final predicted value is greater than the number of requests for the target service that the system cluster can currently carry, a capacity expansion operation is required. However, in the specific implementation process, the specific processing process of the capacity expansion operation needs to be determined according to the actual situation.
[0103] An embodiment of the present application provides a solution to first determine the first number of server copies currently missing based on a final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server copy can carry.
[0104] The first number indicates how many server copies are currently missing, and the corresponding capacity expansion operation needs to be performed according to the value of the first number. If the first number is zero, it indicates that capacity expansion is not required at this time, and no processing is performed.
[0105] When the first number is not zero, capacity expansion is required, and the first number and the number of silent copies of the server are compared.
[0106] In the case where the number of silent copies of the server is not less than the first number, it indicates that the use demand can be met by waking up the silent copies of the server at this time, so the first number of silent copies of the server are woken up. However, it should be noted that, as mentioned above, in some embodiments, the system cluster retains at least a preset number of silent copies of the server for each internal server. Therefore, after waking up the first number of silent copies of the server, if the number of silent copies of the server is less than the preset number, it is necessary to copy a new server copy as the silent copy of the server to ensure that there are at least a preset number of silent copies of the server corresponding to the servers in the system cluster.
[0107] In the case where the number of silent server copies is greater than the first number, waking up only the silent server copies cannot meet the demand. At this time, the following operations are performed: first wake up all silent server copies to try to meet business needs. Then, obtain the first difference between the number of silent server copies and the first number, that is, determine the number of server copies that are still missing after waking up all silent server copies (that is, the first difference). Then obtain the sum of the first difference and the preset number to obtain the target number, because in addition to the enabled server copies, a preset number of silent server copies need to be retained, so the target number of server copies need to be copied. Finally, wake up the server copies of the first difference number, and the remaining preset number of server copies are used as silent server copies.
[0108] The solution proposed in the embodiment of the present application is to give priority to waking up the silent copy of the server when the number of service requests that the system cluster can bear is insufficient, so as to achieve rapid response and try to ensure the normal completion of the task. It also chooses whether to copy a new server copy according to the situation to avoid resource waste and ensure the normal operation of the business.
[0109] The above embodiment mentions that the first number of currently missing server replicas is determined based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server replica can carry. In actual application, the specific calculation process is not required.
[0110] The embodiment of the present application provides a specific calculation method, first obtaining a second difference between the final prediction value and the number of requests for the target service that the system cluster can currently carry, and then determining the first number based on the second difference and the number of requests for the target service that a single server or server replica can carry. The second difference represents the number of requests that require additional server replicas to provide services, and the second difference is divided by the number of requests for the target service that a single server or server replica can carry, to obtain the first number of server replicas that are currently missing.
[0111] When determining the number of requests for the target service that the system cluster can currently carry, you can first determine the sum of the number of servers and server replicas, and then multiply this sum by the number of requests for the target service that a single server or server replica can carry, to get the number of requests for the target service that the system cluster can currently carry.
[0112] The embodiment of the present application provides a specific calculation method for the first quantity, which can accurately calculate the number of server copies currently missing.
[0113] The above embodiment mentions that when the final predicted value is less than the number of requests for the target service that the system cluster can currently bear, a scaling-down operation is required, and the specific scaling-down operation can be selected according to the actual situation.
[0114] The embodiment of the present application provides a solution, when the number of silent copies of the server is greater than a preset number, the silent copies of the server are cleared according to a preset rule. When the number of silent copies of the server is equal to the preset number, no operation is required, and when the number of silent copies of the server is less than the preset number, a corresponding number of server copies need to be copied to ensure that at least the preset number of silent copies of the server exists.
[0115] In the embodiment of the present application, when the number of service requests that the system cluster can bear is relatively large, the number of silent server copies is first determined. If the number of silent server copies is sufficient, they are cleared according to the prediction rules, thereby ensuring that a sufficient number of silent server copies are retained in the system cluster.
[0116] The embodiment of the present application provides a specific solution for clearing silent copies of a server according to a preset rule, including:
[0117] First, the status of each server silent copy is read; for example, the time when each server silent copy was last used, the current time, and the length of time from the last use of the server silent copy to the current time, etc.
[0118] Then, a second number of server silent copies that have not been used within a preset time period is determined, and a third difference between the number of server silent copies and the second number is determined. The server silent copies that have not been used within the preset time period are server silent copies that can be cleared, and since a preset number of server silent copies need to be retained, the third difference is first calculated to be the number of server silent copies that have been used for the preset time period.
[0119] Then, when the third difference is greater than the preset number, all server silent copies that have not been used within the preset time are cleared. Because the third difference is greater than the preset number, even if all server silent copies that have not been used within the preset time are cleared, at least the preset number of server silent copies are retained.
[0120] When the third difference is not greater than a preset number, only some of the server silent copies that have not been used within a preset time period are cleared to retain a preset number of server silent copies.
[0121] In the process of clearing server copies, the embodiment of the present application not only considers retaining a sufficient number of silent server copies, but also only clears silent server copies that have not been used within a preset period of time, thereby avoiding too frequent scaling operations.
[0122] The above embodiment mentioned that it is necessary to adjust the first prediction value based on the fitting cost function to obtain the second prediction value of the number of requests for the target service in the next token cycle, and the specific adjustment process can be determined according to the actual situation. The embodiment of the present application provides a solution, specifically adjusting the first prediction value through a weight matrix. That is, the fitting cost function includes a weight matrix, and the weight matrix is initialized before adjusting the first prediction value.
[0123] Then, for the matrix parameters at each position of the weight matrix, the following operations are performed respectively until the final weight matrix is solved: the first matrix parameter is taken as a variable parameter and the second matrix parameter is taken as a constant to solve the parameter value of the first matrix parameter; the first matrix parameter is the matrix parameter at any position of the weight matrix, and the second matrix parameter is the remaining matrix parameters in the weight matrix except the first matrix parameter.
[0124] Finally, based on the weight matrix obtained by solving, the first prediction value is adjusted to obtain the second prediction value. In specific implementation, the weight matrix can be multiplied by the first prediction value, and the obtained value is the second prediction value.
[0125] The embodiment of the present application adopts the coordinate sinking method to solve the weight matrix by fitting the cost function, which can quickly solve and obtain an accurate weight matrix, thereby achieving adjustment of the first prediction value and improving the prediction accuracy.
[0126] In actual applications, there may still be a difference between the predicted second predicted value and the actual value. If the deviation is too large, it will lead to unnecessary expansion and contraction operations. Therefore, when determining the final predicted value, the first actual value of the number of requests for the target service in the previous token cycle can be referred to. That is, based on the second predicted value and the first actual value of the number of requests for the target service in the previous token cycle, the final predicted value of the number of requests for the target service in the next token cycle is determined.
[0127] The embodiment of the present application provides a specific implementation scheme, first obtaining a weight coefficient, and then determining a final prediction value based on the weight coefficient, the second prediction value and the first actual value. The weight coefficient represents the weight of the second prediction value and the first actual value when determining the final prediction value.
[0128] In practical applications, the obtained second prediction value may still have deviations. When determining the final prediction value, the embodiment of the present application takes the number of requests for the target service in the previous token cycle as a factor to improve the reliability of the final prediction value.
[0129] In a specific implementation, the specific content of the historical token data is selected according to the actual situation, for example, it may include the service name, the number of tokens used, the total number of tokens issued, and the number of requests discarded. Based on the historical token data of the system cluster, the number of requests for the target service in the next token cycle is predicted to obtain a first prediction value, including:
[0130] The service name, the number of tokens used, the total number of tokens issued, and the number of discarded requests in the gateway log information are collected, and a first prediction value is predicted based on the service name, the number of tokens used, the total number of tokens issued, and the number of discarded requests.
[0131] The embodiment of the present application can more accurately predict the number of requests for the target service through the service name, the number of tokens used, the total number of tokens issued, and the number of requests discarded.
[0132] The solution proposed in the embodiment of the present application is described below in a specific implementation manner. First, a specific system cluster framework of the solution is described. Figure 2 A schematic diagram of a system cluster framework provided in an embodiment of the present application. Figure 2 As shown, it includes a server 201, a server replica 202, a gateway 204, an information collection module 205, an analysis and prediction device 206, and an integration and processing device 207. The server 201 and the server replica 202 form a server cluster 203.
[0133] Data is collected through the gateway 204 and the information collection module 205 and sent to the analysis and prediction device 206 for analysis and prediction. Then, based on the analysis results, the integration processing device 207 adds or reduces the server replicas 202 in the server cluster 203.
[0134] The gateway 204 needs to use the token bucket algorithm to limit the flow. When limiting the flow, the server 201 is used as the dimension for limiting, and the flow limiting information is processed as log information. Dynamic reading of token data in the server 201 is supported, and the number of tokens of the server is read from the message middleware redis.
[0135] The server cluster 203 is a business module cluster, such as microservice programs such as user management UserManage and product management ProductManage.
[0136] The information collection module 205 is based on the open source software Flink and collects data into the analysis and prediction device 206 and the integration and processing device 207.
[0137] The integrated processing device 207 is divided into two parts: a real-time processing module and a deep learning calculation module. Figure 3 A schematic diagram of the interaction logic between a real-time processing module and a deep learning module provided in an embodiment of the present application. It should be noted that: Figure 3 This is only an example of one of the expansion and contraction solutions in the embodiment of the present application, and does not limit other solutions. Figure 3 As shown, the following steps are included:
[0138] S301: Set a threshold Threshold for each service request, obtain the number of tokens M, the number of discarded requests num, and the total number of requests totalNum.
[0139] S302: Compare the number of requests predicted last time with the number of requests this time, and adjust the weight parameter K.
[0140] S303: Predict the next time request quantity PRE_NUM and retrieve the dynamically adjusted weight parameter K.
[0141] S304: Calculate the expected number PRE_ACE_NUM at the next moment according to (1-K)totalNum+K*PRE_NUM.
[0142] S305: Determine whether PRE_ACE_NUM>SERVICENUM*THRESHOLD is established. If so, proceed to S109; if not, proceed to S106.
[0143] S306: Entering the capacity reduction phase.
[0144] S307: Calculate (SERVICENUM*THRESHOLD-PRE_ACE_NUM) / THREASHOLD and round the value.
[0145] S308: According to the value, select the number of services to be disabled and ensure the number of silent copies of the server.
[0146] S309: Entering the capacity expansion phase.
[0147] S310: Calculate (PRE_ACE_NUM-SERVICENUM*THRESHOLD) / THREASHOLD and round the value.
[0148] S311: According to the value, the server data packet is copied, the server copy is started and registered with the registration center, and the gateway adds the server copy.
[0149] S312: Modify the request processing upper limit of the server in the message middleware and update the number of tokens.
[0150] The deep learning module uses the time-series-based Autoformer algorithm for calculation, uses the ElasticNet regression model to process the prediction weight K, adjusts the overall prediction value of the application output, and uses dynamic fitting to adjust the weight between the prediction value and the actual value, so that the difference between the prediction value and the actual value of the system is smaller, the prediction is more accurate, and the difference between the prediction value and the actual value is reduced.
[0151] Assuming the preset number is 1, the detailed processing steps of the entire expansion and contraction system are shown in STEP 1 to STEP 10:
[0152] STEP 1: The gateway reads the token number of each server in the message middleware redis, initializes the token, and prevents the server from crashing due to a sudden increase in traffic; all servers save a replica application of the started service that has not received any requests (that is, a silent replica of the server), and the system cluster should try to ensure that there is at least one silent replica.
[0153] STEP 2: When a token cycle (usually 1 second) is completed, the gateway spits out information such as service name, number of tokens used, total number of tokens issued, and number of discarded requests in log form.
[0154] STEP 3: Use Flink to collect log information in the gateway, clean and remove dirty data and error information, and only obtain the service name, number of tokens used, total number of tokens issued, number of discarded requests, and time counted at the end of the token cycle.
[0155] STEP4: Use the Autoformer model to predict the number of requests for each service in the next token cycle, that is, the first predicted value NUM AUTO .
[0156] STEP5: Get the predicted value sequence of multiple historical token periods {NUM AUTO1 ,NUM AUTO2 ,NUM AUTO3 ,NUM AUTO4 ,…NUM AUTOn} and the actual value sequence {NUM ACT1 ,NUM ACT2 ,NUM ACT3 ,NUM ACT4 …NUM ACTn}, and perform function fitting based on the predicted value sequence and the actual value sequence.
[0157] Figure 4 A schematic diagram of a predicted value sequence and an actual value sequence provided in an embodiment of the present application; Figure 4 As shown, there is a difference between the predicted value sequence and the actual value sequence. Now it is necessary to perform a fitting operation on the predicted value sequence according to the actual value sequence to obtain the difference, thereby obtaining a weight matrix for adjusting the first predicted value.
[0158] The formula for transforming the fitted cost function into the weight matrix is as follows:
[0159]
[0160] Cost(w) is the cost of fitting, y i is the actual value, x i is the predicted value, λ, ρ are the penalty control parameters. t is the transpose of the weight matrix, ||w||1 is the result after the first coordinate descent, This is the result of the second coordinate descent. After the coordinate descent obtains the corresponding number of results, they are accumulated sequentially.
[0161] When i =w t x i When the predicted value x (i) and the actual value y (i) The gap is the smallest and the predicted value is the most accurate.
[0162] After deformation, the size of the weight matrix w is:
[0163]
[0164] argwmin represents the value of w when the function value is the smallest. The value of the weight matrix w is solved using the coordinate sinking method. The optimization steps are as follows:
[0165] Initialize the weight matrix w;
[0166] Traverse the matrix parameters at each position in the weight matrix w, set one of the matrix parameters as a variable parameter in turn, fix the other matrix parameters as constants, and find the optimal solution for the current matrix parameter.
[0167] According to the formula of w, iterate and optimize multiple times. When the matrix parameters are basically stable or the number of iterations reaches the maximum value, the iteration ends and the final weight matrix w is obtained.
[0168] STEP6: Follow X 预 =w*x is calculated, where x is the first predicted value NUM AUTO , the model derives the second predicted value X 预 .
[0169] STEP7: Read whether K is configured. K is the weight coefficient for selecting the estimated value or the actual value. If K is configured, then X 终预 =Ky i +(1-K)X 预 If K is not configured, then the number of tokens with X in the previous token cycle is calculated. i =K*y i-1 +(1-K)*x i预 ,therefore After transformation, the final program calculation value can be obtained
[0170] STEP 8: Compare X 终预 and NUM service *THRESHOLD service . NUM service The number of servers and server replicas started, THRESHOLD service is the number of requests that the server and its replicas can handle. 终预 >NUM service *THRESHOLD service Then the system service enters the expansion phase. If X 终预 <NUM service *THRESHOLD service The service of the system then enters the scaling-down phase.
[0171] STEP9: The following describes the plan for entering the capacity expansion phase. Figure 5 The expansion flow chart provided in the embodiment of the present application; Figure 5 As shown, the following steps are included:
[0172] S501: Calculate the number of missing server replicas.
[0173] S502: Determine whether the missing quantity is zero, if so, end, if not, enter S503.
[0174] S503: Is NUM silence > CNTservice established? If so, proceed to S504; if not, proceed to S506.
[0175] S504: Wake up the silent copies of CNTservice.
[0176] S505: Update the number of tokens.
[0177] S506: Wake up all silent copies.
[0178] S507: Update the number of tokens.
[0179] S508: Copy the redundant required copies.
[0180] S509: Startup is completed, one copy is set as a silent copy, and other copies are connected.
[0181] S510: Update the number of tokens again.
[0182] If you enter the expansion phase, calculate the number of missing server replicas:
[0183]
[0184] And round the value, if CNT service =0, then no expansion is performed temporarily, otherwise, compare the number of silent copies NUM 静默 and CNT service , if NUM 静默 >CNT service , then the CNT service The replicas are woken up and connected, and the number of tokens for this service in redis is updated to (NUM service +NUM 静默 )*THRESHOLD service .
[0185] If NUM 静默 ≤CNT service , then first connect all silent copies and update the number of tokens for this service in the system to (NUM service +NUM 静默 )*THRESHOLD service and copy CNT using the command 新增 =CNT service -NUM 静默+1 copy, and start the server copy. After the server copy is started, CNT 新增 -1 server replica is connected, and the number of tokens that can be issued by this service in redis is updated to (NUM service +CNT 新增 )*THRESHOLD service , the remaining 1 service replica is a silent replica, and the system expansion is completed.
[0186] STEP10: If the scaling-down phase is entered, first determine whether the server is a server plus a silent replica. If so, do not perform any operation. Otherwise, read the status of the silent replica and clear the number NUM of silent replicas that have not been used within the preset time (such as 3 minutes). 静默3 , determine the difference between NUM 静默3 The number of silent copies remaining. If the number of silent copies remaining is 0, then NUM 处理 =NUM 静默3 -1, otherwise NUM 处理 =NUM 静默3 , update the number of tokens that can be issued to this service in redis (NUM service -NUM 处理 )*THRESHOLD service , clean up NUM 处理 All copies of the system are scaled down.
[0187] When facing sudden traffic, the solution of the embodiment of the present application first uses tokens to defend against excessive traffic influx that may cause server crashes, and then responds quickly to quickly expand services. It can achieve partial capacity expansion in seconds and complete the expansion of the entire cluster within half a minute (depending on the service startup time).
[0188] The number of application services is dynamically adjusted using information such as tokens and the number of service requests. The response speed of scaling can be controlled to the minute level, reducing the waste of server resources and enhancing the system's ability to respond to burst traffic. The use of deep learning algorithms and dynamic weight adjustment methods further ensures the accuracy of the predicted data. Based on the scaling of application services, small changes in seconds (request increments less than 2000 times / second) can be expanded, and large changes in minutes (request increments greater than 2000 times / second) can be expanded.
[0189] In order to solve the above technical problems, the present application also provides a system cluster expansion and contraction processing device. Figure 6 The schematic diagram of the structure of the system cluster expansion and contraction processing device provided in the embodiment of the present application is shown. Figure 6 As shown, the device includes the following modules:
[0190] A prediction module 601 is used to predict the number of requests for a target service in a next token cycle based on historical token data of the system cluster to obtain a first prediction value;
[0191] An acquisition module 602 is used to acquire a predicted value sequence and an actual value sequence of the number of requests for a target service of multiple historical token cycles;
[0192] A fitting module 603 is used to fit the predicted value sequence based on the actual value sequence to obtain a fitting cost function;
[0193] An adjustment module 604, configured to adjust the first prediction value based on the fitting cost function to obtain a second prediction value of the number of requests for the target service in the next token cycle;
[0194] A determination module 605, configured to determine a final prediction value of the number of requests for the target service in a next token period based on the second prediction value and a first actual value of the number of requests for the target service in a previous token period;
[0195] The execution module 606 is used to perform a capacity expansion operation or a capacity reduction operation on the system cluster based on the difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster.
[0196] In some embodiments, the system cluster reserves at least a preset number of server silent copies for each server inside; the server silent copies are server copies that have not been awakened;
[0197] The system cluster expansion and contraction processing device also includes: a wake-up module, which is used to determine the final predicted value of the number of requests for the target service in the next token cycle based on the second predicted value and the first actual value of the number of requests for the target service in the previous token cycle, and then wake up the silent copy of the server to provide the target service if the final predicted value is greater than the number of requests for the target service that the system cluster can currently carry.
[0198] In some embodiments, the execution module 606 is specifically configured to:
[0199] If the final predicted value is greater than the number of requests for the target service that the system cluster can currently carry, the capacity expansion operation is performed;
[0200] When the final predicted value is less than the number of requests for the target service that the system cluster can currently bear, a scaling-down operation is performed.
[0201] In some embodiments, the execution module 606 is specifically configured to:
[0202] Determine a first number of server replicas currently lacking based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server replica can carry;
[0203] If the first number is not zero, comparing the first number with the number of silent replicas of the server;
[0204] When the number of silent copies of the server is not less than the first number, waking up the first number of silent copies of the server;
[0205] When the number of silent replicas of the server is greater than the first number, the following operations are performed:
[0206] Wake up all silent copies of the server;
[0207] Obtain a first difference between the number of silent replicas of the server and the first number;
[0208] Obtaining the sum of the first difference and the preset quantity to obtain the target quantity;
[0209] Replicate the target number of server copies; wake up the first difference number of server copies.
[0210] In some embodiments, the execution module 606 is specifically configured to:
[0211] Obtaining a second difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster;
[0212] A first number is determined based on the second difference and the number of requests for the target service that can be hosted by a single server or a server replica.
[0213] In some embodiments, the execution module 606 is specifically configured to:
[0214] When the number of silent copies of the server is greater than a preset number, the silent copies of the server are cleared according to preset rules.
[0215] In some embodiments, the execution module 606 is specifically configured to:
[0216] Read the status of each server's silent replica;
[0217] Determining a second number of silent replicas of the server that have not been used within a preset time period;
[0218] determining a third difference between the number of silent replicas of the server and the second number;
[0219] When the third difference is greater than a preset number, clear all server silent copies that have not been used within a preset time period;
[0220] When the third difference is not greater than a preset number, some server silent copies that have not been used within a preset time period are cleared to retain a preset number of server silent copies.
[0221] In some embodiments, the fitting cost function includes a weight matrix;
[0222] The adjustment module 604 is specifically used for:
[0223] Initialize the weight matrix;
[0224] For the matrix parameters at each position of the weight matrix, the following operations are performed respectively until the final weight matrix is obtained: the first matrix parameter is used as a variable parameter, the second matrix parameter is used as a constant, and the parameter value of the first matrix parameter is solved; the first matrix parameter is the matrix parameter at any position of the weight matrix, and the second matrix parameter is the remaining matrix parameters in the weight matrix except the first matrix parameter;
[0225] Based on the solved weight matrix, the first prediction value is adjusted to obtain a second prediction value.
[0226] In some embodiments, the determination module 605 is specifically configured to:
[0227] Obtaining a weight coefficient; the weight coefficient represents the weight of the second predicted value and the first actual value when determining the final predicted value;
[0228] A final predicted value is determined based on the weight coefficient, the second predicted value, and the first actual value.
[0229] In some embodiments, the historical token data includes a service name, a number of token uses, a total number of tokens issued, and a number of request discards;
[0230] The prediction module 601 is specifically used for:
[0231] Collect the service name, number of tokens used, total number of tokens issued, and number of discarded requests in the gateway log information;
[0232] Based on the service name, the number of token uses, the total number of token issuances, and the number of request discards, a first prediction value is predicted.
[0233] The device provided in the embodiment of the present application is the same as the method in the above embodiment, so both have the same embodiments and beneficial effects, which will not be repeated here.
[0234] Figure 7 The hardware structure diagram of the system cluster expansion and contraction processing device provided in the embodiment of the present application is shown. Figure 7 As shown, the system cluster expansion and contraction processing device may include a processor 701 and a memory 702 storing computer program instructions.
[0235] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0236] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory.
[0237] The memory 702 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.
[0238] The processor 701 reads and executes computer program instructions stored in the memory 702 to implement any one of the system cluster expansion and contraction processing methods in the above embodiments.
[0239] In one example, the system cluster expansion and contraction processing device may further include a communication interface 703 and a bus 704. The processor 701, the memory 702, and the communication interface 703 are connected through the bus 704 and communicate with each other.
[0240] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0241] The bus 704 includes hardware, software or both, coupling the components of the system cluster expansion and contraction processing equipment to each other. For example and not limitation, the bus may include an Accelerate Graphical Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus or other suitable buses or a combination of two or more of these. Where appropriate, the bus 704 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0242] In addition, in combination with the system cluster expansion and contraction processing method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any system cluster expansion and contraction processing method in the above embodiment is implemented.
[0243] An embodiment of the present application further provides a computer program product, including a computer program, which, when executed, implements any one of the system cluster expansion and contraction processing methods in the above embodiments.
[0244] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0245] The functional blocks shown in the block diagram above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an ASIC, appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (Erasable ROM, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0246] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0247] The above describes various aspects of the present disclosure with reference to the flowchart and / or block diagram of a system cluster expansion and contraction processing method, device, equipment, medium and product according to an embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0248] The above contents are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application.
Claims
1. A system cluster expansion and contraction processing method, characterized in that: include: Predicting the number of requests for a target service in a next token cycle based on historical token data of the system cluster to obtain a first prediction value; Obtain a predicted value sequence and an actual value sequence of the number of requests for the target service for multiple historical token cycles; Based on the actual value sequence, the predicted value sequence is fitted to obtain a fitting cost function; Based on the fitting cost function, adjusting the first prediction value to obtain a second prediction value of the number of requests for the target service in the next token cycle; Determine a final predicted value of the number of requests for the target service in a next token cycle based on the second predicted value and a first actual value of the number of requests for the target service in a previous token cycle; Based on the difference between the final prediction value and the number of requests for the target service that the system cluster can currently bear, a capacity expansion operation or a capacity reduction operation is performed on the system cluster.
2. The system cluster expansion and contraction processing method according to claim 1, characterized in that: The system cluster reserves at least a preset number of server silent copies for each server inside; the server silent copies are server copies that have not been awakened; After determining a final predicted value of the number of requests for the target service in a next token cycle based on the second predicted value and the first actual value of the number of requests for the target service in a previous token cycle, the method further includes: When the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, the silent copy of the server is awakened to provide the target service.
3. The system cluster expansion and contraction processing method according to claim 2, characterized in that: The performing a capacity expansion operation or a capacity reduction operation on the system cluster based on a difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster includes: When the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, performing a capacity expansion operation; When the final predicted value is less than the number of requests for the target service that can be currently carried by the system cluster, a scaling-down operation is performed.
4. The system cluster expansion and contraction processing method according to claim 3, characterized in that: When the final predicted value is greater than the number of requests for the target service that the system cluster can currently bear, performing a capacity expansion operation includes: Determine a first number of the server replicas currently lacking based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server replica can carry; When the first number is not zero, comparing the first number with the number of silent copies of the server; When the number of silent copies of the server is not less than the first number, waking up the first number of silent copies of the server; When the number of silent replicas of the server is greater than the first number, performing the following operations: awakening all silent copies of the server; Obtain a first difference between the number of silent replicas of the server and the first number; Obtaining the sum of the first difference and the preset number to obtain a target number; Copy the target number of server copies; wake up the first difference number of server copies.
5. The system cluster expansion and contraction processing method according to claim 4, characterized in that: The determining, based on the final prediction value, the number of requests for the target service that the system cluster can currently carry, and the number of requests for the target service that a single server or server copy can carry, a first number of the server copies that are currently missing includes: Obtaining a second difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster; The first number is determined based on the second difference and the number of requests for the target service that can be handled by a single server or a server replica.
6. The system cluster expansion and contraction processing method according to claim 3, characterized in that: The step of performing a capacity reduction operation when the final predicted value is less than the number of requests for the target service that can be currently carried by the system cluster includes: When the number of silent copies of the server is greater than the preset number, the silent copies of the server are cleared according to preset rules.
7. The system cluster expansion and contraction processing method according to claim 6, characterized in that: When the number of silent copies of the server is greater than the preset number, clearing the silent copies of the server according to a preset rule includes: Reading the status of each of the server silent copies; Determining a second number of silent replicas of the server that have not been used within a preset time period; determining a third difference between the number of silent replicas of the server and the second number; When the third difference is greater than the preset number, clearing all server silent copies that have not been used within the preset time period; When the third difference is not greater than the preset number, some of the server silent copies that have not been used within the preset time period are cleared to retain the preset number of server silent copies.
8. The system cluster expansion and contraction processing method according to any one of claims 1 to 7, characterized in that: The fitting cost function includes a weight matrix; The adjusting the first prediction value based on the fitting cost function to obtain a second prediction value of the number of requests for the target service in the next token cycle includes: Initializing the weight matrix; For the matrix parameters at each position of the weight matrix, the following operations are performed respectively until the final weight matrix is obtained: taking the first matrix parameter as a variable parameter and the second matrix parameter as a constant, solving the parameter value of the first matrix parameter; the first matrix parameter is the matrix parameter at any position of the weight matrix, and the second matrix parameter is the remaining matrix parameters in the weight matrix except the first matrix parameter; Based on the solved weight matrix, the first prediction value is adjusted to obtain the second prediction value.
9. The system cluster expansion and contraction processing method according to claim 8, characterized in that: The determining, based on the second predicted value and a first actual value of the number of requests for the target service in the previous token cycle, a final predicted value of the number of requests for the target service in the next token cycle includes: Obtaining a weight coefficient; the weight coefficient represents the weight of each of the second predicted value and the first actual value when determining the final predicted value; The final predicted value is determined based on the weight coefficient, the second predicted value and the first actual value.
10. The system cluster expansion and contraction processing method according to claim 1, characterized in that: The historical token data includes service name, number of token usage, total number of token issuances, and number of request discards; The step of predicting the number of requests for a target service in a next token cycle based on the historical token data of the system cluster to obtain a first prediction value includes: Collect the service name, the number of tokens used, the total number of tokens issued, and the number of requests discarded in the gateway log information; The first prediction value is predicted based on the service name, the number of token uses, the total number of token issuances, and the number of discarded requests.
11. A system cluster expansion and contraction processing device, characterized in that: include: A prediction module, configured to predict the number of requests for a target service in a next token cycle based on historical token data of the system cluster, and obtain a first prediction value; An acquisition module, used for acquiring a predicted value sequence and an actual value sequence of the number of requests for the target service for a plurality of historical token cycles; A fitting module, used for fitting the predicted value sequence based on the actual value sequence to obtain a fitting cost function; An adjustment module, configured to adjust the first prediction value based on the fitting cost function to obtain a second prediction value of the number of requests for the target service in a next token cycle; a determination module, configured to determine a final prediction value of the number of requests for the target service in a next token cycle based on the second prediction value and a first actual value of the number of requests for the target service in a previous token cycle; An execution module is used to perform a capacity expansion operation or a capacity reduction operation on the system cluster based on a difference between the final prediction value and the number of requests for the target service that can currently be carried by the system cluster.
12. A system cluster expansion and contraction processing device, characterized in that: include: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the system cluster expansion and contraction processing method according to any one of claims 1 to 10 is implemented.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the system cluster expansion and contraction processing method according to any one of claims 1 to 10 is implemented.
14. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the system cluster expansion and contraction processing method as described in any one of claims 1 to 10.