Blue-green publishing method and device, electronic equipment and storage medium

By determining the request type and flow cutting status of the target service call in the blue-green publishing scheme, accurately distinguishing the traffic control strategy, solving the risk of being unable to control remote calls and message calls between microservices in the prior art, and improving the security and release efficiency of version changes.

CN120547239APending Publication Date: 2025-08-26NANJING LINGXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510767224.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

The existing blue-green release solution cannot effectively control remote calls and message calls between different microservices, resulting in huge risks in version changes and cannot achieve true comprehensive traffic control.

Method used

By determining the request type of target service call and accurately distinguishing the traffic control strategy based on the request type and flow cutting status, ensuring accurate distinction and flow control of different requests.

Benefits of technology

It improves the security of version changes, solves the problems of some scenarios that cannot be controlled and user traffic in the existing technology, and achieves more efficient release efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120547239A_ABST
    Figure CN120547239A_ABST
Patent Text Reader

Abstract

The invention discloses a blue-green publishing method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a request type of a target request called by a target service; determining a flow control strategy of the target request according to the request type of the target request and the flow switching state of the target service; the flow cutting state is used for describing whether the target service is published. According to the technical scheme, the flow control strategy of the target request is accurately determined according to the request types of different requests and the flow switching state of the target service, the problems that in the prior art, part of scenes cannot be controlled, and user flow is random are solved, and the version change safety is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a blue-green publishing method, device, electronic device, and storage medium. Background Art

[0002] With the development of software technology and the widespread application of microservice architecture, the way services are released has also undergone tremendous changes. The latest service release method is blue-green release, which has the advantages of gradual traffic switching, rapid rollback, and improved release efficiency.

[0003] Currently, the existing blue-green release solutions in the industry often only support flow control for HTTP type requests. However, in the existing software architecture, there are a large number of remote calls and message calls between different microservices. Traffic control cannot be performed for these requests, and there is still a huge risk of version changes, making it impossible to achieve true and comprehensive blue-green release. Summary of the Invention

[0004] The present invention provides a blue-green publishing method, device, electronic device and storage medium to solve the problems of uncontrollable scenes and random user traffic in the existing technology, and effectively improve the security of version changes.

[0005] According to one aspect of the present invention, a blue-green release method is provided, the method comprising:

[0006] Determine the request type of the target request for the target service call;

[0007] The flow control strategy of the target request is determined according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is released.

[0008] According to another aspect of the present invention, a blue-green publishing device is provided, the device comprising:

[0009] A type determination module, used to determine the request type of the target request called by the target service;

[0010] The flow control module is used to determine the flow control strategy of the target request according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is released.

[0011] According to another aspect of the present invention, an electronic device is provided, comprising:

[0012] at least one processor; and

[0013] a memory communicatively connected to the at least one processor; wherein,

[0014] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the blue-green publishing method described in any embodiment of the present invention.

[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the blue-green publishing method described in any embodiment of the present invention when executed.

[0016] The technical solution of the embodiment of the present invention determines the request type of the target request called by the target service, ensures accurate distinction between different requests, and further determines the flow control strategy of the target request based on the request type of the target request and the flow switching status of the target service, accurately deriving the flow control strategy for different requests, solving the problems of some scenarios that cannot be controlled and random user traffic in the existing technology, and effectively improving the security of version changes.

[0017] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 This is a flow chart of a blue-green release method provided according to an embodiment of the present invention;

[0020] Figure 2 is a flowchart of another blue-green release method provided according to an embodiment of the present invention;

[0021] Figure 3 This is a flowchart of another blue-green release method provided according to an embodiment of the present invention;

[0022] Figure 4 This is a structural diagram of a blue-green publishing device provided according to an embodiment of the present invention;

[0023] Figure 5 3 is a schematic structural diagram of an electronic device for implementing the blue-green publishing method according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0025] It should be noted that the terms "first", "second", "third", etc. in the description and claims of the present invention 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 numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes 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.

