Gray release management method and device, electronic equipment and program product
By determining the status of the service instance and sending compatible consumption instructions during the grayscale release process, the problem of messages not being consumed in grayscale release is solved, the integrity and data consistency of the message consumption chain are achieved, and the reliability of grayscale release is improved.
Patent Information
- Application Number
- CN202510555616.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-22
AI Technical Summary
During the grayscale release process, if the grayscale message or normal message is not consumed, resulting in message accumulation or data inconsistency, it is difficult for the prior art to ensure the integrity of the message consumption chain.
Ensure the integrity of the message by determining the instance status of the service instance and sending compatible consumption instructions to the service instance when the status is the same, instructing it to consume both grayscale messages and normal messages.
It ensures the integrity of the message consumption chain, avoids message accumulation and data inconsistency, and improves the reliability and user experience of grayscale publishing services.
Smart Images

Figure CN120528962A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of grayscale release technology, and in particular relates to grayscale release management methods, devices, electronic devices, and program products. Background Art
[0002] Grayscale release is a software release strategy that gradually rolls out new versions of services to a subset of users (grayscale users) to verify their stability and performance, thereby reducing risk and ensuring system stability. During a grayscale release, service instances in grayscale state typically refer to service instances of the new version, while service instances in normal state typically refer to service instances of the old version.
[0003] Currently, when performing a grayscale release, it is usually necessary to consume grayscale messages corresponding to grayscale users through grayscale service instances, and consume normal messages corresponding to normal users through normal service instances. However, it is possible that grayscale messages or normal messages have not been consumed yet, and the corresponding service instances have all been offline, making the messages unable to be consumed, resulting in message accumulation or data inconsistency. Summary of the Invention
[0004] The embodiments of the present application provide a grayscale release management method, device, electronic device, and program product, which can ensure the integrity of the message consumption chain during the grayscale release of services and avoid situations such as message accumulation or data inconsistency.
[0005] In a first aspect, an embodiment of the present application provides a method for managing phased releases, including:
[0006] Determine the instance state of each first service instance corresponding to the grayscale publishing service, wherein the instance state includes a grayscale state and a normal state. When the service instance is in the grayscale state, it is used to consume grayscale messages of the subscribed topic. When the service instance is in the normal state, it is used to consume normal messages of the subscribed topic.
[0007] When the instance states of the first service instances are the same, a compatible consumption instruction is sent to at least one of the first service instances, where the compatible consumption instruction is used to instruct the service instance to consume the grayscale message and the normal message of the subscribed topic.
[0008] In a possible implementation of the first aspect, the method further includes:
[0009] When a target service exists and the instance states of the second service instances corresponding to the target service are the same, the compatible consumption instruction is sent to at least one of the second service instances, and the messages of the topic subscribed by the target service and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher.
[0010] In a possible implementation of the first aspect, after sending a compatible consumption instruction to at least one of the first service instances when the instance states of the first service instances are the same, the method further includes:
[0011] When the grayscale publishing service passes the grayscale verification, a resume consumption instruction is sent to the target service instance. The target service instance includes the service instance that currently consumes the grayscale message of the subscribed topic and the normal message. The resume consumption instruction is used to instruct the target service instance to consume the grayscale message or the normal message of the subscribed topic.
[0012] In a possible implementation of the first aspect, when the grayscale release service passes the grayscale verification, sending a resume consumption instruction to the target service instance includes:
[0013] When the grayscale release service passes the grayscale verification and there is no target service that needs to be grayscale released, the resume consumption instruction is sent to the target service instance.
[0014] In a possible implementation of the first aspect, when the grayscale release service passes the grayscale verification, sending a resume consumption instruction to the target service instance includes:
[0015] When the grayscale publishing service passes the grayscale verification and the topic subscribed by the target service instance currently does not have the grayscale message and the normal message to be consumed, the resume consumption instruction is sent to the target service instance.
[0016] In a possible implementation of the first aspect, when the instance states of the first service instances are the same, sending a compatible consumption instruction to at least one of the first service instances includes:
[0017] When the instance status of each of the first service instances is the grayscale state, a target-compatible consumption instruction is sent to at least one of the service instances, and the target-compatible consumption instruction is used to instruct the service instance to consume the grayscale messages of the subscribed topic, and consume the normal messages of the subscribed topic based on the set normal processing logic.
[0018] In a second aspect, an embodiment of the present application provides a phased release management device, including:
[0019] An instance status query module, configured to determine the instance status of each first service instance corresponding to the grayscale publishing service, wherein the instance status includes a grayscale state and a normal state. When the service instance is in the grayscale state, it is configured to consume grayscale messages of the subscribed topic; when the service instance is in the normal state, it is configured to consume normal messages of the subscribed topic;
[0020] The first compatible consumption module is used to send a compatible consumption instruction to at least one of the first service instances when the instance states of the first service instances are the same. The compatible consumption instruction is used to instruct the service instance to consume the grayscale messages and the normal messages of the subscribed topic.
[0021] In a possible implementation of the second aspect, the phased release management device further includes:
[0022] The second compatible consumption module is used to send the compatible consumption instruction to at least one second service instance when there is a target service and the instance states of the second service instances corresponding to the target service are the same, and the messages of the topic subscribed by the target service and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher.
[0023] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the grayscale release management method described in the first aspect above are implemented.
[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the grayscale release management method described in the first aspect above.
[0025] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device executes the grayscale release management method described in the first aspect above.
[0026] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0027] In an embodiment of the present application, when the instance states of each first service instance corresponding to the grayscale publishing service are the same, that is, when each first service instance usually consumes the same type of message, a compatible consumption instruction is sent to at least one first service instance, and the compatible consumption instruction can instruct the service instance to consume normal messages and grayscale messages of the subscribed topic at the same time, that is, by issuing a compatible consumption instruction, the first service instance that receives the compatible consumption instruction consumes both normal messages and grayscale messages, thereby ensuring the integrity of the consumption chain of the other type of message, thereby avoiding message loss or message accumulation, ensuring data consistency, and thus ensuring the reliability of the grayscale publishing service and better ensuring user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art.
[0029] Figure 1 This is a flowchart of a phased release management method provided by an embodiment of the present application;
[0030] Figure 2 This is a flowchart of another grayscale release management method provided by an embodiment of the present application;
[0031] Figure 3 This is a flow chart of message consumption based on a grayscale publishing management system provided by an embodiment of the present application;
[0032] Figure 4 This is a flow chart of message consumption based on a grayscale publishing management system provided by an embodiment of the present application;
[0033] Figure 5 This is a schematic diagram of the structure of the phased release management device provided in an embodiment of the present application;
[0034] Figure 6 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0036] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0037] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0038] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0039] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized.
[0040] Example 1:
[0041] Figure 1 A flow chart of a grayscale release management method provided in an embodiment of the present application is shown. It should be understood that the grayscale release management method provided in an embodiment of the present application can be applied to systems or servers such as a grayscale release management platform or a service management background, so as to manage the service and its service instances accordingly when the service is grayscale released, so that there are corresponding consumers for the messages in the message server, and the integrity of the message consumption chain is guaranteed, thereby avoiding the occurrence of message accumulation during the grayscale release process and ensuring data consistency.
[0042] The above method is detailed as follows:
[0043] S101. Determine the instance status of each first service instance corresponding to the grayscale publishing service, wherein the above-mentioned instance status includes a grayscale status and a normal status. When the above-mentioned service instance is in the above-mentioned grayscale status, it is used to consume the grayscale messages of the subscribed topic. When the above-mentioned service instance is in the above-mentioned normal state, it is used to consume the normal messages of the subscribed topic.
[0044] It should be understood that a service generally represents a module in a system that provides a specific function or set of functions. A grayscale release service is a service that requires grayscale release. In the embodiments of the present application, grayscale release is used to update services, eliminating the need for complex processing such as business code modifications, thereby reducing the complexity and difficulty of implementing service updates.
[0045] The term "service instance" generally refers to a specific running instance of a service, specifically its deployment on physical resources such as processors. A service can correspond to one or more service instances, each of which is an independent running unit capable of processing requests and providing service functionality.
[0046] It should be understood that the instance state of a service instance is generally used to indicate the type of the service instance, and can also be used to indicate the types of messages that the service instance can generally consume. Service instance types can include grayscale service instances and normal service instances, and message types can include normal messages and grayscale messages.
[0047] In an embodiment of the present application, when the instance state of a service instance is a grayscale state, it indicates that the service instance is a grayscale service instance (i.e., a new version of the service instance), and the grayscale service instance is usually used to consume grayscale messages in the subscribed topic; when the instance state of a service instance is a normal state, it indicates that the service instance is a normal service instance (i.e., an old version of the service instance), and the normal service instance is usually used to consume normal messages in the subscribed topic.
[0048] It should be understood that when the grayscale release service starts grayscale release, it usually corresponds to multiple first service instances, and the multiple first service instances usually include grayscale service instances and normal service instances; during the grayscale release process, the number of first service instances corresponding to the grayscale release service can be fixed or dynamically adjusted according to actual needs. The embodiments of this application do not impose specific restrictions on this.
[0049] It should be understood that a service instance can proactively report status information that can reflect its instance status to the system. When the system needs to determine the instance status of a first service instance, it can determine the current instance status of each first service instance based on the stored status information. Alternatively, when the system needs to determine the instance status of a first service instance, it can proactively send a query instruction (for instructing the service instance to report status information) to each first service instance, and then determine the current instance status of each first service instance based on the status information reported by the first service instance in response to the query instruction. The embodiments of the present application do not impose any specific restrictions on the method of determining the instance status of a first service instance.
[0050] S102. When the instance states of the first service instances are the same, a compatible consumption instruction is sent to at least one of the first service instances. The compatible consumption instruction is used to instruct the service instance to consume the grayscale message and the normal message of the subscribed topic.
[0051] Since the instance status of each first service instance is the same, it indicates that the current first service instances are service instances of the same type and consume the same type of messages. Messages of another type cannot be consumed. Therefore, in order to ensure that the messages can be consumed, a compatible consumption instruction can be sent to at least one first service instance. The compatible consumption instruction instructs the first service instance to consume both the grayscale messages and normal messages of the subscribed topic at the same time. That is, the compatible consumption instruction issued ensures that both normal messages and grayscale messages have corresponding consumers, thereby reducing the accumulation of certain types of messages and the lack of corresponding consumers, and can better avoid the inconsistency of business data or other data of the grayscale publishing service.
[0052] In other embodiments, when the instance status of each first service instance is the same, a compatible consumption instruction can be sent to each first service instance, so that when different first service instances subscribe to different topics, the grayscale messages and normal messages of different topics can be consumed by the corresponding first service instances.
[0053] It should be understood that after receiving the compatible consumption instruction, the first service instance can determine the way in which it consumes the grayscale messages and normal messages of the subscribed topic according to the actual status of the message middleware.
[0054] For example, it is assumed that a normal topic (used to obtain normal messages of the topic for storage) and a grayscale topic (used to obtain grayscale messages of the topic for storage) corresponding to each topic are created in the message middleware.
[0055] Assume that the instance status of each first service instance of the grayscale publishing service A is in grayscale status, and the topic subscribed by each first service instance is topic B. Since each first service instance currently consumes the grayscale messages of the subscribed topic, each first service instance specifically subscribes to the grayscale topic corresponding to topic B.
[0056] Assume that a compatible consumption instruction is issued to the first service instance a1. After receiving the compatible consumption instruction, the first service instance a1 needs to consume the grayscale messages and normal messages of topic B. Therefore, it needs to establish a subscription relationship with the normal topic corresponding to topic A to consume the normal messages corresponding to topic B.
[0057] That is, the first service instance a1 specifically subscribes to the normal topic and the grayscale topic corresponding to topic B to consume the normal messages and grayscale messages of topic B.
[0058] For another example, suppose a topic in the message-based middleware stores its normal messages in a normal message queue and its grayscale messages in a grayscale message queue. Upon receiving a compatible consumption instruction, the first service instance can establish a subscription relationship with the normal message queue in the subscribed topic, and a subscription message relationship with the grayscale message queue in the subscribed topic, to consume both normal and grayscale messages from the subscribed topic.
[0059] In an embodiment of the present application, when the instance states of each first service instance corresponding to the grayscale publishing service are the same, that is, when each first service instance usually consumes the same type of message, a compatible consumption instruction is sent to at least one first service instance, and the compatible consumption instruction is used to instruct the corresponding service instance to consume the normal messages and grayscale messages of the subscribed topic at the same time. That is, the integrity of the consumption chain of another type of message is guaranteed through the compatible consumption instruction, thereby avoiding situations such as messages having no corresponding consumers or message accumulation, ensuring data consistency, and thus ensuring the reliability of the grayscale publishing service.
[0060] In some embodiments, when the instance states of the first service instances are the same, sending a compatible consumption instruction to at least one of the first service instances includes:
[0061] When the instance status of each of the above-mentioned first service instances is the above-mentioned grayscale state, a target-compatible consumption instruction is sent to at least one of the above-mentioned first service instances, and the above-mentioned target-compatible consumption instruction is used to instruct the above-mentioned first service instance to consume the above-mentioned grayscale messages of the subscribed topic, and consume the above-mentioned normal messages of the subscribed topic based on the set normal processing logic.
[0062] In an embodiment of the present application, if the instance status of each first service instance is a grayscale state, that is, each first service instance is a new version of the service instance, a target compatible consumption instruction will be sent to at least one first service instance. After the first service instance receives the target compatible consumption instruction, it can consume the normal messages of the subscribed topic based on the set normal processing logic (that is, the processing logic of the old version) according to the instructions of the target compatible consumption instruction, and consume the grayscale messages of the subscribed topic based on its own grayscale processing logic (that is, the processing logic of the new version).
[0063] Through the above processing, it is ensured that the first service instance belonging to the new version can consume normal messages and grayscale messages based on the correct processing logic, avoiding data errors and other situations, thereby better ensuring the reliability and stability of the service during the grayscale release process.
[0064] It should be understood that the set normal processing logic can be sent to the first service instance in advance, or it can be sent to the first service instance through a target compatible consumption instruction. The embodiment of the present application does not impose any specific restrictions on this.
[0065] In other embodiments, it is possible to first determine whether the processing logic of messages of the topic subscribed by the first service instance has changed before and after the grayscale release, that is, to determine whether the processing logic of the normal messages of the subscribed topic by the first service instance in the normal state is the same as the processing logic of the grayscale messages of the subscribed topic by the first service instance in the grayscale state. When the instance states of all first service instances are in the grayscale state and the judgment result indicates that the processing logic has changed (that is, the processing logic is different), a target compatible instruction is sent to at least one first service instance.
[0066] Figure 2 A schematic diagram of a process flow of a phased release management method provided by other embodiments is shown. Figure 2 , the above method further includes:
[0067] When a target service exists and the instance states of the second service instances corresponding to the target service are the same, the compatible consumption instruction is sent to at least one of the second service instances. The messages of the topic subscribed by the target service and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher.
[0068] Message publishers, also known as message producers, are responsible for generating messages based on business logic and publishing them to the corresponding topics. When a message publisher generates a message based on a user request, the type of message generated is determined by whether the requesting user is a grayscale user. The message type is either a normal message or a grayscale message.
[0069] For example, refer to Figure 3 ,Assume that the message publisher obtains the user's business request, at this time, the information publisher can detect whether the user's business request carries a grayscale label. The grayscale label is used to indicate whether the user corresponding to the business request is a grayscale user.
[0070] If the message publisher detects that the user's business request carries a grayscale tag, that is, the user is a grayscale user, then the message publisher usually needs to generate a grayscale message when generating a message based on the business request and corresponding business logic.
[0071] If the message publisher does not detect that the user's business request carries a grayscale label, the user can be considered a normal user. At this time, when the message publisher generates a message based on the business request and the corresponding business logic, it usually generates a normal message.
[0072] In some embodiments, different service instances of a service may subscribe to different topics. In this case, the subscribed topics of the service may include the topics subscribed to by each service instance corresponding to the service. For example, the subscribed topics of a grayscale publishing service may include the topics subscribed to by each first service instance corresponding to the grayscale publishing service.
[0073] Considering that the messages of topics subscribed by other services and the messages of topics subscribed by the grayscale publishing service come from the same message publisher, the messages sent by the message publisher to topics subscribed by other services may include grayscale messages and normal messages, and other services may not have grayscale service instances that can consume grayscale messages or normal service instances that can consume normal messages. Therefore, in order to ensure the integrity of the message consumption chain of topics subscribed by other services, during the grayscale publishing process of any service (that is, when the grayscale publishing service exists), it can be determined whether there is a service whose messages of the subscribed topic and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher, that is, whether there is a target service.
[0074] If it is determined that the target service exists, it may be further determined whether the instance states of the second service instances corresponding to the target service are the same.
[0075] If it is determined that the instance states of the second service instances corresponding to the target service are the same, a compatible consumption instruction can be sent to at least one second service instance so that there are corresponding consumers for both the grayscale messages and normal messages in the topic subscribed by the target service, thereby ensuring the integrity of the message consumption chain of the topic subscribed by the target service.
[0076] For example, assuming that service A is a grayscale release service, there are three first service instances corresponding to service A (service instance a1, service instance a2, and service instance a3). Figure 3 As shown, the instance states of service instance a1 (grayscale state), service instance a2 (grayscale state) and service instance a3 (normal state) are not completely consistent, so there is no need to send compatible consumption instructions to any service instance corresponding to the grayscale release service.
[0077] Assume that service B has two corresponding second service instances (service instance b1 and service instance b2). Assume that the messages of the topic subscribed by service B and the messages of the topic subscribed by service A come from the same publisher, that is, service B is the target service, and the instance status of service instance b1 and service instance b2 are both normal. Then, a compatible consumption instruction can be sent to service instance b1 or service instance b2, or vice versa.
[0078] like Figure 4As shown, it is assumed that the grayscale release management system sends a compatible consumption instruction to service instance b2. After service instance b2 modifies its subscription relationship accordingly according to the compatible consumption instruction, it can consume normal messages and grayscale messages of the topic it subscribes to.
[0079] In other embodiments, the compatible consumption instruction may also be sent to each second service instance corresponding to the target service, that is, the compatible consumption instruction may be sent to all second service instances corresponding to the target service.
[0080] In an embodiment of the present application, when a service is grayscale published, if there are messages of the subscribed topic and messages of the topic subscribed by the grayscale publishing service from the service of the same message publisher, that is, there is a target service, and the instance states of the respective second service instances corresponding to the target service are the same, that is, when the service instance of the target service currently usually only consumes one type of message, at least one second service instance is instructed to consume normal messages and grayscale messages of the subscribed topic through compatible consumption instructions, so that when the message publisher produces and publishes two types of messages to the topic to which it subscribes, the messages can be consumed by the second service instance, avoiding situations where the messages cannot be consumed and lead to message accumulation or message loss, thereby ensuring the consistency and integrity of message consumption and thus ensuring the consistency of data.
[0081] In some embodiments, when the instance states of the respective first service instances are the same, after sending the compatible consumption instruction to at least one of the first service instances, the method further includes:
[0082] When the grayscale publishing service passes the grayscale verification, a resume consumption instruction is sent to the target service instance. The target service instance includes the service instance that currently consumes the grayscale message of the subscribed topic and the normal message. The resume consumption instruction is used to instruct the target service instance to consume the grayscale message or the normal message of the subscribed topic.
[0083] Grayscale verification usually refers to verifying the stability, performance, and user feedback of the new version through monitoring, testing, and data analysis during the grayscale release process to ensure that it meets expectations.
[0084] It should be understood that the method for determining whether the grayscale release service has passed the grayscale verification can be set according to actual application needs.
[0085] For example, when each first service instance corresponding to the grayscale release service has been switched to a grayscale service instance and each grayscale service instance has passed the grayscale verification, it can be determined that the grayscale release service has passed the grayscale verification.
[0086] For another example, upon receiving a grayscale verification pass instruction input by the user through a terminal device or a system interaction interface, it can be determined that the grayscale publishing service has passed the grayscale verification.
[0087] In some embodiments, the target service instance may include a first service instance that currently consumes the above-mentioned grayscale messages and the above-mentioned normal messages of the subscribed topic, and / or a second service instance that currently consumes the above-mentioned grayscale messages and the above-mentioned normal messages of the subscribed topic.
[0088] It should be understood that after receiving the resume consumption instruction, the target service instance can determine the types of messages it can consume based on its current instance state. That is, if the target service instance's current instance state is grayscale, the target service instance can consume grayscale messages from the subscribed topic; if the target service instance's current instance state is normal, the target service instance can consume normal messages from the subscribed topic.
[0089] It should be understood that after receiving the resume consumption instruction, the target service instance can consume the grayscale messages or normal messages of the subscribed topic in a manner that is determined according to the actual situation of the message middleware, and no specific limitation is given here.
[0090] In other embodiments, when the grayscale publishing service passes the grayscale verification, a state modification instruction and a consumption modification instruction may be sent to the target first service instance. The target first service instance refers to the first service instance that currently consumes the grayscale messages and normal messages of the subscribed topic (that is, the first service instance that previously received the compatible consumption instruction). The state modification instruction is used to indicate that the instance state of the target first service instance is modified to a normal state, and the consumption modification instruction is used to indicate that the target first service instance consumes messages of the type corresponding to the modified instance state, that is, to indicate that the target first service instance consumes normal messages of the subscribed topic.
[0091] In other embodiments, when the grayscale publishing service passes the grayscale verification, a resume consumption instruction can be sent to the target second service instance. The target second service instance includes the normal messages of the subscribed topic currently consumed and the second service instance of the grayscale message (that is, the second service instance that previously received the compatible consumption instruction). At this time, the resume consumption instruction can be used to instruct the target second service instance to consume messages of the type corresponding to its instance state, that is, to instruct the target second service instance to consume normal messages or grayscale messages.
[0092] In the embodiment of the present application, since when the grayscale release service passes the grayscale verification, it usually indicates that the functions, performance, stability and data consistency of the grayscale release service have met the corresponding requirements, therefore, each target service instance can be instructed to resume normal consumption through the resumption of consumption instruction, so that it consumes the type of message corresponding to the current instance state, without the need to subscribe to and consume two types of messages, thereby reducing the complexity of subscription and consumption of the target service instance.
[0093] In some embodiments, when the grayscale release service passes the grayscale verification, sending a resume consumption instruction to the target service instance includes:
[0094] When the grayscale release service passes the grayscale verification and there is no target service that needs to be grayscale released, the resume consumption instruction is sent to the target service instance.
[0095] Considering that when the current grayscale publishing service passes the grayscale verification, there may be other services that need to be grayscale published, and the messages of the target service's subscribed topic and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher. If the target service needs to be grayscale published, the messages generated by the message publisher may include both grayscale messages and normal messages, so that these two types of messages may exist in the topic subscribed by the current grayscale publishing service. Therefore, in order to avoid the inability to consume messages, when the current grayscale publishing service passes the grayscale verification, if there is no target service that needs to be grayscale published, a resume consumption instruction can be sent to the target service instance.
[0096] In some embodiments, if there is a target service that needs to perform a grayscale release service, the resumption of consumption instructions may not be sent to the target service instance to ensure the integrity of the consumption chain of messages of the topic subscribed by the target service instance, thereby avoiding message loss or message accumulation due to the inability to be consumed.
[0097] In other embodiments, if there is a target service that requires grayscale publishing, a first target service instance and a second target service instance can be determined from the target service instances based on a classification condition. The classification condition can be that messages to the topic subscribed by the target service instance and messages to the topic subscribed by the target service that requires grayscale publishing come from the same message publisher. The first target service instance can be a target service instance that meets the classification condition, and the second target service instance can be a target service instance that does not meet the classification condition. In this case, a resume consumption instruction can be sent to the second target service instance.
[0098] In an embodiment of the present application, after the grayscale publishing service passes the grayscale verification, if there is no other service that needs to be grayscale published, that is, the message publisher usually does not generate both grayscale messages and normal messages at the same time, then the consumption instruction is restored to enable the target service instance to normally consume the message type corresponding to its instance state, thereby avoiding message accumulation or messages, and ensuring the integrity of the message consumption chain.
[0099] In some embodiments, when the grayscale release service passes the grayscale verification, sending a resume consumption instruction to the target service instance includes:
[0100] When the grayscale publishing service passes the grayscale verification and there is no target message to be consumed in the topic subscribed by the target service instance, the resume consumption instruction is sent to the target service instance.
[0101] Among them, when the above-mentioned target service instance is in the above-mentioned grayscale state, the above-mentioned target message includes the above-mentioned normal message; when the above-mentioned target service instance is in the above-mentioned normal state, the above-mentioned target message includes the above-mentioned grayscale message.
[0102] In an embodiment of the present application, taking into account the possibility that messages may be retained due to factors such as network delays, in order to avoid the inability to consume messages of the topic subscribed by the target service instance, a resume consumption instruction is sent to the target service instance so that the target service instance only consumes messages of the type corresponding to its instance status. Before this, it is possible to first determine whether there is a target message to be consumed in the topic subscribed by the target service instance.
[0103] It should be understood that when the target service instance is currently in a normal state, the target message includes a grayscale message. At this time, it can be determined whether there are grayscale messages to be consumed in the topic subscribed by the target service instance; when the target service instance is in a grayscale state, the target message includes a normal message. At this time, it can be determined whether there are normal messages to be consumed in the topic subscribed by the target service instance.
[0104] If it is determined that there is no target message to be consumed in the subscribed topic, a resume consumption instruction can be sent to the target service instance, so that the target service instance only needs to consume messages of the type corresponding to its instance state, without consuming grayscale messages and normal messages at the same time.
[0105] In other embodiments, when the grayscale publishing service passes the grayscale verification and there is no target message to be consumed in the topic subscribed by the target service instance within a first preset time period (such as 30 seconds), a resume consumption instruction is sent to the target service instance.
[0106] In other embodiments, when the grayscale publishing service passes the grayscale verification, but there are still target messages to be consumed in the topic subscribed by the target service instance, it is possible to check whether there are still target messages to be consumed in the topic subscribed by the target service instance every second preset time period (such as 20 seconds) until it is detected that there are no target messages to be consumed in the topic subscribed by the target service instance.
[0107] In an embodiment of the present application, after the grayscale publishing service passes the grayscale verification, if there is no target message to be consumed in the topic subscribed by the target service instance, the target service instance will normally consume messages of the corresponding type of instance status by issuing a recovery consumption instruction, thereby ensuring that the messages in the subscribed topic can be consumed, thereby avoiding the loss or accumulation of messages due to the inability to be consumed, and improving the reliability of the system and services.
[0108] In some embodiments, when the grayscale publishing service passes the grayscale verification, there is no target service that needs to be grayscale published, and the topic subscribed by the target service instance currently does not have any target message to be consumed, a resume consumption instruction can be sent to the target service instance to further avoid message loss or message accumulation.
[0109] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0110] Example 2:
[0111] Corresponding to the grayscale release management method described in the above embodiment, Figure 5 A structural block diagram of the grayscale release management device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0112] Reference Figure 5 The device includes: an instance status query module 51 and a first compatible consumption module 52.
[0113] The instance status query module 51 is used to determine the instance status of each first service instance corresponding to the grayscale publishing service, wherein the above-mentioned instance status includes a grayscale status and a normal status. When the above-mentioned service instance is in the above-mentioned grayscale status, it is used to consume the grayscale messages of the subscribed topic. When the above-mentioned service instance is in the above-mentioned normal state, it is used to consume the normal messages of the subscribed topic.
[0114] The first compatible consumption module 52 is used to send a compatible consumption instruction to at least one of the above-mentioned first service instances when the above-mentioned instance states of each of the above-mentioned first service instances are the same. The above-mentioned compatible consumption instruction is used to instruct the above-mentioned service instance to consume the above-mentioned grayscale messages and the above-mentioned normal messages of the subscribed topic.
[0115] In an embodiment of the present application, when the instance states of each first service instance corresponding to the grayscale publishing service are the same, that is, when each first service instance usually consumes the same type of message, a compatible consumption instruction is sent to at least one first service instance, and the compatible consumption instruction is used to instruct the corresponding service instance to consume the normal messages and grayscale messages of the subscribed topic at the same time. That is, the integrity of the consumption chain of another type of message is guaranteed through the compatible consumption instruction, thereby avoiding the situation where the message cannot be consumed and caused by the loss or accumulation of messages, ensuring the consistency of the data, and thus ensuring the reliability of the grayscale publishing service.
[0116] In some embodiments, the aforementioned grayscale release management device further includes:
[0117] The second compatible consumption module is used to send the above-mentioned compatible consumption instructions to at least one of the above-mentioned second service instances when there is a target service and the above-mentioned instance states of each second service instance corresponding to the above-mentioned target service are the same, and the messages of the topic subscribed by the above-mentioned target service and the messages of the topic subscribed by the above-mentioned grayscale publishing service come from the same message publisher.
[0118] In some embodiments, the aforementioned grayscale release management device further includes:
[0119] The first recovery module is used to send a resumption consumption instruction to the target service instance when the above-mentioned grayscale publishing service passes the grayscale verification. The above-mentioned target service instance includes the service instance that currently consumes the above-mentioned grayscale messages of the subscribed topic and the above-mentioned normal messages. The above-mentioned resumption consumption instruction is used to instruct the above-mentioned target service instance to consume the above-mentioned grayscale messages or the above-mentioned normal messages of the subscribed topic.
[0120] In some embodiments, the aforementioned grayscale release management device further includes:
[0121] The second recovery module is used to send the above-mentioned recovery consumption instruction to the above-mentioned target service instance when the above-mentioned grayscale release service passes the above-mentioned grayscale verification and there is no above-mentioned target service that needs to be grayscale released.
[0122] In some embodiments, the aforementioned grayscale release management device further includes:
[0123] The third recovery module is used to send the above-mentioned recovery consumption instruction to the above-mentioned target service instance when the above-mentioned grayscale publishing service passes the above-mentioned grayscale verification and the topic subscribed by the above-mentioned target service instance currently does not have the above-mentioned grayscale message and the above-mentioned normal message to be consumed.
[0124] In some embodiments, the first compatible consumption module 52 includes:
[0125] A compatible consumption unit is used to send a target compatible consumption instruction to at least one of the above-mentioned service instances when the above-mentioned instance states of each of the above-mentioned first service instances are the above-mentioned grayscale states. The above-mentioned target compatible consumption instruction is used to instruct the above-mentioned service instance to consume the above-mentioned grayscale messages of the subscribed topic, and to consume the above-mentioned normal messages of the subscribed topic based on the set normal processing logic.
[0126] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0127] Example 3:
[0128] Figure 6 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. Figure 6 As shown, the electronic device 6 of this embodiment includes: at least one processor 60 ( Figure 6 Only one processor is shown in the figure), a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, wherein the processor 60 implements the steps of any of the above-mentioned method embodiments when executing the computer program 62.
[0129] The electronic device 6 can be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device can include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will understand that Figure 6 This is merely an example of the electronic device 6 and does not constitute a limitation on the electronic device 6 . The electronic device 6 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 6 may also include input and output devices, network access devices, etc.
[0130] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0131] In some embodiments, the memory 61 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. In other embodiments, the memory 61 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. Furthermore, the memory 61 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader, data, and other programs, such as the program code of the computer program. The memory 61 may also be used to temporarily store data that has been output or is about to be output.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0133] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps of any of the above-mentioned method embodiments when executing the computer program.
[0134] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0135] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device can implement the steps of the above-mentioned method embodiments when executing the computer program product.
[0136] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0137] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0138] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0139] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0140] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0141] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A grayscale release management method, characterized in that: include: Determine the instance state of each first service instance corresponding to the grayscale publishing service, wherein the instance state includes a grayscale state and a normal state. When the service instance is in the grayscale state, it is used to consume grayscale messages of the subscribed topic. When the service instance is in the normal state, it is used to consume normal messages of the subscribed topic. When the instance states of the first service instances are the same, a compatible consumption instruction is sent to at least one of the first service instances, where the compatible consumption instruction is used to instruct the service instance to consume the grayscale message and the normal message of the subscribed topic.
2. The grayscale release management method according to claim 1, wherein: The method further comprises: When a target service exists and the instance states of the second service instances corresponding to the target service are the same, the compatible consumption instruction is sent to at least one of the second service instances, and the messages of the topic subscribed by the target service and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher.
3. The grayscale release management method according to claim 1, wherein: After sending a compatible consumption instruction to at least one of the first service instances when the instance states of the first service instances are the same, the method further includes: If the grayscale release service passes the grayscale verification, a resume consumption instruction is sent to the target service instance. The target service instance includes a service instance that currently consumes the grayscale message and the normal message of the subscribed topic, and the resume consumption instruction is used to instruct the target service instance to consume the grayscale message or the normal message of the subscribed topic.
4. The grayscale release management method according to claim 3, wherein: When the grayscale release service passes the grayscale verification, sending a resume consumption instruction to the target service instance includes: When the grayscale release service passes the grayscale verification and there is no target service that needs to be grayscale released, the resume consumption instruction is sent to the target service instance.
5. The grayscale release management method according to claim 3, wherein: If the grayscale release service passes the grayscale verification, a resume consumption instruction is sent to the target service instance, including: When the grayscale publishing service passes the grayscale verification and the target service instance currently subscribes to a topic that does not contain a target message to be consumed, the resume consumption instruction is sent to the target service instance. When the target service instance is in the grayscale state, the target message includes the normal message; when the target service instance is in the normal state, the target message includes the grayscale message.
6. The grayscale release management method according to any one of claims 1 to 5, characterized in that: The sending a compatible consumption instruction to at least one of the first service instances when the instance states of the first service instances are the same includes: When the instance status of each of the first service instances is the grayscale state, a target-compatible consumption instruction is sent to at least one of the first service instances, and the target-compatible consumption instruction is used to instruct the first service instance to consume the grayscale messages of the subscribed topic, and consume the normal messages of the subscribed topic based on the set normal processing logic.
7. A grayscale release management device, characterized in that: include: An instance status query module, configured to determine the instance status of each first service instance corresponding to the grayscale publishing service, wherein the instance status includes a grayscale state and a normal state. When the service instance is in the grayscale state, it is configured to consume grayscale messages of the subscribed topic; when the service instance is in the normal state, it is configured to consume normal messages of the subscribed topic; The first compatible consumption module is used to send a compatible consumption instruction to at least one of the first service instances when the instance states of the first service instances are the same. The compatible consumption instruction is used to instruct the service instance to consume the grayscale messages and the normal messages of the subscribed topic.
8. The phased release management device according to claim 7, wherein: Also includes: The second compatible consumption module is used to send the compatible consumption instruction to at least one second service instance when there is a target service and the instance states of the second service instances corresponding to the target service are the same, and the messages of the topic subscribed by the target service and the messages of the topic subscribed by the grayscale publishing service come from the same message publisher.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that When the computer program product is run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Service upgrading management method and device and storage medium
CN110365502A
Micro-service grayscale edition issuing method, device and equipment and storage medium thereof
CN116483425A
Service processing method and device based on gray release
CN117311794A
Dynamic grayscale service publishing system, method and equipment and computer medium
CN117714459A