Micro-service updating method and device and computer program product

By analyzing the future traffic of microservices using pre-trained traffic prediction models, the problem that grayscale release method is difficult to reasonably distribute traffic in the microservice architecture is solved, and a more accurate and secure service update effect is achieved.

CN119520268APending Publication Date: 2025-02-25SUPCON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411522958.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing grayscale release method is difficult to reasonably distribute traffic in the microservice architecture, resulting in poor service update effect.

Method used

By obtaining monitoring data of the target microservice, analyzing future traffic using a pre-trained traffic prediction model, and service updates are performed based on the predicted value to ensure the availability of services.

Benefits of technology

Improve the accuracy and security of service updates, ensuring smooth iteration of services and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520268A_ABST
    Figure CN119520268A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service updating method and device and a computer program product. The method comprises the following steps: acquiring first monitoring data of a target micro-service in a current time period; analyzing the first monitoring data by using a traffic prediction model to obtain a first predicted traffic value of the target micro-service in a future time period, the traffic prediction model being obtained by iteratively training a plurality of groups of first sample data, and the traffic prediction model being obtained by iteratively training the plurality of groups of first sample data; the plurality of groups of first sample data are composed of a plurality of second monitoring data of the plurality of micro-services in a plurality of first time periods and a plurality of second monitoring flow values of the plurality of micro-services in a plurality of second time periods; and updating the target micro-service based on the first predicted traffic value of the target micro-service in the future time period. According to the method and the device, the technical problem that the service updating effect is relatively poor due to the fact that traffic is difficult to distribute reasonably when the micro-service architecture is updated in a gray release mode is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a microservice update method and device, and a computer program product. Background Art

[0002] In a large-scale distributed microservice architecture with multiple services, multiple languages, and multiple frameworks, in order to ensure the stability of the microservice architecture and user experience, quickly respond to market demand, and continuously iterate and optimize, it is necessary to continuously iterate and update the microservice version. For each microservice, considering the complexity and dynamics of the microservice architecture, risk control and fault prevention mechanisms, user experience and demand response, continuous delivery and automated deployment, etc., grayscale release is generally used for service updates.

[0003] The existing grayscale release is usually achieved through traffic distribution control, where traffic is directed to different versions through IP (Internet Protocol) address grouping, cookie grouping, weight distribution, etc. However, the above traffic distribution control methods will affect the accuracy and security of grayscale release due to defects such as the dynamic and shared nature of IP addresses, regional restrictions, browser compatibility with cookies, cookie security, and uneven traffic distribution, thereby affecting the smooth iteration of service versions.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a microservice update method and device, and a computer program product to at least solve the technical problem that it is difficult to reasonably distribute traffic when updating the microservice architecture in a grayscale release manner, resulting in poor service update effects.

[0006] According to one aspect of an embodiment of the present application, a microservice update method is provided, comprising: obtaining first monitoring data of a target microservice in a current time period, wherein the first monitoring data comprises at least one of the following: network traffic data, user behavior data, and service performance data; analyzing the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0007] Optionally, network traffic data is used to reflect service information of the target object accessing the target microservice, and the service information includes at least one of the following: access time, accessed Internet Protocol IP address, and requested resource type; user behavior data is used to reflect behavior information of the target object when using the target microservice, and the behavior information includes at least one of the following: click behavior data, browsing behavior data, and purchase behavior data; service performance data is used to reflect the operating status information of the target microservice, and the operating status information includes at least one of the following: service response time, throughput, and service response error rate.

[0008] Optionally, the training process of the above-mentioned traffic prediction model includes: forming multiple groups of first sample data based on multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods, wherein the second time period is any time period after the first time period; constructing a machine learning model, wherein the types of machine learning models include: decision tree model, time series analysis model or random forest model; using multiple groups of first sample data to iteratively train the machine learning model to obtain a traffic prediction model.

[0009] Optionally, multiple groups of first sample data are determined based on multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring flow values ​​in multiple second time periods, including: for each microservice, using a preset method to obtain multiple initial monitoring data of the current microservice in multiple first time periods and multiple initial monitoring flow values ​​in multiple second time periods; preprocessing the multiple second monitoring data of the current microservice in multiple first time periods and the multiple second monitoring flow values ​​in multiple second time periods, respectively, to obtain multiple second monitoring data of the current microservice in multiple first time periods and multiple second monitoring flow values ​​in multiple second time periods, wherein the preprocessing operation includes at least one of the following: data cleaning, data standardization; forming multiple groups of first sample data based on the multiple second monitoring data of the multiple microservices in multiple first time periods and the multiple second monitoring flow values ​​in multiple second time periods.

