A method and device for adjusting the number of microservice instances

By obtaining microservice operating parameters, using data mining and event sequence algorithms to predict future usage information, and combining K-nearest neighbor and clustering algorithms to adjust the number of microservice instances, the problem of uneven resources during peak traffic periods in microservice applications is solved, and intelligent resource matching and efficiency improvement are achieved.

CN114911627BActive Publication Date: 2025-09-26中国邮政储蓄银行股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210631692.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-06
Publication Date
2025-09-26
Estimated Expiration
2042-06-06

AI Technical Summary

Technical Problem

In microservice applications, the problem of uneven resource usage during peak traffic periods, resulting in tight resources for some services and excess resources for others, has not been effectively solved.

Method used

By obtaining the microservice operating parameters of the system during stress testing, using data mining and event sequence algorithms to predict usage information in future time periods, combining K-nearest neighbor and clustering algorithms to calculate user similarity, and building a mathematical model to adjust the number of microservice instances to match resource requirements.

Benefits of technology

It realizes intelligent matching of resources during peak traffic periods, solves the problem of uneven resource distribution, and improves the resource utilization efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911627B_ABST
    Figure CN114911627B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for adjusting the number of microservice instances. The invention comprises: obtaining the operating parameters of each microservice during a system stress test to obtain test operating parameters; determining predicted usage information, wherein the predicted usage information includes at least the microservices to be used in a future time period and the operating parameters of the microservices to be used, and the predicted usage information is the usage information of the microservices to be used in a preset future time period; and adjusting the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance. The present invention solves the problem of uneven instance resource allocation during peak traffic periods in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a field, and in particular to a method and device for adjusting the number of microservice instances. Background Art

[0002] In related technologies, as more and more microservice applications are used and the number of microservice application instances is fixed, some microservices have tight resource usage during peak traffic periods, while other unpopular services have excess resources, and the problem of uneven resource allocation is becoming more and more serious.

[0003] With respect to the above-mentioned problems existing in related technologies, no effective solution has been proposed so far. Summary of the Invention

[0004] The main purpose of the present invention is to provide a method and device for adjusting the number of microservice instances to solve the problem of uneven instance resource allocation during peak traffic periods in related technologies.

[0005] To achieve the above objectives, according to one aspect of the present invention, a method for adjusting the number of microservice instances is provided. The method comprises: obtaining operating parameters of each microservice during a system stress test to obtain test operating parameters; determining predicted usage information, wherein the predicted usage information includes at least microservices to be used in a future time period and the operating parameters of the microservices to be used, and the predicted usage information is usage information of the microservices to be used in a preset future time period; and adjusting the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein each microservice corresponds to at least one instance.

[0006] Furthermore, the operating parameters of each microservice of the system during the stress test are obtained to obtain the test operating parameters, including: running each microservice under the stress test and obtaining the operating log corresponding to the interface of each microservice, the operating log including at least the CPU, memory, IO and bandwidth occupied by the interface of the microservice; recording the content contained in the operating log to obtain the test operating parameters.

[0007] Furthermore, determining the predicted usage information includes: determining first usage information of the user on multiple microservices in a future preset time period based on a data mining algorithm; determining second usage information of the user on multiple microservices in the future preset time period based on an event sequence algorithm; and calculating the first usage information and the second usage information according to preset weights to determine usage information of the multiple microservices in the future time period.

[0008] Furthermore, based on the data mining algorithm, first usage information of users on multiple microservices within a future preset time period is determined, including: determining historical usage information of users using system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user's information, the user's access path, and the system's page loading time; determining a target user group based on the historical usage information; calculating multiple similarities between users in the target user group; and determining the first usage information based on the multiple similarities and the historical usage information of the target user group.

[0009] Furthermore, multiple similarities between users in the target user group are calculated, including: calculating the similarities between two users according to a K-nearest neighbor algorithm and / or a clustering algorithm.

[0010] Furthermore, based on the event sequence algorithm, second usage information of the user on multiple microservices within a preset time period in the future is determined, including: obtaining historical usage information corresponding to each microservice, the historical usage information at least including the operating parameters corresponding to each microservice within the historical time period; constructing a preset mathematical model based on the historical usage information, the preset mathematical model being a mathematical model used to reflect the dynamic dependency relationship contained in the time series; and determining the second usage information based on the preset mathematical model.