[0026] Example 1

[0027] Figure 1 This is a flow chart of a blue-green publishing method provided by an embodiment of the present invention. This embodiment is applicable to the blue-green publishing situation in the service publishing mode. The method can be executed by a blue-green publishing device. The blue-green publishing device can be implemented in the form of hardware and / or software. The blue-green publishing device can be configured in any electronic device with network communication function. Figure 1 As shown, the blue-green publishing method of the present invention includes the following processes:

[0028] S110: Determine the request type of the target request called by the target service.

[0029] In software development, the target service can be understood as a service with a new version being released. To ensure a positive user experience, a blue-green release approach is used during the target service release process. Blue-green release is a release strategy for application deployment that achieves zero-downtime deployment and rapid rollback by maintaining two identical production environments (a "blue version" and a "green version").

[0030] The environment variables of the target service contain version information, which can include blue and green versions. The blue version can represent a stable version, that is, a version that has been fully tested, has mature functions, and has fewer bugs. The green version can be a beta version, that is, an update to the blue version. The functions may not yet be completely stable, but it contains new features.

[0031] During the release process, the target service will perform traffic control based on the called requests, that is, control the traffic ratio allocated to the blue version and the green version; the target service calls many types of requests, which can generally be classified into three categories, such as message requests, HTTP requests, and remote call (RPC) requests; message requests can include kafka and rocketMq; remote call requests can include dubbo and gRpc.

[0032] Specifically, request types are often related to network communication, interface calls, or program interactions. Therefore, after the target service is started, it receives various requests in real time. After the target service invokes the target request, it accurately determines the request type based on the network communication, interface call, or program associated with the target request. Alternatively, the request type can be determined based on specific technical scenarios, communication protocols, and business requirements.

[0033] S120 : Determine a flow control strategy for the target request according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is released.

[0034] The traffic switching state describes whether the target service is released and, after release, indicates the process of switching traffic between the blue and green versions. The target service's traffic switching states include released and non-released states. Release states include first grayscale, second grayscale, third grayscale, and full release. First grayscale, second grayscale, third grayscale, and full release gradually expand the scope of the green version in this order.

[0035] The first grayscale can be understood as the test scope of the green version is users who meet the preset whitelist; the request header of the request carries identification information, and the identification information is a representation of the user. Therefore, based on whether the identification information carried in the request header of the request meets the preset whitelist, it can be determined whether the user meets the preset whitelist, that is, whether the user of the request should be switched to the green version.

[0036] The second grayscale can be understood as testing the green version for users in the first region whose hash value is less than the preset switching granularity. The region identifier of the first region is stored in the request header, and the hash value can be calculated based on the identifier information carried in the request header. Therefore, whether to switch the requesting user to the green version is determined based on whether the region identifier in the request header is the region identifier of the first region and whether the corresponding hash value of the request is less than the preset switching granularity.

[0037] The third grayscale can be understood as the test scope of the green version being users in the second region and whose hash value is less than the preset switching granularity; the region identifier of the second region is stored in the request header of the request, and the hash value can be calculated based on the identification information carried in the request header of the request. Therefore, whether the requested user is switched to the green version is determined based on whether the region identifier in the request header is the region identifier of the second region and whether the hash value corresponding to the request is less than the preset switching granularity. The regional scope of the second region is larger than the regional scope of the first region. For example, the first region can be a specific city, and the second region can be nationwide.

[0038] A full release can be understood as a green version test in which all traffic is switched to the new version.

[0039] Specifically, when the target service is started, the present invention will start monitoring the configuration center and periodically pull the flow switching status of the target service. Different request types and flow switching status are associated with different flow control strategies. Therefore, according to the request type of the target request and the flow switching status of the target service, the flow control strategy of the target request can be accurately determined, and the target request can be processed according to the flow control strategy of the target request.