[0010] Optionally, the machine learning model is iteratively trained using multiple groups of first sample data to obtain a traffic prediction model, including: for each training batch in the iterative training process, the second monitoring data of the microservices in each first training sample of the training batch within the first time period is input into the machine learning model, and the second predicted traffic value of each microservice in the second time period output by the machine learning model is obtained, and a target loss function is constructed using the second predicted traffic value and the corresponding second monitored traffic value, and the model parameters of the machine learning model are adjusted according to the target loss function, wherein the model parameters include at least one of the following: learning rate and number of iterations.

[0011] Optionally, updating the target microservice based on the first predicted traffic value of the target microservice in the future time period includes: determining an update priority of the target microservice in the microservice system based on the first predicted traffic value of the target microservice in the future time period, and updating the target microservice according to the update priority, wherein the microservice system includes the target microservice and multiple other microservices, and the smaller the first predicted traffic value of the target microservice in the future time period, the higher the update priority of the target microservice in the microservice system, and conversely, the larger the first predicted traffic value of the target microservice in the future time period, the lower the update priority of the target microservice in the microservice system.

[0012] Optionally, after updating the target microservice based on the first predicted traffic value of the target microservice in the future time period, the method also includes: analyzing the first monitoring data using a pre-trained resource usage prediction model to obtain resource usage prediction information of the target microservice in the future time period, wherein the resource usage prediction model is obtained by iterative training using multiple groups of second sample data, and the multiple groups of second sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple resource usage information in multiple second time periods, and the resource usage information includes at least one of the following: CPU occupancy information, memory occupancy information; determining a service scoring result of the target microservice in the future time period based on the resource usage prediction information and the first predicted traffic value; judging whether the service scoring result is lower than a preset scoring threshold; if the service scoring result is not lower than the scoring threshold, increasing exposure to the updated target microservice; if the service scoring result is lower than the scoring threshold, reducing exposure to the updated target microservice.

[0013] Optionally, after updating the target microservice based on the first predicted traffic value of the target microservice in the future time period, the method also includes: determining whether the first predicted traffic value of the target microservice in the future time period is lower than a preset safety traffic threshold; when the first predicted traffic value is not lower than the safety traffic threshold, determining that the updated target microservice is in an abnormal state, and rolling back the updated target microservice; when the first predicted traffic value is lower than the safety traffic threshold, determining that the updated target microservice is in a safe state, and keeping the updated target microservice unchanged.

[0014] According to another aspect of an embodiment of the present application, a microservice update device is also provided, including: an acquisition module, used to obtain first monitoring data of a target microservice in a current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; a prediction module, used to analyze the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; an update module, used to update the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0015] According to another aspect of an embodiment of the present application, a computer program product is further provided, the computer program product comprising a stored computer program, wherein the computer program implements the above-mentioned microservice update method when executed by a processor.

[0016] In an embodiment of the present application, the microservice system analyzes the first monitoring data of the target microservice in the current time period by using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period; thereby, the target microservice is updated based on the first predicted traffic value of the target microservice in the future time period to ensure the availability of the service, thereby solving the technical problem that it is difficult to reasonably distribute traffic when updating the microservice architecture due to the grayscale release method, resulting in poor service update effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a microservice update method according to an optional embodiment of the present application;

[0019] Figure 2 is a flowchart of an optional microservice update method according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of the structure of an optional microservice updating device according to an embodiment of the present application;

[0021] Figure 4 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

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

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0025] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:

[0026] Microservices: A service consisting of a single application. Each application runs in its own independent process, and the applications communicate and collaborate through lightweight communication mechanisms.

[0027] Grayscale release: refers to a release method that allows for a smooth transition. According to specific rules, a portion of users are selected to access the grayscale version of the service, and the scope is gradually expanded, and eventually all user access is migrated to the new version of the service to reduce upgrade risks.

[0028] Example 1

[0029] At present, microservice architecture usually adopts grayscale release to upgrade, which is mainly due to the following reasons:

[0030] (I) Microservice architecture can significantly improve the scalability, maintainability and flexibility of the system by splitting large applications into multiple small, independent microservices. However, this architecture also brings the complexity and dynamic nature of the dependencies between microservices, so a mechanism is urgently needed to ensure the stability and controllability of the service update process.