[0011] Furthermore, based on the historical usage information, a preset mathematical model is constructed, including: based on the historical usage information, determining the time series dynamic data corresponding to the historical usage information, and constructing a correlation graph corresponding to the time series dynamic data, the correlation graph is used to display the change trend and change cycle of the operating parameters, and the correlation graph contains multiple observation values; determining that the multiple observation values ​​contain jump points and inflection points, and adjusting the values ​​corresponding to the jump points and fitting the inflection points to obtain multiple adjusted observation values; based on the multiple adjusted observation values, a preset mathematical model is constructed.

[0012] Furthermore, adjustments are made to the instances corresponding to the microservices to be used based on the operating parameters and the predicted usage information, including: determining whether the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; maintaining the current resource status of the system when the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; and expanding the number of instances corresponding to the microservices when the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information.

[0013] To achieve the above objectives, according to another aspect of the present invention, a device for adjusting the number of microservice instances is provided. The device comprises: an acquisition unit configured to acquire operating parameters of each microservice during a system stress test to obtain test operating parameters; a determination unit configured to determine predicted usage information, wherein the predicted usage information includes at least microservices to be used in a future time period and the operating parameters of the microservices to be used, and the predicted usage information is usage information of the microservices to be used in a preset future time period; and an adjustment unit configured to adjust the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein each microservice corresponds to at least one instance.

[0014] In order to achieve the above-mentioned objective, according to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the program executes any one of the methods for adjusting the number of microservice instances.

[0015] To achieve the above-mentioned objective, according to another aspect of the present application, a processor is provided, which is configured to run a program, wherein the program executes any one of the methods for adjusting the number of microservice instances.

[0016] The present invention employs the following steps: obtaining the operating parameters of each microservice during a system stress test to obtain test operating parameters; determining predicted usage information, wherein the predicted usage information includes at least the microservices to be used and the operating parameters of the microservices to be used in a future time period, and the predicted usage information is the usage information of the microservices to be used within a preset future time period; and adjusting the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein each microservice corresponds to at least one instance. This solves the problem of uneven instance resource allocation during peak traffic periods in related technologies, thereby achieving the effect of intelligent resource matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which constitute part of the present invention, are provided to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are provided to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:

[0018] Figure 1 is a flowchart of a method for adjusting the number of microservice instances provided in accordance with an embodiment of the present invention; and

[0019] Figure 2 This is a flowchart of a method for adjusting the number of microservice instances provided according to an embodiment of the present invention;

[0020] Figure 3 2 is a schematic diagram of a device for adjusting the number of microservice instances provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0022] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "first," "second," and the like in the specification and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate for the embodiments of the present invention described herein. In addition, the terms "including," "having," and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatuses.

[0024] According to an embodiment of the present invention, a method for adjusting the number of microservice instances is provided.

[0025] Figure 1 This is a flow chart of a method for adjusting the number of microservice instances according to an embodiment of the present invention. Figure 1 As shown, the invention includes the following steps:

[0026] Step S101: Obtain the operating parameters of each microservice during the stress test of the system to obtain the test operating parameters.

[0027] Step S102 : Determine predicted usage information, wherein the predicted usage information includes at least the microservices to be used in a future time period and the operating parameters of the microservices to be used. The predicted usage information is usage information of the microservices to be used that are used in a preset time period in the future.

[0028] Step S103 : adjusting the instance corresponding to the microservice to be used according to the test operation parameters and the predicted usage information, wherein one microservice corresponds to at least one instance.

[0029] Specifically, this application predicts the microservice business modules that users will access, and based on time series, predicts the user usage and the usage of each microservice business module. The resource analysis system determines whether it is necessary to increase the instance of the microservice to improve the user experience. Each microservice corresponds to a microservice business module, and the microservices in use and to be used are treated by predicting the usage of the microservice business module.