[0040] In an embodiment of the present invention, optionally, the present invention supports the simultaneous release of multiple target services. Before release, a service release order is created according to implementation needs, and each target service is identified by a release order number. During release, the target services contained in the release order are released in batches, and the green versions corresponding to the target services are pulled up in batches, and the blue versions are not changed. For all deployed target services, the environment variables contain the corresponding version information. When the service is started, the release version information is registered in the registration center, including the version number and the associated service list, where the registration center for http requests is consul, and the registration center for remote call (RPC) requests is zookeeper. The blue-green release method of each target service can adopt the blue-green release method of the present invention. In the general service update process, there are often demands for releases by multiple target services within the same time period. The present invention supports the simultaneous blue-green release of multiple target services, with higher release concurrency, further improving release efficiency.

[0041] The technical solution of the embodiment of the present invention determines the request type of the target request called by the target service, ensures accurate distinction between different requests, and further determines the flow control strategy of the target request based on the request type of the target request and the flow switching status of the target service, accurately deriving the flow control strategy for different requests, solving the problems of some scenarios that cannot be controlled and random user traffic in the existing technology, and effectively improving the security of version changes.

[0042] Example 2

[0043] Figure 2 This is a flowchart of another blue-green publishing method provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process of "when the request type of the target request is a message request, how to determine the flow control strategy of the target request according to the request type of the target request and the flow switching state of the target service" in the above embodiment. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the blue-green publishing method of the present invention includes the following processes:

[0044] S210 , the request type of the target request is a message request, and the target node corresponding to the target service is determined; the target node is a blue version node or a green version node.

[0045] Specifically, the target node corresponding to the target service is determined based on the target service's environment variables and the target service's blue version information. If the target service's environment variables match the target service's blue version information, the target node corresponding to the target service is the blue version node; if the target service's environment variables differ from the target service's blue version information, the target node corresponding to the target service is the green version node.

[0046] When the target request type is a message request, because there is no gateway routing logic for consumption requests, the information to be consumed corresponding to the message request needs to be consumed by the consumer group before it can be known whether the information obtained after consumption should be forwarded to the blue version or the green version, thereby accurately achieving traffic distribution.

[0047] Optionally, consumer groups are distributed in different partitions, so it is very important to accurately control the consumer groups to start consumption or static consumer group consumption. Then it is necessary to obtain the information of each consumer group to ensure that the consumer group can be accurately called later. Obtaining the information of each consumer group may include: when the target service is started, traversing each consumer group, and performing the following operations: if the target node is a green version node, then match the consumer group of the blue node for the target node, and match the remote call method with the same name as the consumer group for the consumer group of the blue node, and add the corresponding version of the consumer group when registering in the registration center zookeeper, that is, there is a corresponding association between the green version, the blue version consumer group matched by the green version, and the remote call method, so that the blue version node can call the consumer group and forward the consumed message to the green version.

[0048] Furthermore, the consumer group metadata for each consumer group is determined, and the corresponding version of the consumer group is determined based on the consumer group metadata. Specifically, the consumer group metadata for the consumer group is obtained, along with the version information introduced by the consumer group. If the consumer group metadata for the consumer group does not exist, the consumer group belongs to a newly added version, i.e., the green version. In this case, a new consumer group metadata entry is added, and the consumer group matches the green version.

[0049] S220: Determine whether to start the consumer group based on the flow switching status of the target node and the target service.

[0050] Specifically, after the target service is started, the target node is the node at the initial startup. When the target node is a green version node, the flow switching state is the release state and is not a full release, and there is a new consumer, the consumer group is started; otherwise, the consumer group is not started.

[0051] After the target service is started, the target node is the node at the initial startup. If the target node is a blue version node, the flow switching status is full release, and there is no new consumer, the consumer group is started; otherwise, the consumer group is not started.

[0052] After the target service is started, if the target service is in a non-published state, the consumer group is started directly.

[0053] Furthermore, during the subsequent operation of the target service, the specific processing process for starting and stopping the consumer group is as follows:

[0054] 1) If the traffic switching status is Release and the release is full, determine whether to start the consumer group based on the traffic switching status of the target node and the target service. This includes: If the target node is a Green version node, control the Green version node to start the consumer group. If the target node is a Blue version node, control the Blue version node not to start the consumer group. If the Blue version node has a consumer group started, stop the consumer group.

[0055] 2) If the switching status is the release status and not the full release, determine whether to start the consumer group based on the switching status of the target node and the target service. This includes: if the target node is a blue version node, control the blue version node to start the consumer group; if the target node is a green version node, control the green version node not to start the consumer group, and if the green version node has a started consumer group, stop the consumer group.

[0056] 3) If the target service's traffic switching status is not released, the consumer group is not started and processing is skipped.

[0057] In the embodiment of the present invention, whether to start a consumer group is determined according to the flow switching status of the target node and the target service, thereby ensuring that the same consumer group can only be consumed by one version.

[0058] Optionally, the target request corresponds to a piece of information to be consumed. After controlling the blue version node to start the consumption group, the method includes: controlling the consumption group to consume the piece of information to be consumed to obtain post-consumption information; the post-consumption information includes the identification information in the request header of the target request and / or the area identifier in the request header of the target request; the area identifier includes the area identifier of the first area or the area identifier of the second area; the area range of the second area is larger than the area range of the first area.

[0059] The target request corresponds to multiple pieces of information to be consumed. After the blue version node is controlled to start the consumption group, the method includes: controlling the consumption group to consume the multiple pieces of information to be consumed to obtain multiple pieces of post-consumption information, and determining whether the post-consumption information needs to be forwarded based on the identification information in the request header included in the post-consumption information and / or the area identification in the request header of the target request, and grouping the post-consumption information that needs to be forwarded into a group so that the post-consumption information that needs to be forwarded can be forwarded in batches at one time. The specific forwarding process is consistent with the processing method of one piece of information to be consumed.

[0060] Furthermore, after the control group processes the consumption information to be consumed and obtains the post-consumption information, it is determined whether the traffic version tag information in the request header of the target request included in the post-consumption information is empty. If the traffic version tag information is empty, it is the ingress traffic and the traffic version tag information needs to be filled in. The traffic version tag information may include a hash value calculated based on the identification information in the request header and the preset flow cutting granularity, the region identifier in the request header of the target request, and the flow cutting status. The preset flow cutting granularity can be understood as the flow cutting ratio, for example, a percentage, a thousandth, or the like.

[0061] If the traffic version tag information is not empty, it will not be updated. Based on SkyWalking's cross-process propagation protocol, namely the sw8 protocol, the traffic version tag information will always be passed. This ensures that the entire call chain triggered by the same request is always processed by a group of services with the same version, avoiding processing exceptions due to incompatibility between the new and old versions. At the same time, because the hash value is calculated based on the user's identification information, it can ensure that multiple operations by the same user in the same flow switching phase will always be processed by the same version, ensuring user experience.

[0062] S230: If the consumer group is started, the flow control strategy of the target request is determined according to the flow switching state of the target service.

[0063] Specifically, if the target service's traffic switching state is non-published, the post-consumption information will not be forwarded, and subsequent logical processing will be directly performed by the target node. If the target service's traffic switching state is published, the publication state also includes four release stages: first grayscale, second grayscale, third grayscale, and full release. Different release stages have a corresponding relationship with a flow control strategy. The flow control strategy of the target request can be determined based on the release stage of the target service and the corresponding relationship.

[0064] Furthermore, when the target service's switching state is the publishing state, determining the flow control strategy for the target request according to the target service's switching state may include steps A1-A4:

[0065] Step A1: If the switching state of the target service is the first grayscale and the identification information in the request header of the target request is in the preset whitelist, the post-consumption information is forwarded to the green version.

[0066] Step A2: If the target service's switching state is the second grayscale, the region identifier of the first region in the request header of the target request and the hash value corresponding to the target request are smaller than the preset switching granularity, the post-consumption information is forwarded to the green version.

