Application publishing method, device, and computer equipment based on microservice architecture
By adopting an automated grayscale release method in the microservice architecture, the existing application release method has been solved, and a more efficient, flexible and economical application release process has been achieved.
Patent Information
- Application Number
- CN202111655116.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing application publishing methods such as grayscale release and blue-green release have problems such as cumbersome operation, high economic costs and weak adaptability, and it is difficult to meet the needs of rapid iteration and efficient release.
Using the application publishing method based on the microservice architecture, the service version of the service instance is upgraded from the stable version to the grayscale version by setting the initial proportion and release strategy, and the grayscale promotion or rollback is automatically triggered through monitoring and perception policies.
It improves the agility and adaptability of application release, reduces operational complexity and economic costs, and realizes load balancing of application resources and elastic scaling of cloud-native microservice architecture.
Smart Images

Figure CN114385207B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of application publishing, and in particular to an application publishing method, apparatus, and computer equipment based on a microservice architecture. Background Art
[0002] With the development of new generation information technologies such as big data, artificial intelligence, mobile Internet, cloud computing, and the Internet of Things, the migration of applications to the cloud has become an irreversible trend. At the same time, the rapid growth of users and the rapid development of business have placed higher and higher demands on developers, who are required to provide stable services to users on the one hand and to implement rapid business iterations on applications on the other. During the release of online systems in the production environment, in order to maintain the smooth operation of the original functions and to test the new functions at the same time, corresponding release plans are usually introduced for the online systems. Currently common release plans include: grayscale release and blue-green release.
[0003] Among them, the existing application grayscale release technology solution is implemented by adjusting the node ratio of the online application instance, which requires constantly switching the traffic load of the new system, which is easy to consume a lot of time. The existing blue-green release technology solution can be implemented through network environment isolation. The network environment isolation solution is to build two sets of microservice cluster environments, one to provide normal services for the old system, and one to release the new system. After the new system is released, the traffic is switched through the load balancing device. Once a problem is found, it can be quickly switched back to the original version. However, the blue-green release test solution requires running two sets of programs, and the hardware requirements are twice the daily requirements, which is easy to bring about a large economic cost. Whether it is grayscale release or blue-green release, there are certain limitations for application upgrades and iterations, the operation is cumbersome and error-prone, the adaptability is weak, and the long-term feasibility satisfies business needs. Summary of the invention
[0004] Based on this, it is necessary to provide an application publishing method, apparatus, computer device, storage medium and computer program product based on a microservice architecture to address the above technical problems.
[0005] In a first aspect, the present disclosure provides an application publishing method based on a microservice architecture. The method comprises:
[0006] According to the set initial ratio and release strategy, the service version of the service instance in the microservice architecture is upgraded from the stable version to the gray version;
[0007] Repeat the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes the following steps:
[0008] Monitor all service instances whose current service version is the grayscale version, and obtain the indicator data of the monitored service instances;
[0009] The indicator data is judged according to a preset perception strategy to obtain a judgment result;
[0010] When the judgment result satisfies the grayscale promotion condition or the grayscale rollback condition, the release strategy is updated, and the grayscale promotion or grayscale rollback is performed synchronously.
[0011] In one embodiment, before upgrading the service version of the service instance in the microservice architecture from a stable version to a gray version according to the set initial ratio and release strategy, the process includes:
[0012] Grayscale attributes are defined for service instances in a microservice architecture. The grayscale attributes are bound to the service instances and stored in metadata of the service instances. The grayscale attributes include a service version, a service address, and a connection port.
[0013] In one embodiment, when the judgment result satisfies the grayscale promotion condition or satisfies the grayscale rollback condition, updating the release strategy and synchronously performing the grayscale promotion or grayscale rollback includes:
[0014] If the judgment result satisfies the grayscale promotion condition, sending a grayscale promotion instruction;
[0015] Calculate the upgrade ratio according to the grayscale promotion instruction and the release strategy;
[0016] Updating the release strategy according to the upgrade ratio, and adjusting the online grayscale version traffic according to the updated release strategy;
[0017] Grayscale promotion is performed according to the upgrade ratio.
[0018] In one embodiment, performing grayscale promotion according to the upgrade ratio includes:
[0019] Locate service instances with stable service versions in the microservice architecture;
[0020] The service version of the located service instance is upgraded to the grayscale version according to the upgrade ratio.
[0021] In one embodiment, when the judgment result satisfies the grayscale promotion condition or satisfies the grayscale rollback condition, updating the release strategy and synchronously performing the grayscale promotion or grayscale rollback includes:
[0022] If the judgment result satisfies the grayscale rollback condition, sending a grayscale rollback instruction;
[0023] Calculate the rollback ratio according to the grayscale rollback instruction and the release strategy;
[0024] Update the release strategy according to the rollback ratio, and adjust the online grayscale version traffic according to the updated release strategy;
[0025] Grayscale rollback is performed according to the rollback ratio.
[0026] In one embodiment, performing grayscale rollback according to the rollback ratio includes:
[0027] Locate the service instances whose service versions are grayscale versions in the microservice architecture;
[0028] Roll back the service version of the located service instance to a stable version according to the rollback ratio.
[0029] In one embodiment, before judging the indicator data according to the preset perception strategy, the process includes:
[0030] Get the corresponding perception strategy based on the ID information of the service to be updated.
[0031] In a second aspect, the present disclosure also provides an application publishing device based on a microservice architecture. The device includes: an initial publishing module, a data acquisition module, a perception module, a publishing module, and a processing module;
[0032] The initial release module is used to upgrade the service version of the service instance in the microservice architecture from the stable version to the gray version according to the set initial ratio and release strategy;
[0033] The processing module is used to instruct to repeatedly execute the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes:
[0034] Through the data acquisition module, all service instances whose current service version is a grayscale version are monitored to obtain indicator data of the monitored service instances;
[0035] By means of the perception module, the indicator data is judged according to a preset perception strategy to obtain a judgment result;
[0036] Through the release module, when the judgment result satisfies the grayscale promotion condition or satisfies the grayscale rollback condition, the release strategy is updated and the grayscale promotion or grayscale rollback is performed synchronously.
[0037] In one embodiment, the device further comprises:
[0038] The grayscale attribute module is used to define grayscale attributes for service instances in the microservice architecture. The grayscale attributes are bound to the service instances and stored in the metadata of the service instances. The grayscale attributes include service version, service address, and connection port.
[0039] In one embodiment, the publishing module includes:
[0040] An instruction unit, configured to send a grayscale promotion instruction if the judgment result satisfies the grayscale promotion condition;
[0041] A ratio calculation unit, used for calculating the upgrade ratio according to the grayscale promotion instruction and the release strategy;
[0042] A policy updating unit, configured to update the release policy according to the upgrade ratio, and adjust the online grayscale version traffic according to the updated release policy;
[0043] An execution unit is used to execute grayscale promotion according to the upgrade ratio.
[0044] In one embodiment, the execution unit includes:
[0045] The positioning subunit is used to locate the service instance whose service version is stable in the microservice architecture;
[0046] The service instance subunit is used to upgrade the service version of the located service instance to the grayscale version according to the upgrade ratio.
[0047] In one embodiment, the publishing module includes:
[0048] An instruction unit, configured to send a grayscale rollback instruction if the judgment result satisfies a grayscale rollback condition;
[0049] A ratio calculation unit, used for calculating the rollback ratio according to the grayscale rollback instruction and the release strategy;
[0050] A policy updating unit, configured to update the release policy according to the rollback ratio, and adjust the online grayscale version traffic according to the updated release policy;
[0051] An execution unit is used to execute grayscale rollback according to the rollback ratio.
[0052] In one embodiment, the execution unit includes:
[0053] The positioning subunit is used to locate the service instance whose service version is the gray version in the microservice architecture;
[0054] The service instance subunit is used to roll back the service version of the located service instance to a stable version according to the rollback ratio.
[0055] In one embodiment, the device further comprises:
[0056] The policy matching module is used to obtain the corresponding perception policy according to the ID information of the service to be updated.
[0057] In a third aspect, the present disclosure further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above-mentioned application publishing method based on microservice architecture when executing the computer program.
[0058] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned microservice architecture-based application publishing method when executed by a processor.
[0059] In a fifth aspect, the present disclosure further provides a computer program product, including a computer program, which implements the steps of the above-mentioned microservice architecture-based application publishing method when executed by a processor.
[0060] The above-mentioned application publishing method, apparatus, computer device, storage medium and computer program product based on microservice architecture have at least the following beneficial effects:
[0061] The present disclosure is based on the idea of configurable release. By configuring release strategies and perception strategies, it timely monitors the indicator data of the grayscale version, automatically triggers grayscale promotion and grayscale rollback, and is more adaptable to the application of complex business functions. It improves the agility of application release and facilitates adaptation to a faster application release rhythm. In addition, while changing the grayscale traffic ratio, the ratio of the stable version and the grayscale version of the service instance is changed synchronously to ensure the load balancing of application resources. At the same time, the elastic scaling function of the cloud-native microservice architecture is expanded. When executing grayscale changes, the elastic scaling instructions of resources are asynchronously executed to achieve second-level strategy and grayscale release synchronization of service resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0063] Figure 1 An application environment diagram of an application publishing method based on a microservice architecture in an embodiment;
[0064] Figure 2 A schematic diagram of a process of publishing an application based on a microservice architecture in one embodiment;
[0065] Figure 3 A flowchart of a method for publishing an application based on a microservice architecture in one embodiment;
[0066] Figure 4 A schematic diagram of a process of performing grayscale promotion based on a judgment result in one embodiment;
[0067] Figure 5 A schematic diagram of a process of performing grayscale promotion in one embodiment;
[0068] Figure 6 A schematic diagram of a process of performing grayscale rollback based on a judgment result in one embodiment;
[0069] Figure 7 A schematic diagram of a process of performing grayscale rollback in one embodiment;
[0070] Figure 8 A structural block diagram of an application publishing device based on a microservice architecture in an embodiment;
[0071] Fig. 9 It is a structural block diagram of a publishing module in one embodiment;
[0072] Fig.10 is a structural block diagram of an execution unit in one embodiment;
[0073] Fig.11 FIG. 4 is a block diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0075] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure belongs. The terms used herein in the specification of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure.
[0076] The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims. The terms "comprises," "comprising," or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, method, product, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a process, method, product, or device. In the absence of further restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product, or device comprising the elements.
[0077] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" and the like specify the presence of stated features, wholes, steps, operations, components, parts, or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof. At the same time, in this specification, the term "and / or" includes any and all combinations of the relevant listed items.
[0078] The application publishing method based on microservice architecture provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the microservice architecture 104 provides application services to the client 102 through the network, and the microservice architecture 104 includes an entry gateway, several service instances, and a policy deployment middleware. The user request of the client 102 passes through the entry gateway 103 to the microservice architecture 104, and the microservice architecture 104 responds to the user request to provide services to the client 102. Compared with the monolithic application, the microservice architecture 104 contains all the required services. The microservice architecture 104 can generally be understood as dividing a single application into various small, interconnected services, one service completes a relatively single function, and remains independent and decoupled from each other. The applications and services of the microservice architecture 104 can be deployed on the cloud. The microservice architecture 104 includes a data storage system that can store the data that the microservice architecture 104 needs to process. The data storage system can be integrated in the microservice architecture 104, and the data storage system can be deployed on each service instance. The data storage system can also be placed on the cloud or other network servers. The policy deployment middleware can be an independent system independent of each microservice instance. Its functions include monitoring the service instances and obtaining various indicators of the service instances. If the indicators meet the configured perception policies, it can autonomously trigger grayscale promotion or grayscale rollback.
[0079] The client 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.
[0080] In some embodiments of the present disclosure, Figure 2 As shown, a method for publishing an application based on a microservice architecture is provided. Figure 1 The policy deployment middleware in is used as an example to illustrate the following steps:
[0081] Step S10: According to the set initial ratio and release strategy, the service version of the service instance in the microservice architecture is upgraded from the stable version to the gray version.
[0082] Specifically, for microservice architecture, application release usually refers to the gradual replacement of updated versions of service instances that provide application services. The original service version of the service instance is a stable version, and the updated service version is a grayscale version. After the version of a service to be updated is updated, the service version on all service instances needs to be gradually updated. According to the preset release strategy and the set initial ratio, the service version on a part of the service instances in the microservice architecture is upgraded. For example, the initial ratio can be 10%. When the total number of service instances is 10, the service version of one of the service instances is upgraded first. Release strategies can include blue-green release strategies and grayscale release strategies.
[0083] Step S20: monitor all service instances whose current service version is a grayscale version, and obtain indicator data of the monitored service instances.
[0084] Specifically, the monitoring function monitors all service instances whose current service version is the gray version, and obtains the indicator data of the monitored service instances. The indicator data can represent the running status of the service instance, such as health heartbeat detection, function effectiveness perception, request traffic management, environmental resource monitoring, etc.
[0085] Step S30: judging the indicator data according to a preset perception strategy to obtain a judgment result.
[0086] Specifically, the indicator data is judged by a preset perception strategy, wherein the perception strategy can be a judgment condition for deciding whether to issue grayscale promotion instructions and grayscale rollback instructions. Furthermore, the perception strategy can include service anomaly ratio, slow call ratio and system resources. The service anomaly ratio refers to the percentage of the number of specific exceptions thrown by a certain interface to the total number of requests of the interface under the premise of a certain amount of transaction requests per unit time; the slow call ratio refers to the percentage of the number of transactions whose response time of the transaction interface exceeds the threshold to the total number under the premise of a certain amount of requests per unit time; the system resources can configure the CPU, memory, network IO, disk read and write and other parameters of the application service node.
[0087] By comparing the monitored indicator data with the judgment conditions of the perception strategy, the judgment result can be obtained. The judgment result can be that the gray promotion condition is met or the gray rollback condition is met. By monitoring the matched transactions, and recording the time points and values that exceed the preset configuration threshold of the perception strategy into the memory, when the record points of the transaction in the unit time do not exceed the configured first threshold, the judgment result meets the gray promotion condition; when the record points of the transaction in the unit time exceed the configured second threshold, the judgment result meets the gray rollback condition. Among them, the first threshold can be equal to the second threshold, or it can be different. For example, for a certain order service, monitor the service instance of the gray version of the order service, and obtain the order error rate of the service instance within 3 hours. When the order error rate is less than the preset first threshold of the configuration (for example, 20%), the judgment result is that the gray promotion condition is met; when the order error rate is greater than the preset second threshold of the configuration (for example, 20%, or 50%), the judgment result is that the gray rollback condition is met.
[0088] Step S40: When the judgment result satisfies the grayscale promotion condition or the grayscale rollback condition, the release strategy is updated, and the grayscale promotion or grayscale rollback is performed synchronously.
[0089] Specifically, after determining the judgment result according to the perception strategy, the release strategy is updated according to the judgment result. The entry gateway and microservice instance of the microservice architecture read the updated release strategy and adjust the grayscale traffic according to the updated release strategy. At the same time, grayscale promotion or grayscale rollback is synchronously performed according to the judgment result.
[0090] Step S50: Repeat the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes the above steps S20-S40.
[0091] Specifically, repeat the above steps S20-S40, obtain the judgment result according to the perception strategy in real time, update the release strategy according to the judgment result in time, and perform grayscale promotion or grayscale rollback. Figure 3 The flowchart shown in the figure is repeated until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions, that is, when monitoring all service instances whose current service versions are grayscale versions, it is determined that the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions, and then the application release is completed. When the service versions of all service instances are grayscale versions, the service versions of all service instances have been upgraded to grayscale versions through grayscale promotion. When the service versions of all service instances are stable versions, the service versions of all service instances have been restored to stable versions through grayscale rollback. Subsequently, the grayscale version that failed to be released can be optimized according to the monitored indicator data, which will help the next application release.
[0092] In the above-mentioned application release method based on microservice architecture, based on the configurable release idea, by configuring the release strategy and perception strategy, the indicator data of the grayscale version is monitored in time, and the grayscale promotion and grayscale rollback are automatically triggered, which is more adaptable to the application of complex business functions, improves the agility of application release, and facilitates adaptation to a faster application release rhythm; in addition, while changing the grayscale traffic ratio, the ratio of the stable version and the grayscale version of the service instance is changed synchronously to ensure the load balancing of application resources; at the same time, the elastic scaling function of the cloud-native microservice architecture is expanded, and the resource elastic scaling instructions are asynchronously executed when executing the grayscale change, so as to achieve the second-level strategy and service resource grayscale release synchronization.
[0093] In some embodiments of the present disclosure, before step S10, the process includes:
[0094] Grayscale attributes are defined for service instances in a microservice architecture. The grayscale attributes are bound to the service instances and stored in metadata of the service instances. The grayscale attributes include a service version, a service address, and a connection port.
[0095] Specifically, in order to locate the service instance in the application release, the service instance that provides the grayscale version service can be accurately addressed, and the grayscale attributes are defined in advance for each service instance so that the service instance can be determined based on the grayscale attributes. Normally, a unique service instance can be determined based on the grayscale attributes. When multiple service instances are located based on the grayscale attributes, the unique service instance can be determined based on a random algorithm, a polling algorithm, a failure retry algorithm, etc. The grayscale attributes can include the service version currently provided by the service instance, as well as the provided service address and connection port, and can also include the communication protocol, IP, weight, etc.
[0096] Furthermore, the grayscale attributes of the service instance are isolated from the external network gateway for access rights, and exposed to the internal network for configuration and related calculations by the application of the service instance, to ensure the information security of the service characteristics. The grayscale attributes are bound to the service instance, defined in the metadata of the service instance, and can be managed uniformly in the microservice registration center of the microservice framework. For example, the registration center can include Redis (Remote Dictionary Server), Zookeeper (a reliable coordination system for distributed systems), Eureka (the first generation registration center of spring cloud), Nacos (Ali open source integrated microservice component of the registration center and configuration center), etc. By enabling the configuration of grayscale attribute access rights, any node in the microservice framework can access the grayscale attributes of each service instance through the registration center service list.
[0097] The generation of grayscale attributes can be separated from manual configuration. Grayscale attributes with pipeline flow characteristics combined with cloud-native architecture can be automatically generated by configuring pipeline release strategies, such as service version, release timestamp, IP, port number and other attributes. Such attributes will be updated every time a service is released; other grayscale attributes that cannot be generated with the help of pipelines, such as service name, dependency reference version, grayscale detection port, etc., can be generated based on the generated grayscale attributes. The automatically generated grayscale attributes fully support the distinction between each service instance node. In addition, service metadata also supports manual configuration, and operation and maintenance personnel can enter the service list of the registration center to configure the service metadata content.
[0098] In this embodiment, by pre-configuring the grayscale attributes of the service instance, it is convenient to accurately address and locate each service instance, and the generation of grayscale attributes supports manual configuration and automatic generation according to preset strategies, which not only meets the configuration flexibility but also supports manual intervention.
[0099] In some embodiments of the present disclosure, Figure 4 As shown, step S40 includes:
[0100] Step S412: When the judgment result satisfies the grayscale promotion condition, a grayscale promotion instruction is sent.
[0101] Specifically, when it is determined according to the perception strategy that the indicator data meets the grayscale promotion conditions, the strategy deployment middleware of the microservice architecture sends a grayscale promotion instruction.
[0102] Step S414: Calculate the upgrade ratio according to the grayscale promotion instruction and the release strategy.
[0103] Specifically, according to the grayscale promotion instructions and release strategy, the upgrade ratio is calculated using the overloaded grayscale load balancing algorithm.
[0104] Step S416: updating the release strategy according to the upgrade ratio, and adjusting the online grayscale version traffic according to the updated release strategy.
[0105] Specifically, the release strategy is updated according to the upgrade ratio, the entry gateway and microservice instance of the microservice architecture read the updated release strategy, and adjust the online grayscale version traffic according to the updated release strategy.
[0106] Furthermore, when grayscale promotion is triggered according to the perception strategy, the updated release strategy can be configured to support three modes: stable traffic release, function traffic release, and full traffic release. The stable traffic release mode supports the release of a specified configured traffic percentage when executing grayscale promotion, that is, the percentage of traffic released to the grayscale version service after grayscale promotion is (x+y)% (x is the original split traffic percentage, y is the configured release traffic percentage), until the grayscale traffic percentage reaches 100%. The function traffic release mode supports embedding the release calculation step before grayscale promotion, that is, the release traffic percentage is calculated through a custom function, and then grayscale promotion is performed, which can be (x+fun(x))%, where fun(x) represents the release traffic calculation function, which represents the grayscale traffic percentage after a grayscale promotion. The full traffic release mode is simpler than the above two release modes, that is, the original version will be completely replaced with the grayscale version as long as the grayscale promotion is triggered.
[0107] Step S418: performing grayscale promotion according to the upgrade ratio.
[0108] Specifically, grayscale promotion is performed according to the upgrade ratio, and the ratio of the stable version to the grayscale version of the microservice instance node is changed synchronously.
[0109] This embodiment updates the release strategy in a timely manner according to the perception strategy and indicator data, and synchronously adjusts the grayscale traffic and the ratio of the stable version to the grayscale version of the microservice instance node, expands the elastic scaling function of the cloud native architecture, asynchronously executes resource elastic scaling instructions when executing grayscale changes, and realizes the grayscale release synchronization of strategies and service resources in seconds.
[0110] In some embodiments of the present disclosure, Figure 5 As shown, the above step S418 includes:
[0111] Step S4182: Locate the service instance whose service version is a stable version in the microservice architecture.
[0112] Specifically, while changing the grayscale traffic ratio, the ratio of the stable version to the grayscale version of the service instance is changed synchronously. First, locate the service instance whose service version in the microservice architecture is the stable version.
[0113] Step S4184: Upgrading the service version of the located service instance to a grayscale version according to the upgrade ratio.
[0114] Specifically, the service version of the located service instance is upgraded to the gray version according to the upgrade ratio, so that the gray traffic ratio is synchronized with the ratio of the stable version to the gray version of the service instance node.
[0115] In this embodiment, when the perception strategy determines that the indicator data meets the grayscale promotion conditions, the grayscale promotion instruction is issued, and the upgrade ratio is calculated, and the release strategy for the grayscale promotion is updated in time to achieve the change of the grayscale traffic ratio, and the ratio of the stable version and the grayscale version of the microservice instance node is changed synchronously, so as to achieve the synchronization of the grayscale release of the second-level strategy and service resources.
[0116] In some embodiments of the present disclosure, Figure 6 As shown, the above step S40 includes:
[0117] Step S422: When the judgment result satisfies the grayscale rollback condition, a grayscale rollback instruction is sent.
[0118] Specifically, when it is determined according to the perception strategy that the indicator data meets the grayscale rollback conditions, the strategy deployment middleware of the microservice architecture sends a grayscale rollback instruction.
[0119] Step S424: Calculate the rollback ratio according to the grayscale rollback instruction and the release strategy.
[0120] Specifically, according to the grayscale rollback instruction and the release strategy, the rollback ratio is calculated using the overloaded grayscale load balancing algorithm.
[0121] Step S426: updating the release strategy according to the rollback ratio, and adjusting the online grayscale version traffic according to the updated release strategy.
[0122] Specifically, the release strategy is updated according to the rollback ratio. The entry gateway and microservice instance of the microservice architecture read the updated release strategy and adjust the online grayscale version traffic according to the updated release strategy.
[0123] Step S428: Locate the service instance whose service version is the grayscale version in the microservice architecture.
[0124] Specifically, the grayscale rollback is performed according to the rollback ratio, and the ratio of the stable version to the grayscale version of the microservice instance node is changed synchronously.
[0125] In some embodiments of the present disclosure, Figure 7 As shown, the above step S428 includes:
[0126] Step S4282: Adjust the online grayscale version traffic according to the updated release strategy.
[0127] Specifically, when changing the grayscale traffic ratio, the ratio of the stable version to the grayscale version of the service instance is changed synchronously. First, locate the service instance whose service version is the grayscale version in the microservice architecture.
[0128] Step S4284: Roll back the service version of the located service instance to a stable version according to the rollback ratio.
[0129] Specifically, when the grayscale rollback is triggered according to the perception strategy, the updated release strategy is configured to adjust the online grayscale version traffic so that the percentage of all grayscale traffic reaches 0%. While changing the grayscale traffic ratio, the ratio of the stable version to the grayscale version of the service instance is changed synchronously so that the grayscale traffic ratio is synchronized with the ratio of the stable version to the grayscale version of the service instance node.
[0130] In some embodiments of the present disclosure, the above step S30 includes:
[0131] Get the corresponding perception strategy based on the ID information of the service to be updated.
[0132] Specifically, in the microservice framework, when publishing a service to be updated, the perception strategy corresponding to the service to be updated can be first obtained according to the ID information of the service to be updated. Different services can obtain corresponding indicator data and obtain matching perception strategies according to the ID information of the service, that is, the perception strategy and the service are one-to-one.
[0133] This embodiment obtains the perception strategy corresponding to the service version through the service version, so that the perception strategy perceives different services, adapts to the publishing requirements of different service versions, and is friendly to the expansion of microservices in the microservice framework.
[0134] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0135] Based on the same inventive concept, the embodiment of the present disclosure also provides an application publishing device based on a microservice architecture for implementing the above-mentioned application publishing method based on a microservice architecture. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in the one or more embodiments of the application publishing device based on a microservice architecture provided below can refer to the limitations of the application publishing method based on a microservice architecture above, and will not be repeated here.
[0136] The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiments of this specification and a device in combination with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiments of the present disclosure is as described in the following embodiments. Since the implementation scheme and method for solving the problem of the device are similar, the implementation of the specific device in the embodiments of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware for predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0137] In some embodiments of the present disclosure, Figure 8 As shown, an application publishing device based on a microservice architecture is provided, and the device Z00 shown may include: an initial publishing module Z10, a data acquisition module Z20, a perception module Z30, a publishing module Z40, and a processing module Z50;
[0138] The initial release module Z10 is used to upgrade the service version of the service instance in the microservice architecture from the stable version to the gray version according to the set initial ratio and release strategy;
[0139] The processing module Z50 is used to repeatedly execute the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes:
[0140] Through the data acquisition module Z20, all service instances whose current service version is a grayscale version are monitored to obtain indicator data of the monitored service instances;
[0141] By means of the perception module Z30, the indicator data is judged according to a preset perception strategy to obtain a judgment result;
[0142] Through the release module Z40, when the judgment result satisfies the grayscale promotion condition or the grayscale rollback condition, the release strategy is updated and the grayscale promotion or grayscale rollback is performed synchronously.
[0143] In some embodiments of the present disclosure, as shown in the figure, the device further includes:
[0144] The grayscale attribute module is used to define grayscale attributes for service instances in the microservice architecture. The grayscale attributes are bound to the service instances and stored in the metadata of the service instances. The grayscale attributes include service version, service address, and connection port.
[0145] In some embodiments of the present disclosure, Fig. 9 As shown, the release module Z40 includes:
[0146] Instruction unit Z42, used for sending a grayscale promotion instruction when the judgment result meets the grayscale promotion condition;
[0147] A ratio calculation unit Z44, used for calculating the upgrade ratio according to the grayscale promotion instruction and the release strategy;
[0148] A policy updating unit Z46 is used to update the release policy according to the upgrade ratio, and adjust the online gray version traffic according to the updated release policy;
[0149] The execution unit Z48 is used to perform grayscale promotion according to the upgrade ratio.
[0150] In some embodiments of the present disclosure, Fig.10 As shown, the execution unit Z48 includes:
[0151] The positioning subunit Z482 is used to locate the service instance whose service version is a stable version in the microservice architecture;
[0152] The service instance subunit Z484 is used to upgrade the service version of the located service instance to the gray version according to the upgrade ratio.
[0153] In some embodiments of the present disclosure, Fig. 9 As shown, the release module Z40 includes:
[0154] An instruction unit Z42 is used to send a grayscale rollback instruction if the judgment result meets the grayscale rollback condition;
[0155] A ratio calculation unit Z44, used for calculating the rollback ratio according to the grayscale rollback instruction and the release strategy;
[0156] A policy updating unit Z46 is used to update the release policy according to the rollback ratio, and adjust the online gray version traffic according to the updated release policy;
[0157] The execution unit Z48 is used to execute grayscale rollback according to the rollback ratio.
[0158] In some embodiments of the present disclosure, Fig.10 As shown, the execution unit Z46 includes:
[0159] The positioning subunit Z482 is used to locate the service instance whose service version is the gray version in the microservice architecture;
[0160] The service instance subunit Z484 is used to roll back the service version of the located service instance to a stable version according to the rollback ratio.
[0161] In some embodiments of the present disclosure, as shown in the figure, the device further includes:
[0162] The policy matching module is used to obtain the corresponding perception policy according to the ID information of the service to be updated.
[0163] Each module in the above-mentioned application publishing device based on microservice architecture can be implemented in whole or in part through software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. It should be noted that the division of modules in the embodiment of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0164] Based on the aforementioned description of the embodiment of the application publishing method based on the microservice architecture, in another embodiment provided in the present disclosure, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an application publishing method based on a microservice architecture is implemented.
[0165] Those skilled in the art will understand that the structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0166] Based on the aforementioned description of the embodiment of the application publishing method based on the microservice architecture, in another embodiment provided in the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0167] Based on the aforementioned description of the embodiment of the application publishing method based on the microservice architecture, in another embodiment provided in the present disclosure, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.
[0168] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0169] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0170] In the description of this specification, the description with reference to the terms "some embodiments", "other embodiments", "ideal embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic descriptions of the above terms do not necessarily refer to the same embodiment or example.
[0171] It is understandable that the various embodiments of the above method in this specification are described in a progressive manner, and the same / similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For related parts, refer to the description of other method embodiments.
[0172] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features of the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0173] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the patent of the present disclosure shall be subject to the attached claims.
Claims
1. A method for publishing an application based on a microservice architecture, characterized in that: The method comprises: According to the set initial ratio and release strategy, the service version of the service instance in the microservice architecture is upgraded from the stable version to the gray version; Repeat the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes the following steps: Monitor all service instances whose current service version is the grayscale version, and obtain the indicator data of the monitored service instances; The indicator data is judged according to a preset perception strategy to obtain a judgment result; If the judgment result satisfies the grayscale promotion condition, sending a grayscale promotion instruction; Calculate the upgrade ratio according to the grayscale promotion instruction and the release strategy; Updating the release strategy according to the upgrade ratio, and adjusting the online grayscale version traffic according to the updated release strategy; Perform grayscale promotion according to the upgrade ratio; If the judgment result satisfies the grayscale rollback condition, sending a grayscale rollback instruction; Calculate the rollback ratio according to the grayscale rollback instruction and the release strategy; Update the release strategy according to the rollback ratio, and adjust the online grayscale version traffic according to the updated release strategy; Grayscale rollback is performed according to the rollback ratio.
2. The method according to claim 1, characterized in that The process of upgrading the service version of a service instance in a microservice architecture from a stable version to a gray version according to the set initial ratio and release strategy includes: Grayscale attributes are defined for service instances in a microservice architecture. The grayscale attributes are bound to the service instances and stored in metadata of the service instances. The grayscale attributes include a service version, a service address, and a connection port.
3. The method according to claim 1, characterized in that The performing grayscale promotion according to the upgrade ratio comprises: Locate service instances with stable service versions in the microservice architecture; The service version of the located service instance is upgraded to the grayscale version according to the upgrade ratio.
4. The method according to claim 1, characterized in that: The performing grayscale rollback according to the rollback ratio comprises: Locate the service instances whose service versions are grayscale versions in the microservice architecture; Roll back the service version of the located service instance to a stable version according to the rollback ratio.
5. The method according to claim 1, characterized in that: Before judging the indicator data according to the preset perception strategy, the method includes: Get the corresponding perception strategy based on the ID information of the service to be updated.
6. An application publishing device based on microservice architecture, characterized in that: The device comprises: an initial publishing module, a data acquisition module, a perception module, a publishing module, and a processing module; The initial release module is used to upgrade the service version of the service instance in the microservice architecture from the stable version to the gray version according to the set initial ratio and release strategy; The processing module is used to instruct to repeatedly execute the first processing method until the service versions of all service instances in the current microservice architecture are grayscale versions or stable versions; the first processing method includes: Through the data acquisition module, all service instances whose current service version is a grayscale version are monitored to obtain indicator data of the monitored service instances; By means of the perception module, the indicator data is judged according to a preset perception strategy to obtain a judgment result; By means of the issuing module, when the judgment result satisfies the grayscale promotion condition, a grayscale promotion instruction is sent; By means of the release module, the upgrade ratio is calculated according to the grayscale promotion instruction and the release strategy; By means of the release module, the release strategy is updated according to the upgrade ratio, and the online grayscale version flow is adjusted according to the updated release strategy; By means of the release module, grayscale promotion is performed according to the upgrade ratio; By means of the issuing module, when the judgment result satisfies the grayscale rollback condition, a grayscale rollback instruction is sent; Calculating the rollback ratio according to the grayscale rollback instruction and the release strategy through the release module; By means of the release module, the release strategy is updated according to the rollback ratio, and the online grayscale version flow is adjusted according to the updated release strategy; Grayscale rollback is performed according to the rollback ratio through the publishing module.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Service grayscale publishing method, device and system, and storage medium
CN109391655A
Gray release method and device and electronic device
CN110442361A
Cited By
Shared platform autonomous upgrading method based on graph neural network
CN121349492A