[0030] In an optional embodiment provided herein, the LightGBM algorithm is used to predict the microservice modules that users access. LightGBM is a gradient boosting framework that uses a decision tree-based learning algorithm. It is distributed and efficient, offering the following advantages: 1) faster training efficiency 2) lower memory usage 3) higher accuracy 4) support for parallel learning 5) the ability to process large amounts of data.

[0031] In an optional embodiment, obtaining the operating parameters of each microservice during a system stress test to obtain the test operating parameters includes: running each microservice under the stress test and obtaining the corresponding operation log for each microservice interface, wherein the operation log includes at least the CPU, memory, I / O, and bandwidth occupied by the microservice interface; and recording the contents of the operation log to obtain the test operating parameters. To predict microservice usage, the operating parameters of each microservice must first be obtained. Specifically, a stress test is performed with sufficient resources, and the operating parameters of each microservice obtained under the stress test are obtained from the operation log.

[0032] It should be noted that before stress testing, the number of instances of each microservice and the servers used need to be reasonably set based on the number of users designed for the system and the system scale. Different microservice instances should be deployed on the same server.

[0033] In an optional embodiment, determining the predicted usage information includes: determining, based on a data mining algorithm, first usage information of the user for the multiple microservices within a future preset time period; determining, based on an event sequence algorithm, second usage information of the user for the multiple microservices within the future preset time period; and calculating the first usage information and the second usage information according to preset weights to determine the usage information of the multiple microservices within the future time period.

[0034] As described above, in order to determine the accuracy of microservice usage information in a future time period, an embodiment provided in the present application uses two methods to predict microservice usage information in a future preset time period, and calculates according to certain preset weights to predict the microservice usage information in the future time period.

[0035] In an optional embodiment, first usage information of a user on multiple microservices within a preset time period in the future is determined based on a data mining algorithm, including: determining historical usage information of the user using system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user's information, the user's access path, and the system's page loading time; determining a target user group based on the historical usage information; calculating multiple similarities between users in the target user group; and determining the first usage information based on the multiple similarities and the historical usage information of the target user group.

[0036] In an optional embodiment, calculating multiple similarities between users in the target user group includes calculating the similarities between two users based on a K-nearest neighbor algorithm and / or a clustering algorithm.

[0037] Specifically, in a specific embodiment provided by the present application, the operating parameters of the microservices to be used and the microservices to be used are predicted based on a data mining algorithm. First, the user's usage log in the system is collected, including parameters such as login time, user-related information, access path, page loading calculation time, etc. Secondly, data preprocessing is performed on the access information of all users, including but not limited to the processing of null values ​​and abnormal values. This step is mainly because the user behavior data is generated by the user in the process of using the application, and it may contain a lot of noise and user misoperation. We can filter out the noise in the behavior data through classic data mining algorithms, so that our analysis can be more accurate.

[0038] Based on data mining algorithms, the microservices and parameters used by users are predicted, specifically based on user roles, historical access paths, and other factors. To identify target user groups with similar interests, we first need to define metrics to measure the similarity between users. Optionally, we can use the K-nearest neighbor algorithm or a clustering algorithm. This patent uses the Jaccard formula and cosine similarity to calculate user similarity.

[0039] Furthermore, based on the user's similarity and historical information, the LightGBM algorithm is used to predict and judge the microservices to be used that the user is predicted to access and the parameters corresponding to the microservices to be used.

[0040] In an optional embodiment, determining second usage information of a user for multiple microservices within a future preset time period based on an event sequence algorithm includes: obtaining historical usage information corresponding to each microservice, where the historical usage information at least includes operating parameters corresponding to each microservice within the historical time period; constructing a preset mathematical model based on the historical usage information, where the preset mathematical model is used to reflect a mathematical model of dynamic dependencies contained in a time series; and determining the second usage information based on the preset mathematical model.

[0041] In an optional embodiment, a preset mathematical model is constructed based on historical usage information, including: determining time series dynamic data corresponding to the historical usage information based on the historical usage information, and constructing a correlation graph corresponding to the time series dynamic data, the correlation graph is used to display the changing trend and changing cycle of the operating parameters, and the correlation graph contains multiple observation values; determining that the multiple observation values ​​contain jump points and inflection points, and adjusting the numerical values ​​corresponding to the jump points and fitting the inflection points to obtain multiple adjusted observation values; constructing a preset mathematical model based on the multiple adjusted observation values.