[0067] Step A3: If the switching state of the target service is the third grayscale, the region identifier of the second region in the request header of the target request, and the hash value corresponding to the target request is less than the preset switching granularity, the post-consumption information is forwarded to the green version.

[0068] Step A4: If the target service's traffic switching status is in the full stage, it means that all nodes of the target service are green version nodes. In this case, the post-consumption information will not be forwarded, and the target node will directly perform subsequent logical processing.

[0069] In an embodiment of the present invention, the post-consumption information is optionally forwarded to the green version, including: determining whether a green version exists; if a green version exists, and there is a remote call method corresponding to the consumer group, then the remote call method is used to forward the post-consumption information to the green version; the remote call method has the same name as the consumer group, and the remote call method corresponds to the green version. If the green version does not exist, the current node of the target service is directly used for subsequent logical processing. In addition, since there may be cases of delayed queue messages, the problem may arise that the version no longer exists when the message is consumed. Therefore, the default fallback rule is local processing. The technical solution of this embodiment ensures that the same consumer group can only be consumed by one version, and the post-consumption information is accurately forwarded. At the same time, when the post-consumption information cannot be forwarded, the subsequent processing logic can still be continued to avoid affecting the user experience.

[0070] In an embodiment of the present invention, optionally, after forwarding the post-consumption information to the green version, the method includes: if the forwarding is successful, the consumer offset corresponding to the consumer group is submitted normally. If a forwarding error is reported, and the error is an error caused by the forwarding itself such as request forwarding timeout and / or thread pool rejection, then forward again until the forwarding is successful. If a forwarding error is reported, and the error is a business logic error, and the ACK policy is configured to automatically submit, then the consumer offset corresponding to the consumer group is submitted. If a forwarding error is reported, and the error is a business logic error, and the ACK policy is not configured to automatically submit, then the consumer offset corresponding to the consumer group is not submitted, and an error message is issued. In an embodiment of the present invention, after forwarding the post-consumption information to the green version, the post-consumption information is monitored to see if it is forwarded successfully, thereby performing corresponding processing logic when it is unsuccessful, thereby ensuring the successful forwarding of the post-consumption information.

[0071] The technical solution of the embodiment of the present invention, when determining that the request type of the target request is a message request, determines the target node corresponding to the target service, so as to determine whether to start the consumption group according to the flow cutting status of the target node and the target service, and ensure the correct control of the start and stop of the consumption group. At the same time, it also realizes that the to-be-consumed messages corresponding to the consumption request can be consumed by the consumption group in real time, and it is not necessary to uniformly consume all the to-be-consumed messages of the consumption request and then forward and divert them as in the prior art. That is, the present invention greatly avoids the risk of single point failure in the system caused by the unified consumption service, and also increases the processing efficiency of the consumption request. At the same time, according to the flow cutting status of the target node and the target service, it is determined whether to start the consumption group. Further, if the consumption group is started, the flow control strategy of the target request is determined according to the flow cutting status of the target service, which solves the problems of some scenarios being uncontrollable and user traffic being random in the prior art, and effectively improves the security of version changes.

[0072] Example 3

[0073] Figure 3 This is a flowchart of another blue-green publishing method provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process of "when the request type of the target request is not a message request, how to determine the flow control strategy of the target request according to the request type of the target request and the flow switching state of the target service" in the above embodiment. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 3 As shown, the blue-green publishing method of the present invention includes:

[0074] S310: Determine that the request type of the target request called by the target service is not a message request.

[0075] Specifically, request types are often related to network communication, interface calls, or inter-program interactions. Therefore, after the target service is started, it receives various requests in real time. After the target service invokes the target request, the target service accurately determines the request type based on the network communication, interface call, or inter-program interaction associated with the target request. Alternatively, the target request type can be determined based on the specific technical scenario, communication protocol, and business requirements.