[0031] (ii) In the traditional full-scale release method, the new version of the service is usually used to directly replace the old version of the service. Once the new version of the service has serious defects, it may cause the entire system to crash or performance degradation. The grayscale release method provides a progressive release strategy that gradually introduces the new version of the service into the production environment by controlling the distribution of traffic. This method can effectively reduce risks and allow developers and operation and maintenance teams to discover and solve problems before the new version is fully launched.

[0032] (III) With the intensification of market competition, quickly responding to user needs and improving user experience have become one of the key factors for corporate success. Grayscale release allows companies to launch new features in stages and adjust and optimize based on user feedback and needs.

[0033] (IV) In the microservice architecture, continuous delivery and automated deployment are important means to improve development efficiency and reduce human errors, and the grayscale release method is closely integrated with these practices, using automated tools to implement the deployment of new versions of services and the gradual switching of traffic. Therefore, this method can significantly shorten the release cycle, increase the release frequency, and ensure that each release is fully tested and verified.

[0034] In summary, the background of the grayscale release of microservice architecture is based on the consideration of many factors such as the complexity and dynamics of microservice architecture, risk control and fault prevention, user experience and demand response, continuous delivery and automated deployment. Through the grayscale release method, enterprises can quickly respond to market demand and perform continuous iterative optimization while ensuring system stability and user experience.

[0035] The existing grayscale release is achieved through traffic distribution control, where traffic is directed to different versions through IP address grouping, cookie grouping, weight allocation, etc. However, the above traffic distribution control methods still have the following defects:

[0036] (1) IP address grouping method.

[0037] (1.1) Since the user's IP address may change dynamically, especially for home users and mobile users who use dynamic IP address allocation. In addition, multiple users may share the same public IP address (such as NAT network), which may lead to inaccurate grayscale control.

[0038] (1.2) Since some IP address ranges may correspond to specific geographical locations or network service providers, this may lead to an uneven geographical distribution of the user group of the grayscale test, affecting the representativeness of the test results.

[0039] (2)Cookie grouping method.

[0040] (2.1) Since the number and size of cookies under each domain name are limited, this may make it impossible to effectively use cookies for grayscale control in large applications.

[0041] (2.2) Since different browsers have different levels of support for cookies, this may cause the grayscale control to perform inconsistently among different user groups.

[0042] (2.3) Since users can clear or disable cookies, this will affect the accuracy of grayscale control.

[0043] (2.4) Since cookies are transmitted in plain text in HTTP requests, there is a risk of them being intercepted and tampered with, which may affect the security of grayscale updates.

[0044] (3)Weight allocation method.

[0045] (3.1) Although weight allocation can roughly control the traffic ratio between different versions of services, in actual operation, factors such as network latency and service performance differences may lead to uneven traffic distribution, affecting the accuracy of the grayscale test results.

[0046] (3.2) During the grayscale test, if the traffic ratio needs to be adjusted dynamically, the load balancer or service gateway may need to be reconfigured, which may increase the complexity of the operation and the risk of error.

[0047] (3.3) Weight distribution usually depends on external systems such as load balancers or service gateways. The stability and performance of these systems will also affect the effect of grayscale updates.

[0048] Therefore, in order to solve this problem, an embodiment of the present application provides a method embodiment of a microservice update method, which is described in detail below. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.

[0049] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a microservice update method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0050] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0051] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the microservice update method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the microservice update method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0052] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0053] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0054] In the above operating environment, Figure 2 is a flow chart of an optional microservice update method according to an embodiment of the present application, such as Figure 2 As shown, the method at least includes steps S202-S206, wherein:

[0055] Step S202: Acquire the first monitoring data of the target microservice in the current time period.

[0056] In the technical solution provided in step S202, the microservice system can use network packet capture, log query, database query and other methods to obtain the first monitoring data of the target microservice in the current time period, and the first monitoring data obtained includes but is not limited to: network traffic data, user behavior data, and service performance data.

[0057] Specifically, the above-mentioned network traffic data can be obtained by capturing network data packets in real time, and the network traffic data records the service information of the target object accessing the target microservice, wherein the service information includes at least one of the following: access time, accessed Internet Protocol IP address, and requested resource type.

[0058] The user behavior data can be obtained by querying the microservice system log or database log, and the user behavior data records the behavior information of the target object when using the target microservice, wherein the behavior information includes at least one of the following: click behavior data, browsing behavior data, and purchase behavior data;