[0042] As described above, dynamic time series data on the usage of each microservice is obtained through observation, survey, statistics, and sampling. Correlograms are created based on this dynamic data, and correlation analysis is performed to determine the autocorrelation function. Correlograms can reveal trends and cycles, as well as identify jumps and inflection points. If jumps are correct observations, they should be taken into account during modeling. If they are anomalies, the jumps should be adjusted to the expected value. If inflection points exist, different models must be used to fit the time series in different segments during modeling. For short or simple time series, trend and seasonal models with error can be used for fitting. For stationary time series, the general ARMA model (autoregressive moving average model) and its special cases, autoregressive models, moving average models, or combined ARMA models can be used for fitting. The ARMA model is generally used when there are more than 50 observations. For non-stationary time series, the observed time series must first be differentiated to transform it into a stationary time series, and then an appropriate model must be used to fit this differenced series. Based on the operation records of the microservice system, a mathematical model is established that can more accurately reflect the dynamic dependencies contained in the sequence, and used to predict the usage of each microservice interface.

[0043] In an optional embodiment, the situation of the instances corresponding to the microservices to be used is adjusted based on the operating parameters and the predicted usage information, including: determining whether the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; when the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information, maintaining the current resource status of the system; when the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information, expanding the number of instances corresponding to the microservices.

[0044] Based on the predicted microservice instances, a resource analysis system is used to analyze the current situation and determine whether to add new microservice instances. Specifically, the system collects operation logs for each microservice interface, including CPU, memory, I / O, bandwidth, and parameters, and records the resource consumption of each microservice interface under different parameters. Based on the prediction system's prediction results, the system determines which microservice interfaces and parameters the user will access. It also determines whether the resources occupied by the existing number of microservice instances can meet the resource requirements of the predicted microservice module. If the processing capacity of the microservice interface to be accessed exceeds 80% of the maximum capacity of the existing number of microservice instances, resources need to be expanded; otherwise, the current status is maintained. The number of microservice instances to be expanded is calculated by combining the number of microservice instances accessed by the user, the maximum resource consumption of the interface under these parameters, the processing capacity of the microservice, and the performance requirements of the system design to determine the number of microservice instances to be expanded. Based on the resources occupied by the microservice interfaces and the remaining resources on existing idle devices, the optimal sub-planning method based on dynamic programming in operations research is used to determine the servers where the microservice instances will run.

[0045] Optionally, in a method for adjusting the number of microservice instances provided in an embodiment of the present invention, whether to create the number of instances corresponding to the microservice or to destroy the number of instances corresponding to the microservice is determined based on the microservice to be used and the parameters corresponding to the microservice to be used.

[0046] Specifically, set the port of the newly added microservice to an unused port on the server (e.g., server.port = 8081). Then, add the microservice to the registry to enable automatic registration and discovery of the service, and to periodically check the health of the application service. Set the following: eureka.client.service-url.defaultZone = http: / / localhost:**** / eureka / . The registry can be used in conjunction with client-side load balancing. Since the application service already has a local list of service addresses, you can customize the load balancing strategy when accessing the microservice.

[0047] Based on the usage of each microservice interface in different time periods obtained by the time series algorithm of the prediction system and the usage of CPU, memory, IO, and bandwidth on all existing devices, the optimal number of dynamic programming points in operations research is planned to gradually destroy the reasonable number of microservice instances.

[0048] The calculation method for the number of microservice instances to be destroyed is as follows: the usage of each microservice interface obtained by the user's time series algorithm, the microservice interface being used by the user, the resource usage of each microservice interface in the current state, and the actual resource size of the server are combined to determine the number of microservice instances to be destroyed, and the dynamic programming optimal planning of operations research is used to reasonably destroy the microservice instances on the server. By reasonably destroying the microservice instances on the server, the technical effects of saving power, space, and resources can be achieved.