[0076] When the target request type is not a message request and the target service is started, the system will start monitoring the configuration center, periodically pull the target service's flow switching status, and monitor in real time whether the traffic version tag information in the target request header is empty. If it is empty, the system will complete the traffic identifier.

[0077] Furthermore, if the target service's switching state is non-publishing, the blue version is directly used; if the target service's switching state is publishing, the flow control strategy for the target request is determined according to different switching stages of the publishing state.

[0078] S320: If the switching state of the target service is the first grayscale, and the identification information in the request header of the target request is in the preset whitelist, forward the target request to the green version.

[0079] If the target service's switching state is the first grayscale and the identification information in the request header of the target request is not in the preset whitelist, the target request is forwarded to the blue version.

[0080] S330: If the target service's switching state is the second grayscale, the region identifier in the request header of the target request is the region identifier of the first region, and the hash value corresponding to the target request is smaller than the preset switching granularity, the target request is forwarded to the green version.

[0081] If the switching state of the target service is the second grayscale, the region identifier in the request header of the target request is not the region identifier of the first region, and the hash value corresponding to the target request is greater than the preset switching granularity, the target request is forwarded to the blue version.

[0082] S340: If the switching state of the target service is the third grayscale, the region identifier in the request header of the target request is the region identifier of the second region, and the hash value corresponding to the target request is less than the preset switching granularity, the target request is forwarded to the green version.

[0083] If the switching state of the target service is the third grayscale, the region identifier in the request header of the target request is not the region identifier of the second region, and the hash value corresponding to the target request is greater than the preset switching granularity, the target request will be forwarded to the green version.

[0084] S350: If the target service's traffic switching state is in the full phase, the target request is forwarded to the green version.

[0085] The technical solution of the embodiment of the present invention, when determining that the request type of the target request is not a message request, further judges the flow switching stage of the target service, and reasonably matches the corresponding flow control strategies for the first grayscale, second grayscale, third grayscale and full stage, thereby realizing accurate and efficient switching of flow.

[0086] Example 4

[0087] Figure 4 This is a schematic diagram of the structure of a blue-green publishing device provided by an embodiment of the present invention. This embodiment is applicable to the blue-green publishing situation in the service publishing mode. The blue-green publishing device can be implemented in the form of hardware and / or software. The blue-green publishing device can be configured in any electronic device with network communication function. Figure 4 As shown, the blue-green publishing device of the present invention includes:

[0088] A type determination module 410 is configured to determine a request type of a target request invoked by a target service;

[0089] The flow control module 420 is configured to determine a flow control strategy for the target request according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is published.

[0090] Based on the above embodiment, optionally, the switching state of the target service includes a release state and a non-release state, and the release state includes a first grayscale, a second grayscale, a third grayscale and a full release; the first grayscale, the second grayscale, the third grayscale and the full release gradually expand the scope of the green version in sequence.

[0091] Based on the above embodiment, optionally, the request type of the target request is a message request, and the flow control module includes a first flow control unit, and the first flow control unit includes a node determination subunit, a judgment subunit and a flow control subunit; the node determination subunit is used to determine the target node corresponding to the target service; the target node is a blue version node or a green version node; the judgment subunit is used to determine whether to start the consumption group according to the target node and the flow switching status of the target service; the flow control subunit is used to determine the flow control strategy of the target request according to the flow switching status of the target service if the consumption group is started.

[0092] Based on the above embodiment, optionally, if the flow switching state is full release, the judgment sub-unit group is used to: if the target node is a green version node, control the green version node to start the consumption group; if the target node is a blue version node, control the blue version node not to start the consumption group, and if the blue version node has a started consumption group, stop the consumption group.

[0093] Based on the above embodiment, optionally, if the flow switching state is the release state and is not a full release, the judgment sub-unit is also used to: if the target node is a blue version node, control the blue version node to start the consumption group; if the target node is a green version node, control the green version node not to start the consumption group, and if the green version node has a started consumption group, stop the consumption group.