[0059] The above service performance data can also be obtained by querying the microservice system log or database log, and the service performance data records the operating status information (and performance bottleneck information) of the target microservice, where the operating status information includes at least one of the following: service response time, throughput, and service response error rate.

[0060] Step S204: Analyze the first monitoring data using the pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period.

[0061] In the technical solution provided in step S204, the above process can be understood as encapsulating the trained traffic prediction model into a microservice and integrating it into the microservice system to provide external traffic prediction services. The above traffic prediction model is obtained by iterative training using multiple sets of first sample data, and the multiple sets of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​of multiple microservices in multiple second time periods.

[0062] Therefore, the training process of the above traffic prediction model may include:

[0063] Step S1, forming a plurality of groups of first sample data based on a plurality of second monitoring data of a plurality of microservices in a plurality of first time periods and a plurality of second monitoring flow values ​​in a plurality of second time periods.

[0064] Specifically, the second monitoring data of each microservice in the first time period and the second monitoring traffic of the microservice in the second time period are combined into a group of first sample data, wherein the second time period is any (future) time period after the first time period.

[0065] Optionally, the microservice system may obtain multiple sets of first sample data according to the following steps, including:

[0066] Step S11: for each microservice, a plurality of initial monitoring data of the current microservice in a plurality of first time periods and a plurality of initial monitoring flow values ​​in a plurality of second time periods are obtained in a preset manner.

[0067] Specifically, each microservice is traversed. For the current microservice being traversed, the initial monitoring data of the current microservice in the first time period can also be obtained by using network packet capture, log query, database query and other methods, wherein the initial monitoring data includes but is not limited to: network traffic data, user behavior data, and service performance data.

[0068] Step S12, preprocessing the multiple second monitoring data of the current microservice in the multiple first time periods and the multiple second monitoring flow values ​​in the multiple second time periods respectively, to obtain the multiple second monitoring data of the current microservice in the multiple first time periods and the multiple second monitoring flow values ​​in the multiple second time periods.

[0069] Specifically, in order to ensure the integrity, accuracy and timeliness of the collected data, the multiple second monitoring data of the current microservice in multiple first time periods and the multiple second monitoring flow values ​​in multiple second time periods obtained above can be preprocessed, wherein the preprocessing operation includes but is not limited to:

[0070] (1) Data cleaning: including removing noise data, processing missing values, and removing duplicates;

[0071] (2) Data conversion: converting data of different dimensions to the same dimension, usually scaling the data to the range of 0 to 1 or -1 to 1 to eliminate the impact of dimension differences on model training (i.e., data standardization); or, adjusting the distribution range of the data to a specific interval (usually [0, 1]) through transformation to eliminate the magnitude differences between different features (i.e., data normalization);

[0072] (3) Feature screening (or feature selection): Select the most relevant and influential features to the prediction target (i.e., predicted traffic) from the original data, and remove those features that are irrelevant to the prediction target. Reducing the number of features can reduce the model training time and prediction time, while avoiding overfitting of the trained model.

[0073] Step S13, forming a plurality of groups of first sample data based on a plurality of second monitoring data of a plurality of microservices in a plurality of first time periods and a plurality of second monitoring flow values ​​in a plurality of second time periods.

[0074] Step S2, building a machine learning model.

[0075] Specifically, the types of the above-mentioned machine learning models include: decision tree model, time series analysis model or random forest model. It should be noted that the embodiment of the present application preferably adopts a decision tree model as a machine learning model. This is because the decision tree model has the following advantages: the decision tree model has a high prediction speed after construction, which is suitable for the processing of real-time traffic data (ie, real-time); the decision tree can handle nonlinear relationships and intuitively display the decision process through a tree structure, which helps to accurately predict the timing of traffic switching (ie, accuracy); the decision tree model is very interpretable and can clearly show the impact of each feature on the prediction results (ie, interpretability). That is, the decision tree model can quickly adapt to the dynamic changes of traffic to provide accurate prediction results, and is easy to understand and explain. In addition, considering that network traffic has time series characteristics and a certain periodicity, the machine learning model can also adopt a time series analysis model.

[0076] Step S3, using multiple groups of first sample data to iteratively train the machine learning model to obtain a traffic prediction model.

[0077] Optionally, the embodiment of the present application can implement iterative training according to the following steps, including:

[0078] For each training batch in the iterative training process, the second monitoring data of the microservices in each first training sample of the training batch in the first time period is input into the machine learning model to obtain the second predicted traffic of each microservice in the second time period output by the machine learning model, and the target loss function is constructed using the second predicted traffic and the corresponding second monitoring traffic. The model parameters of the machine learning model are adjusted according to the target loss function, wherein the model parameters include at least one of the following: learning rate and number of iterations.

[0079] It should be noted that in step S204, the machine learning model can be loaded into the memory, for example, the raw data of the machine learning model can be loaded from the non-volatile memory into the volatile memory, so that the processor runs the machine learning model. The raw data of the machine learning model network refers to the unprocessed data, which usually includes the parameters and structural data of the machine learning model. The structural data can be a calculation relationship based on the parameters, such as the forward propagation calculation relationship between the intermediate layers and the neurons. Specifically, the structural data can include the code related to the structure of the machine learning model, such as the code for performing related calculations between the intermediate layers and the neurons.

[0080] In one embodiment, an area for loading a machine learning model can be divided in the memory, which may include a structure data storage area and a parameter storage area. The structure data storage area is used to store structure-related codes, and the parameters referenced by it can point to the address of a specific parameter in the parameter storage area through a pointer. During the training process of the machine learning model, it may be necessary to update the parameters frequently, and the parameter values ​​in the parameter storage area can be updated.

[0081] Step S206: updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0082] In the technical solution provided in step S206, the microservice system can dynamically adjust the number of service instances in the future time period (i.e., service updates) according to the first predicted traffic value of the target microservice in the future time period to cope with different traffic peaks and ensure the availability of the service.

[0083] In addition, since a microservice system usually includes a target microservice and multiple other microservices, the embodiment of the present application can also determine the update priority of the target microservice in the microservice architecture based on the first predicted traffic value of the target microservice in a future time period, and perform service updates on the target microservice according to the update priority.

[0084] Among them, the smaller the first predicted traffic value of the target microservice in the future time period, the higher the update priority of the target microservice in the microservice system, and vice versa, the larger the first predicted traffic value of the target microservice in the future time period, the lower the update priority of the target microservice in the microservice system. This is because high-traffic services usually mean that more users are using the service, so updating these services can allow more users to experience new features or performance improvements faster, thereby having an immediate impact on user experience; in addition, high-traffic services usually require more computing resources and network bandwidth to process requests, and updating these services can optimize their performance and resource utilization efficiency, reduce system bottlenecks, and ensure that resources are used more effectively.

[0085] As an optional implementation, the microservice system may also evaluate and manage the update effect of the target microservice according to the first predicted traffic value of the target microservice in the future time period and in accordance with the following method, including:

[0086] Step 1: Use the pre-trained resource usage prediction model to analyze the first monitoring data to obtain resource usage prediction information of the target microservice in the future time period.

[0087] Specifically, the resource usage prediction model is obtained by iterative training using multiple groups of second sample data, and the multiple groups of second sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple resource usage information in multiple second time periods, that is, the second monitoring data of each microservice in the first time period and the resource usage information of the microservice in the second time period constitute a group of second sample data. It should be noted that the training process of the resource usage prediction model here is similar to the training process of the above-mentioned traffic prediction model, and the only difference is that the output of the sample data is different. Therefore, the training process of the resource usage prediction model will not be described in detail in the embodiment of the present application. In addition, the above-mentioned resource usage information includes but is not limited to: CPU occupancy information, memory occupancy information.

[0088] Step 2: Determine the service score result of the target microservice in the future time period based on the resource usage prediction information and the first predicted traffic value.

[0089] Specifically, the microservice system can first determine the scoring value corresponding to the range of resource usage prediction information and the scoring weight value corresponding to the resource usage prediction information, as well as the scoring value corresponding to the range of the first predicted traffic value and the scoring weight value corresponding to the first predicted traffic value; then perform weighted summation on the determined quantitative numerical values ​​and the corresponding weight values ​​to obtain the service scoring result of the target microservice in the future time period, wherein the service scoring result can be a specific numerical result, such as a percentage or a ten-point system, or it can be a specific scoring level, such as divided into multiple levels.

[0090] For example, if the CPU occupancy information in the resource usage prediction information of the target microservice in the future time period is 50% and the memory occupancy information is 60%, the quantitative value corresponding to the range of the resource usage prediction information is determined to be 8, and the scoring weight value corresponding to the resource usage prediction information is 5; if the first predicted traffic value of the target microservice in the future time period is 500MB, the quantitative value corresponding to the range of the first predicted traffic value is determined to be 6, and the scoring weight value corresponding to the first predicted traffic value is 5. Therefore, based on these values, the service scoring result of the target microservice in the future time period can be obtained through the weighted sum algorithm: 8*5+6*5=7.