[0049] An embodiment of the present invention provides a method for adjusting the number of microservice instances. The method obtains the operating parameters of each microservice during a stress test of the system to obtain test operating parameters; determines predicted usage information, wherein the predicted usage information at least includes the microservices to be used and the operating parameters of the microservices to be used in a future time period, and the predicted usage information is the usage information of the microservices to be used in a preset future time period; and adjusts the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance. The present invention solves the problem of uneven instance resource allocation during peak traffic periods in related technologies, thereby achieving the effect of intelligent resource matching.

[0050] This application also provides a flowchart of a method for adjusting the number of microservice instances. Figure 2 As shown, the above method solves the problem of uneven instance resource allocation during traffic peak periods in related technologies, thereby achieving the effect of intelligent resource matching.

[0051] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0052] An embodiment of the present invention further provides a device for adjusting the number of microservice instances. It should be noted that the device for adjusting the number of microservice instances provided by an embodiment of the present invention can be used to execute the method for adjusting the number of microservice instances provided by an embodiment of the present invention. The following describes the device for adjusting the number of microservice instances provided by an embodiment of the present invention.

[0053] Figure 3 Schematic diagram of a device for adjusting the number of microservice instances according to an embodiment of the present invention. Figure 3As shown, the device includes: an acquisition unit 301, which is used to acquire the operating parameters of each microservice of the system during the stress test to obtain the test operating parameters; a determination unit 302, which is used to determine the predicted usage information, wherein the predicted usage information at least includes the microservices to be used and the operating parameters of the microservices to be used in the future time period, and the predicted usage information is the usage information of the microservices to be used that are used in the future preset time period; an adjustment unit 303, which is used to adjust the situation of the instance corresponding to the microservice to be used according to the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance.

[0054] In an optional embodiment, the acquisition unit 301 includes: an acquisition sub-unit, used to run each microservice under stress testing, and obtain the operation log corresponding to the interface of each microservice, the operation log including at least the CPU, memory, IO and bandwidth occupied by the interface of the microservice; a recording unit, used to record the content contained in the operation log to obtain the test operation parameters.

[0055] In an optional embodiment, the determination unit 302 includes: a first determination subunit, used to determine, based on a data mining algorithm, first usage information of a user on multiple microservices within a future preset time period; a second determination subunit, used to determine, based on an event sequence algorithm, second usage information of the user on multiple microservices within a future preset time period; and a third determination subunit, used to calculate the first usage information and the second usage information according to preset weights to determine usage information of multiple microservices within the future time period.

[0056] In an optional embodiment, the first determination subunit includes: a first determination module, used to determine historical usage information of users using system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user's information, the user's access path, and the system's page loading time; a second determination module, used to determine the target user group based on the historical usage information; a calculation module, used to calculate multiple similarities between users in the target user group; and a third determination module, used to determine the first usage information based on the multiple similarities and the historical usage information of the target user group.

[0057] In an optional embodiment, the calculation module includes: a calculation submodule, configured to calculate the similarity between two users based on a K-nearest neighbor algorithm and / or a clustering algorithm.

[0058] In an optional embodiment, the second determination subunit includes: an acquisition module for obtaining historical usage information corresponding to each microservice, the historical usage information at least including the operating parameters corresponding to each microservice in the historical time period; a construction module for constructing a preset mathematical model based on the historical usage information, the preset mathematical model is a mathematical model used to reflect the dynamic dependencies contained in the time series; a fourth determination module is used to determine the second usage information based on the preset mathematical model.

[0059] In an optional embodiment, the construction module includes: a first determination submodule, which is used to determine the time series dynamic data corresponding to the historical usage information based on the historical usage information, and construct a correlation graph corresponding to the time series dynamic data, the correlation graph is used to display the change trend and change cycle of the operating parameters, and the correlation graph contains multiple observation values; a second determination submodule, which is used to determine whether the multiple observation values ​​contain jump points and inflection points, and adjust the numerical values ​​corresponding to the jump points and perform fitting processing on the inflection points to obtain multiple adjusted observation values; a construction submodule, which is used to construct a preset mathematical model based on the multiple adjusted observation values.

[0060] In an optional embodiment, the adjustment unit 303 includes: a fourth determination subunit, which is used to determine whether the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; a maintenance subunit, which is used to maintain the resource status of the system when the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; an expansion subunit, which is used to expand the number of instances corresponding to the microservice when the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information.