[0094] Based on the above embodiment, optionally, the target request corresponds to a piece of information to be consumed, and the judgment unit further includes a consumption subunit, which is used to: control the consumption group to consume the piece of information to be consumed to obtain post-consumption information; the post-consumption information includes the identification information in the request header of the target request and / or the area identifier in the request header of the target request; the area identifier includes the area identifier of the first area or the area identifier of the second area; the area range of the second area is larger than the area range of the first area.

[0095] Based on the above embodiment, optionally, the flow control subunit is used to: if the flow cutting state of the target service is the first grayscale, and the identification information in the request header of the target request is in the preset whitelist, then the post-consumption information is forwarded to the green version; if the flow cutting state of the target service is the second grayscale, the region identifier in the request header of the target request is the region identifier of the first region, and the hash value corresponding to the target request is less than the preset flow cutting granularity, then the post-consumption information is forwarded to the green version; if the flow cutting state of the target service is the third grayscale, the region identifier in the request header of the target request is the region identifier of the second region, and the hash value corresponding to the target request is less than the preset flow cutting granularity, then the post-consumption information is forwarded to the green version; if the flow cutting state of the target service is the full stage, the post-consumption information is not forwarded, and the target node performs subsequent logical processing.

[0096] Based on the above embodiment, optionally, the post-consumption information is forwarded to the green version, including: if a green version exists and there is a remote calling method corresponding to the consumer group, the remote calling method is used to forward the post-consumption information to the green version; the remote calling method has the same name as the consumer group, and the remote calling method corresponds to the green version.

[0097] On the basis of the above embodiment, optionally, the flow control subunit also includes an error judgment subunit, which is used to: if a forwarding error occurs, and the error is a request forwarding timeout and / or thread pool rejection, forward again until the forwarding is successful; if a forwarding error occurs, and the error is a business logic error, and the ACK policy is configured to automatically submit, then the consumer offset corresponding to the consumer group is submitted; if a forwarding error occurs, and the error is a business logic error, and the ACK policy is not configured to automatically submit, then the consumer offset corresponding to the consumer group is not submitted, and an error message is issued.

[0098] On the basis of the above embodiment, optionally, the request type of the target request is not a message request, and the flow control module includes a second flow control unit, which is used to: if the flow switching state of the target service is the first grayscale, and the identification information in the request header of the target request is in the preset whitelist, then the target request is forwarded to the green version; if the flow switching state of the target service is the second grayscale, the region identifier in the request header of the target request is the region identifier of the first region, and the hash value corresponding to the target request is less than the preset flow switching granularity, then the target request is forwarded to the green version; if the flow switching state of the target service is the third grayscale, the region identifier in the request header of the target request is the region identifier of the second region, and the hash value corresponding to the target request is less than the preset flow switching granularity, then the target request is forwarded to the green version; if the flow switching state of the target service is the full stage, then the target request is forwarded to the green version.

[0099] The blue-green publishing device provided in the embodiment of the present invention can execute the blue-green publishing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0100] Example 5

[0101] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0102] Figure 5 A schematic diagram of the structure of an electronic device that can be used to implement the blue-green release method of an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0103] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0104] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0105] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any other suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the blue-green release method.

[0106] In some embodiments, the blue-green release method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the blue-green release method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the blue-green release method in any other suitable manner (e.g., via firmware).

[0107] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0108] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0109] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0111] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0112] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0113] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0114] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A blue-green release method, characterized in that: The method comprises: Determine the request type of the target request for the target service call; The flow control strategy of the target request is determined according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is released.

2. The method according to claim 1, characterized in that The request type of the target request is a message request. According to the request type of the target request and the flow switching state of the target service, a flow control strategy for the target request is determined, including: Determine a target node corresponding to the target service; the target node is a blue version node or a green version node; Determine whether to start the consumer group according to the target node and the target service's switching status; If the consumer group is started, the flow control strategy of the target request is determined according to the flow switching state of the target service.