[0091] Step 3: Determine whether the service score result is lower than a preset score threshold, wherein the score threshold can be set according to the actual application scenario, and this application does not impose any specific restrictions on the setting value of the score threshold.

[0092] When the service scoring result is not lower than the scoring threshold, increase the exposure of the updated target microservice.

[0093] In the above case, increasing exposure to the updated target microservice means increasing traffic entering the target microservice.

[0094] When the service score result is lower than the score threshold, the exposure of the updated target microservice is reduced.

[0095] In the above case, reducing the exposure of the updated target microservice means reducing the traffic entering the target microservice.

[0096] As an optional implementation, the microservice system may also perform risk warning and management on the target microservice according to the first predicted traffic value of the target microservice in the future time period and in the following method, including:

[0097] Determine whether the first predicted traffic value of the target microservice in the future time period is lower than a preset safety traffic threshold, wherein the safety traffic threshold can be set according to the actual application scenario, and this application does not impose any specific restrictions on the setting value of the safety traffic threshold.

[0098] When the first predicted traffic value is not lower than the safe traffic threshold, it is determined that the updated target microservice is in an abnormal state, and a rollback operation is performed on the updated target microservice.

[0099] In the above case, it indicates that the target microservice has been maliciously attacked. In order to enable the target microservice to provide services normally, the updated target microservice can be rolled back, that is, the service version before the update can be returned.

[0100] When the first predicted traffic value is lower than the safe traffic threshold, it is determined that the updated target microservice is in a safe state, and the updated target microservice is kept unchanged (ie, the service is continued to be provided through the updated target microservice).

[0101] Based on the scheme defined by the above steps S202 to S206, it can be learned that in an embodiment, the microservice system analyzes the first monitoring data of the target microservice in the current time period through a traffic prediction model to predict the first predicted traffic value of the target microservice in the future time period, and when an update is required, the update order of the target microservice is determined according to the first predicted traffic value of the target microservice in the future time period; at the same time, the microservice system can also analyze the first monitoring data of the target microservice in the current time period through a resource usage prediction model to predict the resource usage prediction information of the target microservice in the future time period, and comprehensively evaluate the update effect of the target microservice in the future time period in combination with the resource usage prediction information and the first predicted traffic value to control the size of the traffic entering the updated target microservice; in addition, the microservice system can also use the first predicted traffic value of the target microservice in the future time period to make an abnormal judgment on the updated target microservice to ensure the stability and controllability of the target microservice during the update process.

[0102] Example 2

[0103] Based on Embodiment 1 of the present application, an embodiment of a microservice updating device is also provided, and the microservice updating method of the above embodiment is executed when the device is running. Figure 3 is a schematic diagram of the structure of an optional microservice update device according to an embodiment of the present application, such as Figure 3 As shown, the microservice update device at least includes an acquisition module 32, a prediction module 34 and an update module 36, wherein:

[0104] An acquisition module 32 is used to acquire first monitoring data of a target microservice in a current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data;

[0105] A prediction module 34 is used to analyze the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of a target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple sets of first sample data, and the multiple sets of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods;

[0106] The updating module 36 is configured to update the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0107] In addition, the above device also includes a management module for managing the updated target microservice.

[0108] As an optional implementation, the management module may evaluate and manage the update effect of the target microservice according to the first predicted traffic value of the target microservice in the future time period and in accordance with the following method, including:

[0109] Step 1: Use the pre-trained resource usage prediction model to analyze the first monitoring data to obtain resource usage prediction information of the target microservice in the future time period.

[0110] Specifically, the resource usage prediction model is obtained by iterative training using multiple groups of second sample data, and the multiple groups of second sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple resource usage information in multiple second time periods, that is, the second monitoring data of each microservice in the first time period and the resource usage information of the microservice in the second time period constitute a group of second sample data. It should be noted that the training process of the resource usage prediction model here is similar to the training process of the above-mentioned traffic prediction model, and the only difference is that the output of the sample data is different. Therefore, the training process of the resource usage prediction model will not be described in detail in the embodiment of the present application. In addition, the above-mentioned resource usage information includes but is not limited to: CPU occupancy information, memory occupancy information.