[0061] An embodiment of the present invention provides a device for adjusting the number of microservice instances. The device obtains the operating parameters of each microservice during a stress test of the system to obtain test operating parameters; determines predicted usage information, wherein the predicted usage information at least includes the microservices to be used and the operating parameters of the microservices to be used in a future time period, and the predicted usage information is the usage information of the microservices to be used in a future preset time period; and adjusts the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance. The present invention solves the problem of uneven instance resource allocation during peak traffic periods in related technologies, thereby achieving the effect of intelligent resource matching.

[0062] The device for adjusting the number of microservice instances includes a processor and a memory. The above-mentioned acquisition unit 301 and the like are stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to implement corresponding functions.

[0063] The processor includes a kernel, which retrieves the corresponding program unit from the memory. The kernel can be set to one or more, and the kernel parameters can be adjusted to achieve the purpose of the present invention.

[0064] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0065] An embodiment of the present invention provides a storage medium having a program stored thereon, which, when executed by a processor, implements the method for adjusting the number of microservice instances.

[0066] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the method for adjusting the number of microservice instances when running.

[0067] An embodiment of the present invention provides a device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining operating parameters of each microservice of the system during a stress test to obtain test operating parameters; determining predicted usage information, wherein the predicted usage information at least includes microservices to be used and operating parameters of the microservices to be used in a future time period, and the predicted usage information is usage information of the microservices to be used that are used in a preset time period in the future; and adjusting the situation of the instances corresponding to the microservices to be used based on the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance.

[0068] In an optional embodiment, the operating parameters of each microservice of the system during the stress test are obtained to obtain the test operating parameters, including: running each microservice under the stress test and obtaining the operating log corresponding to the interface of each microservice, the operating log including at least the CPU, memory, IO and bandwidth occupied by the interface of the microservice; recording the content contained in the operating log to obtain the test operating parameters.

[0069] In an optional embodiment, determining the predicted usage information includes: determining, based on a data mining algorithm, first usage information of the user for the multiple microservices within a future preset time period; determining, based on an event sequence algorithm, second usage information of the user for the multiple microservices within the future preset time period; and calculating the first usage information and the second usage information according to preset weights to determine the usage information of the multiple microservices within the future time period.

[0070] In an optional embodiment, first usage information of a user on multiple microservices within a preset time period in the future is determined based on a data mining algorithm, including: determining historical usage information of the user using system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user's information, the user's access path, and the system's page loading time; determining a target user group based on the historical usage information; calculating multiple similarities between users in the target user group; and determining the first usage information based on the multiple similarities and the historical usage information of the target user group.

[0071] In an optional embodiment, calculating multiple similarities between users in the target user group includes calculating the similarities between two users based on a K-nearest neighbor algorithm and / or a clustering algorithm.

[0072] In an optional embodiment, determining second usage information of a user for multiple microservices within a future preset time period based on an event sequence algorithm includes: obtaining historical usage information corresponding to each microservice, where the historical usage information at least includes operating parameters corresponding to each microservice within the historical time period; constructing a preset mathematical model based on the historical usage information, where the preset mathematical model is used to reflect a mathematical model of dynamic dependencies contained in a time series; and determining the second usage information based on the preset mathematical model.

[0073] In an optional embodiment, a preset mathematical model is constructed based on historical usage information, including: determining time series dynamic data corresponding to the historical usage information based on the historical usage information, and constructing a correlation graph corresponding to the time series dynamic data, the correlation graph is used to display the changing trend and changing cycle of the operating parameters, and the correlation graph contains multiple observation values; determining that the multiple observation values ​​contain jump points and inflection points, and adjusting the numerical values ​​corresponding to the jump points and fitting the inflection points to obtain multiple adjusted observation values; constructing a preset mathematical model based on the multiple adjusted observation values.

[0074] In an optional embodiment, the situation of the instances corresponding to the microservices to be used is adjusted based on the operating parameters and the predicted usage information, including: determining whether the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; when the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information, maintaining the current resource status of the system; when the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information, expanding the number of instances corresponding to the microservices.