3. The method according to claim 2, characterized in that If the switching state is full release, determining whether to start the consumer group according to the switching state of the target node and the target service includes: If the target node is a green version node, control the green version node to start the consumer group; If the target node is a blue version node, the blue version node is controlled not to start the consumer group, and if the blue version node has a started consumer group, the consumer group is stopped.

4. The method according to claim 2, characterized in that If the switching state is the publishing state and is not the full publishing state, determining whether to start the consumer group according to the switching state of the target node and the target service includes: If the target node is a blue version node, control the blue version node to start the consumer group; If the target node is a green version node, the green version node is controlled not to start the consumer group, and if the green version node has a started consumer group, the consumer group is stopped.

5. The method according to claim 4, characterized in that The target request corresponds to a piece of information to be consumed. After controlling the blue version node to start the consumption group, the method includes: Control the consumer group to consume a piece of information to be consumed to obtain post-consumption information; the post-consumption information includes the identification information in the request header of the target request and / or the area identifier in the request header of the target request; the area identifier includes the area identifier of the first area or the area identifier of the second area; the area range of the second area is larger than the area range of the first area.

6. The method according to claim 5, characterized in that Determining a flow control strategy for the target request according to the flow switching state of the target service includes: If the target service's switching state is the first grayscale and the identification information in the request header of the target request is in the preset whitelist, the post-consumption information is forwarded to the green version; If the switching state of the target service is the second grayscale, the region identifier in the request header of the target request is the region identifier of the first region, and the hash value corresponding to the target request is smaller than the preset switching granularity, then the post-consumption information is forwarded to the green version; If the switching state of the target service is the third grayscale, the region identifier in the request header of the target request is the region identifier of the second region, and the hash value corresponding to the target request is less than the preset switching granularity, the post-consumption information is forwarded to the green version; If the flow switching state of the target service is the full stage, the post-consumption information is not forwarded, and the target node performs subsequent logical processing.

7. The method according to claim 6, characterized in that Forward the post-consumption information to the green version, including: If there is a green version and there is a remote call method corresponding to the consumer group, the remote call method is used to forward the post-consumption information to the green version; the remote call method has the same name as the consumer group, and the remote call method corresponds to the green version.

8. The method according to claim 7, characterized in that After forwarding the post-consumption information to the green version, the method includes: If a forwarding error is reported, and the error is request forwarding timeout and / or thread pool rejection, forward again until the forwarding succeeds; If a forwarding error occurs, and the error is a business logic error, and the ACK policy is configured to automatically commit, the consumer offset corresponding to the consumer group is committed; If a forwarding error occurs, and the error is a business logic error, and the ACK policy configuration is not automatic submission, the consumer offset corresponding to the consumer group will not be submitted, and an error message will be issued.

9. The method according to claim 1, characterized in that The request type of the target request is not a message request, and a flow control strategy for the target request is determined according to the request type of the target request and a flow switching state of a target service, including: If the target service's switching state is the first grayscale and the identification information in the request header of the target request is in the preset whitelist, forward the target request to the green version; If the switching state of the target service is the second grayscale, the region identifier in the request header of the target request is the region identifier of the first region, and the hash value corresponding to the target request is smaller than the preset switching granularity, then the target request is forwarded to the green version; If the target service's switching state is the third grayscale, the region identifier in the request header of the target request is the region identifier of the second region, and the hash value corresponding to the target request is smaller than the preset switching granularity, the target request is forwarded to the green version; the region range of the second region is larger than the region range of the first region; If the target service's switching state is the full phase, the target request is forwarded to the green version.

10. A blue-green publishing device, characterized in that: The device comprises: A type determination module, used to determine the request type of the target request called by the target service; The flow control module is used to determine the flow control strategy of the target request according to the request type of the target request and the flow switching state of the target service; the flow switching state is used to describe whether the target service is released.

11. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the blue-green publishing method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the blue-green publishing method according to any one of claims 1 to 9 when executed.