[0111] Step 2: Determine the service score result of the target microservice in the future time period based on the resource usage prediction information and the first predicted traffic value.

[0112] Specifically, the microservice system can first determine the scoring value corresponding to the range of resource usage prediction information and the scoring weight value corresponding to the resource usage prediction information, as well as the scoring value corresponding to the range of the first predicted traffic value and the scoring weight value corresponding to the first predicted traffic value; then perform weighted summation on the determined quantitative numerical values ​​and the corresponding weight values ​​to obtain the service scoring result of the target microservice in the future time period, wherein the service scoring result can be a specific numerical result, such as a percentage or a ten-point system, or it can be a specific scoring level, such as divided into multiple levels.

[0113] Step 3: Determine whether the service score result is lower than a preset score threshold, wherein the score threshold can be set according to the actual application scenario, and this application does not impose any specific restrictions on the setting value of the score threshold.

[0114] When the service scoring result is not lower than the scoring threshold, increase the exposure of the updated target microservice.

[0115] In the above case, increasing exposure to the updated target microservice means increasing traffic entering the target microservice.

[0116] When the service score result is lower than the score threshold, the exposure of the updated target microservice is reduced.

[0117] In the above case, reducing the exposure of the updated target microservice means reducing the traffic entering the target microservice.

[0118] In addition, the management module may also perform risk warning and management on the target microservice according to the first predicted traffic value of the target microservice in the future time period and in the following method, including:

[0119] Determine whether the first predicted traffic value of the target microservice in the future time period is lower than a preset safety traffic threshold, wherein the safety traffic threshold can be set according to the actual application scenario, and this application does not impose any specific restrictions on the setting value of the safety traffic threshold.

[0120] When the first predicted traffic value is not lower than the safe traffic threshold, it is determined that the updated target microservice is in an abnormal state, and a rollback operation is performed on the updated target microservice.

[0121] In the above case, it indicates that the target microservice has been maliciously attacked. In order to enable the target microservice to provide services normally, the updated target microservice can be rolled back, that is, the service version before the update can be returned.

[0122] When the first predicted traffic value is lower than the safe traffic threshold, it is determined that the updated target microservice is in a safe state, and the updated target microservice is kept unchanged (ie, the service is continued to be provided through the updated target microservice).

[0123] It should be noted that the various modules in the above-mentioned microservice update device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.

[0124] Example 3

[0125] According to an embodiment of the present application, a non-volatile storage medium is further provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the microservice update method in Example 1.

[0126] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining first monitoring data of the target microservice in the current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; using a pre-trained traffic prediction model to analyze the first monitoring data to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0127] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the microservice update method in Example 1 is implemented.

[0128] Optionally, the computer program executes the following steps: obtaining first monitoring data of the target microservice in the current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; analyzing the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0129] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the microservice update method in Example 1 is executed when the program is running.

[0130] Optionally, the following steps are executed when the program is running: obtaining first monitoring data of the target microservice in the current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; analyzing the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0131] According to an embodiment of the present application, an electronic device is also provided, wherein: Figure 4 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 4 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are implemented to run the programs, wherein the programs are configured to execute the microservice update method in the above-mentioned embodiment 1 when running.

[0132] Optionally, the processor is configured to execute the following steps through a computer program: obtaining first monitoring data of the target microservice in the current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; analyzing the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; updating the target microservice based on the first predicted traffic value of the target microservice in the future time period.

[0133] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0134] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0135] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0136] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0137] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0138] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0139] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A microservice update method, characterized in that: include: Acquire first monitoring data of the target microservice in the current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; The first monitoring data is analyzed using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple groups of first sample data, and the multiple groups of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; The target microservice is updated based on a first predicted traffic value of the target microservice in a future time period.

2. The method according to claim 1, characterized in that The network traffic data is used to reflect the service information of the target object accessing the target microservice, and the service information includes at least one of the following: access time, accessed Internet Protocol IP address, and requested resource type; The user behavior data is used to reflect the behavior information of the target object when using the target microservice, and the behavior information includes at least one of the following: click behavior data, browsing behavior data, and purchase behavior data; The service performance data is used to reflect the operating status information of the target microservice, and the operating status information includes at least one of the following: service response time, throughput, and service response error rate.