[0075] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0076] The present invention also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining the operating parameters of each microservice of the system during the stress test to obtain the test operating parameters; determining predicted usage information, wherein the predicted usage information at least includes the microservices to be used in the future time period and the operating parameters of the microservices to be used, and the predicted usage information is the usage information of the microservices to be used in the future preset time period; adjusting the situation of the instance corresponding to the microservice to be used based on the test operating parameters and the predicted usage information, wherein one microservice corresponds to at least one instance.

[0077] In an optional embodiment, the operating parameters of each microservice of the system during the stress test are obtained to obtain the test operating parameters, including: running each microservice under the stress test and obtaining the operating log corresponding to the interface of each microservice, the operating log including at least the CPU, memory, IO and bandwidth occupied by the interface of the microservice; recording the content contained in the operating log to obtain the test operating parameters.

[0078] In an optional embodiment, determining the predicted usage information includes: determining, based on a data mining algorithm, first usage information of the user for the multiple microservices within a future preset time period; determining, based on an event sequence algorithm, second usage information of the user for the multiple microservices within the future preset time period; and calculating the first usage information and the second usage information according to preset weights to determine the usage information of the multiple microservices within the future time period.

[0079] In an optional embodiment, first usage information of a user on multiple microservices within a preset time period in the future is determined based on a data mining algorithm, including: determining historical usage information of the user using system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user's information, the user's access path, and the system's page loading time; determining a target user group based on the historical usage information; calculating multiple similarities between users in the target user group; and determining the first usage information based on the multiple similarities and the historical usage information of the target user group.

[0080] In an optional embodiment, calculating multiple similarities between users in the target user group includes calculating the similarities between two users based on a K-nearest neighbor algorithm and / or a clustering algorithm.

[0081] In an optional embodiment, determining second usage information of a user for multiple microservices within a future preset time period based on an event sequence algorithm includes: obtaining historical usage information corresponding to each microservice, where the historical usage information at least includes operating parameters corresponding to each microservice within the historical time period; constructing a preset mathematical model based on the historical usage information, where the preset mathematical model is used to reflect a mathematical model of dynamic dependencies contained in a time series; and determining the second usage information based on the preset mathematical model.

[0082] In an optional embodiment, a preset mathematical model is constructed based on historical usage information, including: determining time series dynamic data corresponding to the historical usage information based on the historical usage information, and constructing a correlation graph corresponding to the time series dynamic data, the correlation graph is used to display the changing trend and changing cycle of the operating parameters, and the correlation graph contains multiple observation values; determining that the multiple observation values ​​contain jump points and inflection points, and adjusting the numerical values ​​corresponding to the jump points and fitting the inflection points to obtain multiple adjusted observation values; constructing a preset mathematical model based on the multiple adjusted observation values.

[0083] In an optional embodiment, the situation of the instances corresponding to the microservices to be used is adjusted based on the operating parameters and the predicted usage information, including: determining whether the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information; when the resources corresponding to the operating parameters meet the preset proportion of the resources corresponding to the predicted usage information, maintaining the current resource status of the system; when the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information, expanding the number of instances corresponding to the microservices.

[0084] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0085] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, 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, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0086] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0087] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0088] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0089] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0090] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0091] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0092] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0093] The above are merely embodiments of the present invention and are not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.

Claims

1. A method for adjusting the number of microservice instances, characterized in that: include: Obtain the operating parameters of each microservice during the stress test and obtain the test operating parameters; Determining predicted usage information, wherein the predicted usage information includes at least the microservices to be used in a future time period and operating parameters of the microservices to be used, and the predicted usage information is usage information of the microservices to be used in a future preset time period; Adjusting the instance corresponding to the to-be-used microservice based on the test operation parameters and the predicted usage information, wherein one microservice corresponds to at least one instance; Determining the predicted usage information includes: determining first usage information of the user for the multiple microservices in the future preset time period based on a data mining algorithm; determining second usage information of the user for the multiple microservices in the future preset time period based on an event sequence algorithm; calculating the first usage information and the second usage information according to preset weights to determine the usage information of the multiple microservices in the future time period, and determining the first usage information of the user for the multiple microservices in the future preset time period based on the data mining algorithm, including: determining historical usage information of the user using system microservices in a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user information, the user's access path, and the page loading time of the system; determining a target user group based on the historical usage information; calculating multiple similarities between users in the target user group; and determining the first usage information based on the multiple similarities and the historical usage information of the target user group.

