Gray release method and device, computer storage medium and electronic equipment
By combining the access layer API gateway with canary analysis factors and unique identifiers to segment traffic, the problems of low efficiency and poor user experience in canary releases are solved, and stable and efficient canary releases are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
- Filing Date
- 2021-10-21
- Publication Date
- 2026-05-19
AI Technical Summary
Existing canary release methods are inefficient, inflexible, and provide a poor user experience, especially as user terminals are unstable when switching between canary environments.
The system receives gray-scale rules through the access layer API gateway, uses gray-scale analysis factors and unique identifiers to segment traffic, determines the terminal deployment environment, and adjusts them in a timely manner when gray-scale rules change. It also uses randomly updated calculation factors to prevent terminals from being fixed in a certain environment.
This improves the efficiency and flexibility of canary releases, ensures stable switching between different canary release rule versions on user terminals, and enhances the user experience.
Smart Images

Figure CN113934444B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of Internet technology, and more specifically, to a grayscale release method, grayscale release device, computer storage medium, and electronic device. Background Technology
[0002] With the development of internet technology, internet companies iterate and update rapidly, and product features change frequently. High-frequency service releases often come with significant launch risks. To ensure overall system stability, a canary release approach is used for a smooth transition. A canary release refers to a phase where some users continue using product feature A while others begin using product feature B. If users have no objections to feature B, the scope is gradually expanded until all users have migrated to feature B. Canary releases allow for early user feedback, enabling improvements to product features and quality. In other words, it involves user participation in product testing, strengthens user interaction, and reduces the number of users affected by product upgrades.
[0003] In related technologies, gray-scale strategies include the following: By specifying a whitelist, only some users on the whitelist are allowed to be routed to the gray-scale environment. However, these users are usually internal testers or enterprise testers, and the participation of ordinary users is not high. Moreover, when releasing gray-scale rules, it is always necessary to re-specify the whitelist, resulting in low efficiency of gray-scale release. Gray-scale screening is carried out by IP (Internet Protocol) segment and user profile (based on user group age, gender, etc.). However, the operation is relatively complicated. Gray-scale users are determined by weighting algorithms. During the gray-scale process, the user terminal may always be in the gray-scale environment, resulting in a poor user experience.
[0004] It should be noted that the information in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The purpose of this disclosure is to provide a grayscale release method and apparatus, computer storage medium and electronic device, thereby improving the efficiency and flexibility of grayscale release to at least a certain extent.
[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0007] According to one aspect of this disclosure, a canary deployment method is provided, comprising: receiving canary rules, the canary rules including a canary analysis factor corresponding to the current rule version; obtaining a unique identifier of a service initiating terminal from a received service request; determining the deployment environment to which the service initiating terminal belongs based on the canary analysis factor and the unique identifier; and assigning the service initiating terminal to the deployment environment.
[0008] In an exemplary embodiment of this disclosure, the step of determining the deployment environment to which the service initiating terminal belongs based on the grayscale analysis factor and the unique identifier, and then assigning the service initiating terminal to the deployment environment, includes: performing traffic segmentation calculation on the grayscale analysis factor and the unique identifier, and determining the deployment environment to which the service initiating terminal belongs based on the calculation result; and assigning the service initiating terminal to the deployment environment.
[0009] In an exemplary embodiment of this disclosure, the grayscale analysis factor includes a calculation factor and a grayscale ratio; the step of performing traffic segmentation calculation on the grayscale analysis factor and the unique identifier, and determining the deployment environment to which the service initiating terminal belongs based on the calculation result includes: performing a remainder calculation on the calculation factor and the unique identifier according to a preset remainder model; comparing the calculation result with the grayscale ratio, and determining the deployment environment of the service initiating terminal based on the comparison result.
[0010] In an exemplary embodiment of this disclosure, when switching the deployment environment of the service initiating terminal to a grayscale environment, the method further includes: sending service response information carrying a grayscale identifier to the service initiating terminal; wherein the grayscale identifier is included in the grayscale rule and the grayscale identifier includes the current rule version number.
[0011] In one exemplary embodiment of this disclosure, after sending the service response information carrying the grayscale identifier to the service initiating terminal, the method further includes: receiving a service request carrying the grayscale identifier and switching the service initiating terminal to the grayscale environment under the rule version number corresponding to the grayscale identifier.
[0012] In one exemplary embodiment of this disclosure, an updated grayscale rule is received, the updated grayscale rule including an updated rule version number and an updated grayscale analysis factor; after sending service response information carrying a grayscale identifier to the service initiating terminal, the method further includes: receiving a service request carrying the grayscale identifier, and obtaining the current rule version number of the service initiating terminal from the grayscale identifier; comparing the current rule version number with the updated rule version number; adjusting the deployment environment of the service initiating terminal according to the comparison result; wherein, the updated calculation factor in the updated grayscale analysis factor is updated using a random update method.
[0013] In an exemplary embodiment of this disclosure, adjusting the deployment environment of the service initiating terminal based on the comparison result includes: if the current rule version number is the same as the updated rule version number, then maintaining the deployment environment to which the service initiating terminal belongs; if the current rule version number is different from the updated rule version number, then determining the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the updated grayscale factor, and segmenting the service initiating terminal to the target deployment environment.
[0014] In one exemplary embodiment of this disclosure, the method further includes receiving an updated grayscale rule, wherein the grayscale ratio included in the grayscale analysis factor of the updated grayscale rule is updated, and receiving a service request carrying the grayscale identifier, obtaining a unique identifier of the service initiating terminal; determining the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the grayscale analysis factor containing the updated grayscale ratio, and assigning the service initiating terminal to the target deployment environment.
[0015] In one exemplary embodiment of this disclosure, the method further includes: obtaining the current rule version number of the service initiating terminal from the grayscale identifier; determining whether the target deployment environment where the service initiating terminal is currently located is an environment under the current rule version; if not, switching the service initiating terminal to the target deployment environment under the current rule version.
[0016] In one exemplary embodiment of this disclosure, the unique identifier of the service initiating terminal is obtained by the service initiating terminal from the grayscale configuration platform.
[0017] According to one aspect of this disclosure, a canary deployment apparatus is provided, comprising: a rule receiving module for receiving canary rules, the canary rules including a canary analysis factor corresponding to the current rule version; an identifier acquisition module for acquiring a unique identifier of a service initiating terminal from a received service request; and a canary deployment module for determining the deployment environment to which the service initiating user belongs based on the canary analysis factor and the unique identifier, and assigning the service initiating user to the deployment environment.
[0018] According to one aspect of this disclosure, a canary release system is provided, the system comprising: an application programming interface (API) gateway for executing the canary release method described in any of the preceding claims; a canary configuration platform, set on the API release platform, for configuring canary rules and distributing the configured canary rules to the API gateway; and the canary configuration platform further being configured to respond to an identifier acquisition request from a service initiating terminal and assign a unique identifier to the service initiating terminal.
[0019] According to one aspect of this disclosure, a computer storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the grayscale release method described in any of the preceding claims.
[0020] According to one aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the grayscale release method described in any of the preceding claims by executing the executable instructions.
[0021] The canary release method in the exemplary embodiments of this disclosure determines the deployment environment of the service initiating terminal based on the canary analysis factors in the canary rules and the unique identifier of the service initiating terminal. It can adjust the user terminal to a reasonable deployment environment in a timely manner as the canary rules change, resulting in high canary release efficiency. By incorporating the canary analysis factors corresponding to the current rule version into the confirmation process of the deployment environment, the deployment environment of the user terminal can be adjusted accordingly when the canary rule version changes, along with the change of the corresponding canary analysis factors. This avoids the user terminal always being in a canary environment and also avoids the instability of the deployment environment under the same canary rule version. The canary release has high flexibility, good canary effect, and good user experience.
[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0023] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which:
[0024] Figure 1 A flowchart of a grayscale publishing method according to an exemplary embodiment of the present disclosure is shown;
[0025] Figure 2 A flowchart illustrating the deployment environment for determining a service initiating terminal according to an exemplary embodiment of the present disclosure is shown;
[0026] Figure 3 A flowchart illustrating the grayscale release interaction process according to an exemplary embodiment of this disclosure is shown;
[0027] Figure 4 A flowchart illustrating the overall process of grayscale deployment according to exemplary embodiments of this disclosure is shown;
[0028] Figure 5 A schematic diagram of the structure of a grayscale publishing apparatus according to an exemplary embodiment of the present disclosure is shown;
[0029] Figure 6 A schematic diagram of the structure of a grayscale publishing system according to an exemplary embodiment of the present disclosure is shown;
[0030] Figure 7 A schematic diagram of a storage medium according to an exemplary embodiment of the present disclosure is shown; and
[0031] Figure 8 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.
[0032] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0033] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore their detailed description will be omitted.
[0034] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details described, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known structures, methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0035] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, or in one or more software-hardened modules, or in different network and / or processor devices and / or microcontroller devices.
[0036] In related technologies, UID (User Identification) is used as a globally unique parameter when making API (Application Programming Interface) gateway requests. The UID is moduloed and compared with a specified threshold, and the user terminal is routed to a gray-scale environment based on the comparison result. However, the UID obtained for each request is usually different, so users may sometimes be in the gray-scale environment and sometimes not. If there are vulnerabilities in the API interface or the gray-scale page, the user's access to the page will be sometimes the gray-scale version and sometimes the online version, resulting in a poor user experience. On the other hand, if a fixed UID is used, as the gray-scale release ratio is adjusted (e.g., 10%, 20%...100%), some user terminals may remain in the gray-scale environment throughout the gray-scale process.
[0037] Based on this, in the exemplary embodiments of this disclosure, a canary release method is first provided, applied to an access layer application programming interface (API) gateway. (See reference...) Figure 1 As shown, this canary release method includes the following steps:
[0038] Step S110: Receive grayscale rules, wherein the grayscale rules include grayscale analysis factors corresponding to the current rule version;
[0039] Step S120: Obtain the unique identifier of the service initiating terminal from the received service request;
[0040] Step S130: Determine the deployment environment to which the service initiating terminal belongs based on the grayscale analysis factor and the unique identifier, and assign the service initiating terminal to the deployment environment.
[0041] According to the canary release method in this example embodiment, user terminals can be adjusted to a reasonable deployment environment in a timely manner as the canary rules change, resulting in high canary release efficiency. By incorporating the canary analysis factor corresponding to the current rule version into the deployment environment confirmation process, the deployment environment of the user terminal can be adjusted accordingly as the canary rule version changes along with the change of the corresponding canary analysis factor. This avoids both the user terminal always being in a certain deployment environment and the instability of the deployment environment under the same canary rule version, resulting in high flexibility of canary release and good canary effect and user experience.
[0042] The core issue of canary releases is how to segment traffic and determine the segmentation location. Since canary release logic is unrelated to business logic itself, this disclosure uses the access layer API gateway as the entry point for traffic segmentation. The following section combines... Figure 1 The grayscale publishing method in the exemplary embodiments of this disclosure will be described.
[0043] In step S110, grayscale rules are received, including grayscale analysis factors corresponding to the current rule version.
[0044] In an exemplary embodiment of this disclosure, the grayscale rules are issued to the API gateway by the grayscale configuration platform. After developers complete the grayscale configuration of the API on the grayscale configuration platform, the grayscale configuration platform issues the grayscale rules to the API gateway layer. The grayscale configuration platform is deployed on the API publishing platform (used to publish API services on the gateway side and provide API-related metadata to the gateway, including API creation, testing, and grayscale). The grayscale rules include grayscale analysis factors corresponding to the current rule version. The grayscale analysis factors are factors that influence the deployment environment of the terminal, including but not limited to calculation factors, grayscale ratios, and rule version numbers. The calculation factors are randomly updated as the grayscale rules are updated. Optionally, the calculation factors can be an ordered and non-repeating string of random numbers. Optionally, the calculation factors can also be adjusted by auto-incrementing. This disclosure includes but is not limited to the above-mentioned random update method of calculation factors. For the same grayscale rule, the rule version and calculation factors are fixed in this disclosure. The corresponding rule version and calculation factors are only updated when the API gateway receives a new grayscale rule from the grayscale configuration platform.
[0045] In step S120, the unique identifier of the service initiating terminal is obtained from the received service request.
[0046] In the exemplary embodiments of this disclosure, the unique identifier is an identification information obtained by the service-initiating terminal from the grayscale configuration platform to uniquely identify the user's identity. Before sending a service request, the terminal needs to send an identifier acquisition request to the grayscale configuration platform and receive the unique identifier returned by the grayscale configuration platform. This unique identifier only needs to be acquired once, and subsequently, the terminal needs to include the unique identifier when sending a service request to the gateway. Based on this, there is no instability in the deployment environment of the terminal due to changes in the identifier, i.e., sometimes the grayscale deployment is successful and sometimes it is not. The unique identifier can be a string of numbers randomly issued by the grayscale configuration platform.
[0047] In step S130, the deployment environment to which the service initiating terminal belongs is determined based on the grayscale analysis factor and the unique identifier, and the service initiating terminal is assigned to the deployment environment.
[0048] In an exemplary embodiment of this disclosure, the deployment environment includes a grayscale environment and a production environment. The deployment environment to which the service-initiating terminal belongs can be determined through grayscale analysis factors and a unique identifier, specifically including the following steps:
[0049] First, traffic segmentation calculations are performed on the grayscale analysis factors and unique identifiers. Based on the calculation results, the deployment environment of the service-initiating terminal is determined. The grayscale analysis factors include calculation factors and grayscale ratios. Figure 2 A flowchart illustrating the deployment environment for determining the service initiating endpoint is shown, such as... Figure 2 As shown:
[0050] In step S210, the calculation factor and the unique identifier are subjected to a remainder calculation according to a preset remainder model. Optionally, the following remainder calculation model can be used:
[0051] f = (unique identifier + calculation factor) % 100
[0052] Of course, other remainder models can be selected according to actual grayscale requirements, and remainder calculations can be performed based on unique identifiers and calculation factors. This disclosure includes, but is not limited to, the remainder models mentioned above.
[0053] In step S220, the calculation result is compared with the grayscale ratio, and the deployment environment of the service initiating terminal is determined based on the comparison result. The grayscale ratio is set according to the grayscale release requirements, and usually, the grayscale ratio is gradually increased during product release. By comparing the obtained calculation result (modulo result) with the grayscale ratio, if the calculation result is less than the grayscale ratio, the deployment environment of the service initiating terminal is determined to be a grayscale environment; otherwise, it is a production environment.
[0054] Secondly, the service initiating terminal is split into different deployment environments, either into a gray-scale environment or a production environment.
[0055] Furthermore, when switching the deployment environment of the service initiating terminal to a grayscale environment, service response information carrying a grayscale identifier can also be sent to the service initiating terminal, so that the terminal can save the grayscale identifier and include it in the service request when initiating a service request again. The grayscale identifier is contained in the grayscale rule and can be a string of numbers, or a combination of numbers, letters, or characters. The grayscale identifier also includes the current rule version number. Optionally, it can be obtained by truncating the grayscale identifier, for example, truncating the first 4 digits as the current rule version number. Of course, other truncating methods can also be used, such as truncating the first 3 digits, truncating the middle 5 to 7 digits, etc. This disclosure includes, but is not limited to, the above-mentioned truncating methods for the rule version number.
[0056] Based on this, after sending the service response information carrying the grayscale identifier to the service initiating terminal, if a service request carrying the grayscale identifier is received again, the service initiating terminal will be directly switched to the grayscale environment under the rule version number corresponding to the grayscale identifier, without having to repeat the traffic splitting calculation, thus improving grayscale efficiency.
[0057] In some possible implementations, when a new grayscale rule needs to be reissued, the updated grayscale rule is obtained, including the updated rule version number and the updated grayscale analysis factor. That is, when the grayscale rule version changes, the calculation factor is adjusted accordingly, and the grayscale ratio can also be adjusted according to the actual grayscale release requirements. When receiving a service request carrying a grayscale identifier, the current rule version number of the service initiating terminal is first obtained from the grayscale identifier, and the current rule version number is compared with the updated rule version number to determine whether traffic segmentation calculation needs to be recalculated. That is, the deployment environment of the service initiating terminal is adjusted according to the comparison result.
[0058] If the current rule version number is the same as the updated rule version number, the deployment environment to which the service initiating terminal belongs is maintained; if the current rule version number is different from the updated rule version number, the target deployment environment to which the service initiating terminal belongs is re-determined based on the unique identifier of the service initiating terminal and the updated grayscale factor, and the service initiating terminal is assigned to the target deployment environment.
[0059] It should be noted that the updated calculation factors in the updated grayscale analysis factors are updated randomly. For example, the calculation factor can be an ordered and non-repeating string of random numbers; alternatively, the calculation factor can also be adjusted by auto-incrementing. Based on this, since the updated grayscale factors in the new grayscale rules contain randomly updated calculation factors, these randomly updated calculation factors are included in the traffic segmentation calculation to prevent the service initiating terminal from remaining in a fixed ratio range during the grayscale process, thus avoiding the problem of always being in a grayscale environment.
[0060] For example, if the user identifier of a service initiating terminal is "211", the current rule version number is "1110", the calculation factor is "455", and the gray scale ratio is "10", based on the above modulo model, the modulo calculation f = (211 + 455) % 100 = 6.66 < 10, then the deployment environment of the service initiating terminal is a gray scale environment; if the updated gray scale rule is received, including the updated rule version number "1111", the updated calculation factor "792", and the updated gray scale ratio still set to "10". When the service-initiating terminal re-initiates a service request, the current rule version number is first extracted from the grayscale identifier in the service request, which is "1110". This is different from the updated rule version number "1111". Therefore, the target deployment environment of the service-initiating terminal needs to be determined again based on the unique identifier of the service-initiating terminal and the updated grayscale factor. That is, based on the above modulo model, the modulo calculation f = (211 + 792) % 100 = 10.03 is greater than 10. Therefore, the deployment environment of the service-initiating terminal under the updated grayscale rule should be the production environment. In other words, since the random update of the calculation factor participates in the traffic segmentation calculation, the same service-initiating terminal will not be restricted to the same deployment environment (grayscale environment) forever, resulting in a better user experience.
[0061] In some possible implementations, only the grayscale ratio in the grayscale rules needs to be adjusted. That is, the updated grayscale rules received by the gateway only update the grayscale ratio. Upon receiving a service request carrying a grayscale identifier, the gateway obtains the unique identifier of the service-initiating terminal and, based on the unique identifier and the grayscale analysis factor containing the updated grayscale ratio, determines the target deployment environment to which the service-initiating terminal belongs, and then assigns the service-initiating terminal to the target deployment environment. For example, if terminal A is currently a grayscale user, but after adjusting the grayscale ratio it is determined that terminal A is no longer a grayscale user, the gateway can adapt to the rule change in a timely manner and switch its deployment environment to the production environment. This approach to grayscale deployment offers high flexibility and efficiency.
[0062] Furthermore, to prevent vulnerabilities in interfaces or web pages during the canary release process from affecting the deployment environment of the service initiating terminal, when only the canary release ratio is adjusted, the current rule version number of the service initiating terminal can be obtained from the canary release identifier to determine whether the target deployment environment of the service initiating terminal is under the current rule version. If not, the service initiating terminal is switched to the target deployment environment under the current rule version, avoiding the problem of switching errors in the deployment environment of the service initiating terminal during the canary release process and improving the canary release effect.
[0063] The canary release method in this example embodiment can adjust user terminals to a reasonable deployment environment in a timely manner according to changes in canary rules, resulting in high canary release efficiency. By incorporating the canary analysis factor corresponding to the current rule version into the deployment environment confirmation process, the deployment environment of the user terminal can be adjusted accordingly as the canary rule version changes along with the corresponding canary analysis factor. This avoids the user terminal always being in a certain deployment environment (canary environment) and also avoids the situation where the deployment environment is unstable under the same canary rule version. The canary release has high flexibility, and the canary effect and user experience are good.
[0064] Figure 3 A flowchart illustrating the grayscale release interaction process according to exemplary embodiments of this disclosure is shown below. Figure 3 The gray-scale release method disclosed herein is explained as follows:
[0065] In step S310, the developer configures the API canary deployment rules on the canary deployment configuration platform (API publishing platform);
[0066] In step S320, the grayscale configuration platform sends the grayscale rules to the gateway. The gateway is responsible for loading the rule content of the grayscale rules (including the grayscale analysis factor corresponding to the current rule version) and in step S330, it returns the successful response information of rule configuration and rule sending to the developers.
[0067] In step S340, the service initiating terminal sends an identifier acquisition request to the grayscale configuration platform, and in step S350, it receives a unique identifier returned by the grayscale configuration platform.
[0068] In step S360, the service initiating terminal sends a service request carrying a unique identifier to the gateway;
[0069] In step S370, the gateway determines the deployment environment to which the service initiating terminal belongs based on the grayscale analysis factor obtained in step S320 and the unique identifier obtained in step S360.
[0070] In step S380, if it is determined that the deployment environment of the service initiating terminal is a grayscale environment, the service initiating terminal is switched to the grayscale environment through the gateway, and in step S390, the successful response information returned by the environment backend is received.
[0071] In step S3100, the gateway sends the service response information carrying the grayscale identifier to the service initiating terminal so that the service initiating terminal can store it and carry the grayscale identifier when initiating a service request again.
[0072] It should be noted that the execution order of steps S310 to S330 and S340 to S350 is not limited to the above order. Alternatively, steps S340 to S350 can be executed first, followed by steps S310 to S330.
[0073] In the above process, if the grayscale rules are updated through the grayscale configuration platform, the grayscale configuration platform will send the updated grayscale rules to the gateway, and the gateway will determine the deployment environment to which the service initiating terminal belongs through step S370. It should be noted that when the gateway receives a service request carrying a grayscale identifier, it first obtains the current rule version number to which the service initiating terminal belongs from the grayscale identifier, and compares the current rule version number with the updated rule version number to determine whether the same process as step S370 is needed to determine whether the deployment environment of the service initiating terminal needs to be re-determined. The comparison process for the rule version number has been described in the above implementation and will not be repeated here.
[0074] By adapting to changes in canary deployment rules in real time through the gateway, developers can be provided with a complete and efficient canary deployment method, avoiding problems such as canary deployment failure or terminals being in a canary environment during the canary deployment process, thus improving the stability of the canary deployment process.
[0075] Figure 4 A flowchart illustrating the overall process of grayscale deployment according to exemplary embodiments of this disclosure is shown, such as... Figure 4As shown, the entire canary release process is configured within the canary configuration platform of the API release platform (used to release API services on the gateway side, providing API-related metadata to the gateway, including API creation, API testing, API canary release, etc.). Before the canary release begins, the canary environment is deployed. Then, canary rules are configured on the canary configuration platform, and subsequently, the canary rules are distributed to the gateway layer. The gateway layer performs segmentation calculations based on the canary rules and allocates a portion of the traffic (e.g., 10%) to the canary environment. After the canary release verification is completed, all services in the production environment are replaced with the new services, 100% of user traffic is allocated to the production environment, the canary switch is turned off, and the canary environment is taken offline, thus completing the entire canary release process.
[0076] It should be noted that in the above-mentioned complete gray-scale release process, this disclosure completes the manual configuration of gray-scale policies and distributes them to the gateway layer by adding a gray-scale configuration platform to the API release platform. The gateway layer then further determines and adjusts the terminal deployment environment according to the gray-scale rules. Other processes are the same as the gray-scale release process in the prior art. This part will not be discussed in detail in this disclosure, so it will not be repeated.
[0077] Furthermore, in an exemplary embodiment of this disclosure, a grayscale publishing apparatus is also provided. (See reference...) Figure 5 As shown, the grayscale publishing device 500 may include a rule receiving module 510, an identifier acquisition module 520, and a grayscale publishing module 530. Specifically,
[0078] Rule receiving module 510 is used to receive grayscale rules, wherein the grayscale rules include grayscale analysis factors corresponding to the current rule version;
[0079] The identifier acquisition module 520 is used to obtain the unique identifier of the service initiating terminal from the received service request;
[0080] The grayscale deployment module 530 is used to determine the deployment environment to which the service initiating terminal belongs based on the grayscale analysis factor and the unique identifier, and to assign the service initiating terminal to the deployment environment.
[0081] In one exemplary embodiment of this disclosure, the grayscale publishing module 530 may further include:
[0082] The traffic segmentation calculation unit is used to perform traffic segmentation calculation on the grayscale analysis factor and the unique identifier, and determine the deployment environment to which the service initiating terminal belongs based on the calculation results;
[0083] An environment deployment unit is used to split the service initiating terminal into the deployment environment.
[0084] In an exemplary embodiment of this disclosure, the grayscale analysis factor includes a calculated factor and a grayscale ratio; the grayscale publishing module 530 may further include:
[0085] The remainder unit is used to perform remainder calculation on the calculation factor and the unique identifier according to a preset remainder model;
[0086] The comparison unit is used to compare the calculation result with the grayscale ratio and determine the deployment environment of the service initiating terminal based on the comparison result.
[0087] In one exemplary embodiment of this disclosure, the grayscale publishing device may further include:
[0088] The response information sending module is used to send service response information carrying a grayscale identifier to the service initiating terminal; wherein the grayscale identifier is included in the grayscale rule and the grayscale identifier includes the current rule version number.
[0089] In one exemplary embodiment of this disclosure, the grayscale publishing device may further include:
[0090] The service request receiving module is used to receive service requests carrying the grayscale identifier and switch the service initiating terminal to the grayscale environment under the rule version number corresponding to the grayscale identifier.
[0091] In an exemplary embodiment of this disclosure, an updated grayscale rule is received, the updated grayscale rule including an updated rule version number and an updated grayscale analysis factor; the grayscale publishing device may further include:
[0092] The service request receiving module is used to receive a service request carrying the grayscale identifier and obtain the current rule version number of the service initiating terminal from the grayscale identifier.
[0093] The version comparison module is used to compare the current rule version number with the updated rule version number;
[0094] The deployment environment adjustment module is used to adjust the deployment environment of the service initiating terminal according to the comparison results; wherein, the update calculation factor in the update grayscale analysis factor is updated using a random update method.
[0095] In an exemplary embodiment of this disclosure, the deployment environment adjustment module may further include:
[0096] The deployment environment maintenance unit is used to maintain the deployment environment to which the service initiating terminal belongs if the current rule version number is the same as the updated rule version number.
[0097] The target deployment environment determination unit is used to determine the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the update grayscale factor if the current rule version number is different from the update rule version number, and to assign the service initiating terminal to the target deployment environment.
[0098] In one exemplary embodiment of this disclosure, the grayscale publishing device may further include:
[0099] The service request receiving module is used to receive a service request carrying the grayscale identifier and obtain the unique identifier of the service initiating terminal.
[0100] The deployment environment update module is used to determine the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the grayscale analysis factor containing the updated grayscale ratio, and to assign the service initiating terminal to the target deployment environment.
[0101] In one exemplary embodiment of this disclosure, the grayscale publishing device may further include:
[0102] The rule version number acquisition module is used to obtain the current rule version number of the service initiating terminal from the grayscale identifier;
[0103] The judgment module is used to determine whether the target deployment environment of the service initiating terminal is the same as the environment under the current rule version; if not, the service initiating terminal is switched to the target deployment environment under the current rule version.
[0104] In an exemplary embodiment of this disclosure, the unique identifier of the service initiating terminal is obtained by the service initiating terminal from the grayscale configuration platform.
[0105] Since the functional modules of the grayscale publishing apparatus in the exemplary embodiments of this disclosure are the same as those in the inventive embodiments of the grayscale publishing method described above, they will not be described again here.
[0106] It should be noted that although several modules or units of the grayscale release device have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0107] Furthermore, in an exemplary embodiment of this disclosure, a canary release system is also provided, see [link to relevant documentation]. Figure 6 The system includes:
[0108] The application programming interface (API) gateway 610 is used to execute any of the canary release methods described above.
[0109] The gray-scale configuration platform 620, located on the API publishing platform, is used to configure gray-scale rules and distribute the configured gray-scale rules to the API gateway; and
[0110] The grayscale configuration platform is also used to respond to the identifier acquisition request of the service initiating terminal and assign a unique identifier to the service initiating terminal.
[0111] In an exemplary embodiment of this disclosure, the canary configuration platform distributes canary rules through Redis's pub / sub mode (a message communication mode).
[0112] Since the functional components of the grayscale release system in the exemplary embodiments of this disclosure are the same as those in the inventive embodiments of the grayscale release method described above, they will not be described again here.
[0113] Furthermore, in exemplary embodiments of this disclosure, a computer storage medium capable of implementing the above-described methods is also provided. A program product capable of implementing the methods described in this specification is stored thereon. In some possible embodiments, various aspects of this disclosure can also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0114] refer to Figure 7 As shown, a program product 700 for implementing the above-described method according to an exemplary embodiment of the present disclosure is described. This product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0115] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0116] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0117] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0118] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0119] Furthermore, in exemplary embodiments of this disclosure, an electronic device capable of implementing the above-described methods is also provided. Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be specifically implemented as entirely hardware embodiments, entirely software embodiments (including firmware, microcode, etc.), or embodiments combining hardware and software aspects, collectively referred to herein as "circuit," "module," or "system."
[0120] The following reference Figure 8 To describe an electronic device 800 according to such an embodiment of the present disclosure. Figure 8 The electronic device 800 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0121] like Figure 8 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, a bus 830 connecting different system components (including storage unit 820 and processing unit 810), and a display unit 840.
[0122] The storage unit stores program code that can be executed by the processing unit 810, causing the processing unit 810 to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of this disclosure.
[0123] Storage unit 820 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include a read-only memory (ROM) 8203.
[0124] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0125] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0126] Electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 800, and / or with any device that enables electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0127] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0128] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0129] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0130] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A grayscale release method, characterized in that, include: Receive grayscale rules, wherein the grayscale rules include grayscale analysis factors corresponding to the current rule version; The grayscale analysis factor includes a calculated factor and a grayscale ratio, and the calculated factor is randomly updated as the grayscale rules are updated. Obtain the unique identifier of the service-initiating terminal from the received service request; The deployment environment to which the service initiating terminal belongs is determined based on the grayscale analysis factor and the unique identifier, and the service initiating terminal is assigned to the deployment environment. The step of determining the deployment environment to which the service-initiating terminal belongs based on the grayscale analysis factor and the unique identifier includes: According to the preset remainder model, the calculation factor and the unique identifier are subjected to remainder calculation; The calculation result is compared with the grayscale ratio, and the deployment environment of the service initiating terminal is determined based on the comparison result; When the deployment environment of the service initiating terminal is switched to a grayscale environment, service response information carrying a grayscale identifier is sent to the service initiating terminal. The rule version and calculation factor of the same grayscale rule are fixed. When a new grayscale rule is received, the corresponding rule version and calculation factor are updated. The method further includes receiving updated grayscale rules, wherein the grayscale ratio included in the grayscale analysis factor of the updated grayscale rules is updated; the method also includes: The system receives a service request carrying the grayscale identifier, obtains the unique identifier of the service initiating terminal, and determines the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the grayscale analysis factor containing the updated grayscale ratio, and then assigns the service initiating terminal to the target deployment environment.
2. The method according to claim 1, characterized in that, The grayscale identifier is included in the grayscale rule, and the grayscale identifier includes the current rule version number.
3. The method according to claim 2, characterized in that, After sending the service response information carrying the grayscale identifier to the service initiating terminal, the method further includes: Upon receiving a service request carrying the grayscale identifier, the service initiating terminal is switched to the grayscale environment under the rule version number corresponding to the grayscale identifier.
4. The method according to claim 2, characterized in that, Receive updated grayscale rules, wherein the updated grayscale rules include an updated rule version number and an updated grayscale analysis factor; After sending the service response information carrying the grayscale identifier to the service initiating terminal, the method further includes: Receive a service request carrying the grayscale identifier, and obtain the current rule version number of the service initiating terminal from the grayscale identifier; Compare the current rule version number with the updated rule version number; The deployment environment of the service initiating terminal is adjusted based on the comparison results; The updated calculation factor in the updated grayscale analysis factor is updated using a random update method.
5. The method according to claim 4, characterized in that, The adjustment of the deployment environment of the service-initiating terminal based on the comparison results includes: If the current rule version number is the same as the updated rule version number, then the deployment environment to which the service initiating terminal belongs remains unchanged; If the current rule version number is different from the updated rule version number, the target deployment environment to which the service initiating terminal belongs is re-determined based on the unique identifier of the service initiating terminal and the updated grayscale factor, and the service initiating terminal is assigned to the target deployment environment.
6. The method according to claim 1, characterized in that, The method further includes: Obtain the current rule version number of the service initiating terminal from the grayscale identifier; Determine whether the target deployment environment of the service initiating terminal is the same as the environment under the current rule version; If not, the service initiating terminal will be switched to the target deployment environment under the current rule version.
7. The method according to any one of claims 1 to 6, characterized in that, The unique identifier of the service initiating terminal is obtained by the service initiating terminal from the grayscale configuration platform.
8. A grayscale publishing device, characterized in that, The device includes: The rule receiving module is used to receive grayscale rules, which include grayscale analysis factors corresponding to the current rule version; the grayscale analysis factors include calculation factors and grayscale ratios, and the calculation factors are randomly updated as the grayscale rules are updated; The identifier acquisition module is used to obtain the unique identifier of the service initiating terminal from the received service request; The canary deployment module is used to determine the deployment environment to which the service initiating terminal belongs based on the canary analysis factor and the unique identifier, and to allocate the service initiating terminal to the deployment environment; The canary deployment module is configured to execute: According to the preset remainder model, the calculation factor and the unique identifier are subjected to remainder calculation; The calculation result is compared with the grayscale ratio, and the deployment environment of the service initiating terminal is determined based on the comparison result; The grayscale publishing device also includes a response information sending module, which is used to send service response information carrying grayscale identifiers to the service initiating terminal; wherein, the rule version and calculation factor of the same grayscale rule are fixed, and when a new grayscale rule is received, the corresponding rule version and calculation factor are updated. The grayscale publishing device is also configured to perform: receiving an updated grayscale rule, wherein the grayscale analysis factor in the updated grayscale rule is updated to include a grayscale ratio; The grayscale publishing device also includes: The service request receiving module is used to receive service requests carrying the grayscale identifier and obtain the unique identifier of the service initiating terminal; the deployment environment update module is used to determine the target deployment environment to which the service initiating terminal belongs based on the unique identifier of the service initiating terminal and the grayscale analysis factor containing the updated grayscale ratio, and to assign the service initiating terminal to the target deployment environment.
9. A grayscale release system, characterized in that, The system includes: An application programming interface (API) gateway for executing the canary release method as described in any one of claims 1 to 7; A canary deployment configuration platform, located on the API publishing platform, is used to configure canary deployment rules and distribute the configured canary deployment rules to the API gateway; and The grayscale configuration platform is also used to respond to the identifier acquisition request of the service initiating terminal and assign a unique identifier to the service initiating terminal.
10. A storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the grayscale publishing method according to any one of claims 1 to 7.
11. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the grayscale release method of any one of claims 1 to 7 by executing the executable instructions.