3. The method according to claim 1, characterized in that: The training process of the traffic prediction model includes: A plurality of groups of first sample data are formed based on a plurality of second monitoring data of a plurality of microservices in a plurality of first time periods and a plurality of second monitoring flow values ​​in a plurality of second time periods, wherein the second time period is any time period after the first time period; Constructing a machine learning model, wherein the type of the machine learning model includes: a decision tree model, a time series analysis model, or a random forest model; The machine learning model is iteratively trained using the multiple groups of first sample data to obtain the traffic prediction model.

4. The method according to claim 3, characterized in that Determining multiple groups of first sample data based on multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring flow values ​​in multiple second time periods includes: For each of the microservices, a plurality of initial monitoring data of the current microservice in a plurality of first time periods and a plurality of initial monitoring flow values ​​in a plurality of second time periods are obtained by using a preset method; Preprocessing the plurality of second monitoring data of the current microservice in the plurality of first time periods and the plurality of second monitoring flow values ​​in the plurality of second time periods respectively to obtain the plurality of second monitoring data of the current microservice in the plurality of first time periods and the plurality of second monitoring flow values ​​in the plurality of second time periods, wherein the preprocessing operation comprises at least one of the following: data cleaning and data standardization; The multiple groups of first sample data are formed based on multiple second monitoring data of the multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in the multiple second time periods.

5. The method according to claim 3, characterized in that: Iteratively training the machine learning model using the multiple groups of first sample data to obtain the traffic prediction model includes: For each training batch in the iterative training process, the second monitoring data of the microservices in the first time period in each first training sample of the training batch is input into the machine learning model to obtain the second predicted traffic value of each microservice in the second time period output by the machine learning model, and the target loss function is constructed using the second predicted traffic value and the corresponding second monitored traffic value, and the model parameters of the machine learning model are adjusted according to the target loss function, wherein the model parameters include at least one of the following: learning rate and number of iterations.

6. The method according to claim 1, characterized in that Updating the target microservice based on a first predicted traffic value of the target microservice in a future time period includes: An update priority of the target microservice in the microservice system is determined based on a first predicted traffic value of the target microservice in a future time period, and the target microservice is updated according to the update priority, wherein the microservice system includes the target microservice and multiple other microservices, and the smaller the first predicted traffic value of the target microservice in the future time period, the higher the update priority of the target microservice in the microservice system, and conversely, the larger the first predicted traffic value of the target microservice in the future time period, the lower the update priority of the target microservice in the microservice system.

7. The method according to claim 1, characterized in that After updating the target microservice based on the first predicted traffic value of the target microservice in the future time period, the method further includes: The first monitoring data is analyzed using a pre-trained resource usage prediction model to obtain resource usage prediction information of the target microservice in a future time period, wherein the resource usage prediction model is obtained by iterative training using multiple sets of second sample data, and the multiple sets of second sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple resource usage information in multiple second time periods, and the resource usage information includes at least one of the following: central processing unit CPU occupancy information, memory occupancy information; Determine a service scoring result of the target microservice in a future time period based on the resource usage prediction information and the first predicted traffic value; Determine whether the service rating result is lower than a preset rating threshold; When the service scoring result is not lower than the scoring threshold, increasing exposure of the updated target microservice; When the service scoring result is lower than the scoring threshold, the exposure of the updated target microservice is reduced.

8. The method according to claim 1, characterized in that: After updating the target microservice based on the first predicted traffic value of the target microservice in the future time period, the method further includes: Determine whether a first predicted traffic value of the target microservice in a future time period is lower than a preset safe traffic threshold; When the first predicted traffic value is not lower than the safety traffic threshold, determining that the updated target microservice is in an abnormal state, and performing a rollback operation on the updated target microservice; When the first predicted traffic value is lower than the safe traffic threshold, it is determined that the updated target microservice is in a safe state, and the updated target microservice remains unchanged.

9. A microservice update device, characterized in that: include: An acquisition module, configured to acquire first monitoring data of a target microservice in a current time period, wherein the first monitoring data includes at least one of the following: network traffic data, user behavior data, and service performance data; A prediction module, used to analyze the first monitoring data using a pre-trained traffic prediction model to obtain a first predicted traffic value of the target microservice in a future time period, wherein the traffic prediction model is obtained by iterative training using multiple sets of first sample data, and the multiple sets of first sample data are composed of multiple second monitoring data of multiple microservices in multiple first time periods and multiple second monitoring traffic values ​​in multiple second time periods; An updating module is used to update the target microservice based on a first predicted traffic value of the target microservice in a future time period.

10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the microservice update method according to any one of claims 1 to 8 is implemented.