2. The method according to claim 1, characterized in that Obtain the operating parameters of each microservice during the stress test, including: Under stress testing, run each of the microservices and obtain a running log corresponding to the interface of each microservice, wherein the running log includes at least the CPU, memory, IO, and bandwidth occupied by the interface of the microservice; The content contained in the operation log is recorded to obtain the test operation parameters.

3. The method according to claim 1, characterized in that Calculating multiple similarities between users in the target user group, including: The similarities between two users are calculated based on a K-nearest neighbor algorithm and / or a clustering algorithm.

4. The method according to claim 1, wherein Determining, based on an event sequence algorithm, second usage information of the user on the plurality of microservices within the future preset time period, including: Obtaining historical usage information corresponding to each of the microservices, the historical usage information at least including operating parameters corresponding to each of the microservices within a historical time period; Constructing a preset mathematical model based on the historical usage information, wherein the preset mathematical model is a mathematical model for reflecting the dynamic dependency relationship contained in the time series; Based on the preset mathematical model, the second usage information is determined.

5. The method according to claim 4, characterized in that Based on the historical usage information, a preset mathematical model is constructed, including: Determining, based on the historical usage information, time series dynamic data corresponding to the historical usage information, and constructing a correlation graph corresponding to the time series dynamic data, the correlation graph being used to display a change trend and a change cycle of the operating parameter, the correlation graph including a plurality of observation values; Determining that a plurality of the observation values ​​include jump points and inflection points, adjusting values ​​corresponding to the jump points, and performing fitting processing on the inflection points to obtain a plurality of adjusted observation values; The preset mathematical model is constructed based on the adjusted plurality of observation values.

6. The method according to claim 2, characterized in that Adjusting the instance corresponding to the to-be-used microservice according to the operating parameters and the predicted usage information includes: Determining whether the resources corresponding to the operating parameters meet a preset proportion of the resources corresponding to the predicted usage information; When the resources corresponding to the operating parameters satisfy the preset proportion of the resources corresponding to the predicted usage information, maintaining the resource status of the system; When the resources corresponding to the operating parameters do not meet the preset proportion of the resources corresponding to the predicted usage information, the number of instances corresponding to the microservice is expanded.

7. A device for adjusting the number of microservice instances, characterized in that: include: The acquisition unit is used to obtain the operating parameters of each microservice of the system during the stress test and obtain the test operating parameters; a determining unit, configured to determine predicted usage information, wherein the predicted usage information includes at least a microservice to be used in a future time period and an operating parameter of the microservice to be used, and the predicted usage information is usage information of the microservice to be used in a preset future time period; an adjusting unit, configured to adjust a condition of an instance corresponding to the to-be-used microservice according to the test operation parameter and the predicted usage information, wherein one microservice corresponds to at least one instance; The determining unit includes: a first determining subunit, configured to determine, based on a data mining algorithm, first usage information of the user on the plurality of microservices within the future preset time period; a second determining subunit, configured to determine, based on an event sequence algorithm, second usage information of the user on the plurality of microservices within the future preset time period; and a third determining subunit, configured to calculate, based on a preset weight, the first usage information and the second usage information to determine usage information of the plurality of microservices within the future time period. The first determination subunit includes: a first determination module, used to determine historical usage information of the user using the system microservices within a historical time period, wherein the usage information at least includes the login time of the user logging into the system, the user information, the user's access path, and the page loading time of the system; a second determination module, used to determine a target user group based on the historical usage information; calculate multiple similarities between users in the target user group; and a third determination module, used to determine the first usage information based on the multiple similarities and the historical usage information of the target user group.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for adjusting the number of microservice instances according to any one of claims 1 to 6.

9. A processor, characterized in that: The processor is used to run a program, wherein the program executes the method for adjusting the number of microservice instances described in any one of claims 1 to 6 when running.

Citation Information

Patent Citations

  • A method and apparatus for managing resources in a cloud computing system

    CN109088747A

  • Resource adjustment method and device

    CN111400049A