Gray release method of front-end and rear-end separation system

By designing a grayscale policy table and a user grayscale information table in the front-end separation system, combining the customer number tail number and whitelist, dynamic mapping and grayscale release of front-end resource paths is realized, which solves the problems of inconsistency in versions and inflexible traffic control, and improves user experience and system stability.

CN120017699APending Publication Date: 2025-05-16SHANGHAI RURAL COMML BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411993606.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

Under the front-end and back-end separation architecture, when grayscale release is implemented, the front-end and back-end versions are inconsistent, and there is a lack of flexible traffic control and resource mapping mechanisms, which affects user experience and system stability.

Method used

By designing a grayscale policy table and a user grayscale information table in the database, dividing the grayscale user group according to the customer number end number, maintaining an exception whitelist, adding routing logic and API gateway routing, realizing front-end resource path mapping, and comprehensive calculations are performed based on user identity and grayscale switches to determine the resources to jump.

Benefits of technology

Ensure consistency of front-end access versions, provide flexible traffic control and resource mapping mechanisms, improve user experience and system stability, and is suitable for single-piece and microservice architectures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120017699A_ABST
    Figure CN120017699A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of internet application development, and particularly discloses a gray release method of a front-end and back-end separation system, which comprises the following steps of: S1, designing two tables for supporting two dynamic gray scale proportion adjustment modes in a database; s2, according to the last two positions of the tail number of the customer number, dividing gray user groups according to a proportion; s3, maintaining an exception white list, and appointing a specific customer to participate in or not participate in the gray scale test; according to the method, the problem of inconsistent versions of gray release under a front-end and rear-end separation architecture is solved through transmission of the gray identifier at the front end and the rear end, and the user experience and the system stability are improved; according to the invention, a plurality of flow control modes are provided, a general flow control mechanism based on the tail number of the customer number is supported, the exception list is added to support dynamic adjustment of the gray user range, the requirements in different service scenes are met, dynamic mapping of front and rear end resource paths is realized, the gray release process is smoother, and the influence on the user is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of Internet application development, and in particular relates to a grayscale publishing method for a front-end and back-end separation system. Background Art

[0002] In modern Internet application development, the front-end and back-end separation architecture has become the mainstream choice. The front-end is responsible for the user interface and interaction, using frameworks such as Vue and React; the back-end processes data and business logic, and provides RESTful APIs for the front-end to call. This architecture improves development efficiency and code maintainability.

[0003] However, in an architecture with separated front-end and back-end, there are some challenges in implementing grayscale releases. The main issues are how to ensure the consistency of versions accessed by users on the front-end and back-end, and how to flexibly control the proportion and scope of grayscale traffic. These issues directly affect the user experience and system stability.

[0004] The existing grayscale release method has the following disadvantages in the front-end and back-end separation system:

[0005] Version inconsistency: Since the front-end and back-end may be gray-scale controlled separately, the versions accessed by users on the front-end and back-end are inconsistent, resulting in compatibility issues and affecting user experience.

[0006] Inflexible traffic control: There is a lack of refined traffic control mechanism, and the proportion and scope of grayscale release cannot be dynamically adjusted according to business needs.

[0007] Difficult resource mapping: There is a lack of effective mapping mechanism between the front-end resource path and the back-end service, making it difficult to implement a unified grayscale release strategy. Therefore, we need to propose a grayscale release method for the front-end and back-end separation system to solve the above problems, so that it can ensure the consistency of the versions accessed by users on the front-end and back-end, and provide flexible traffic control and resource mapping mechanisms. Summary of the invention

[0008] The purpose of the present invention is to provide a grayscale publishing method for a front-end and back-end separated system, which can ensure the version consistency accessed by users on the front-end and back-end, and provide a flexible flow control and resource mapping mechanism to solve the problems raised in the above background technology.

[0009] To achieve the above object, the present invention adopts the following technical solutions:

[0010] A grayscale release method for a front-end and back-end separation system includes the following steps:

[0011] S1. Design two tables in the database to support two dynamic grayscale ratio adjustment methods;

[0012] S2. Divide the grayscale user groups in proportion according to the last two digits of the customer number;

[0013] S3. Maintain an exception whitelist to specify specific customers to participate in or not participate in the grayscale test to meet specific business needs;

[0014] S4. In a single application, by adding routing logic at the service layer, different business processes are selected according to the grayscale identifier;

[0015] S5. In the microservice architecture, use the API gateway or service registry to route requests to the corresponding version of the microservice instance based on the grayscale identifier;

[0016] S6. Map the resource paths between the front-end and back-end so that the same menu operation can return different front-end jump paths according to the grayscale identifier;

[0017] S7. Combining the user identity, menu items and grayscale master switch factors, the comprehensive calculation should jump to production resources or grayscale resources.

[0018] Preferably, in step S1, the two tables designed in the database are a grayscale strategy table and a user grayscale information table, wherein the grayscale strategy table stores the overall strategy and parameters for grayscale ratio adjustment, and the overall strategy and parameters include strategy ID, strategy name, start time, end time, user percentage, and new logic flag; the user grayscale information table stores whether each user participates in the grayscale test and specific grayscale information. By connecting the user ID and the strategy ID in parallel, it is possible to determine whether each user participates in the current grayscale test and obtain information on its grayscale version, start and end time.

[0019] Preferably, the dynamic grayscale ratio adjustment method is to adjust the grayscale ratio by modifying the fields in the grayscale strategy table or to dynamically adjust the grayscale state of the user by modifying the fields in the user grayscale table.

[0020] Preferably, in step S2, when dividing the grayscale user group, the two fields between the first and last two customer numbers and the last two customer numbers are set as grayscale customers.

[0021] Preferably, in step S3, the exception whitelist inclusion rule is: when a customer is not within the interval range set in the grayscale control table but wants to experience the subsequent functions, or when a customer is within the interval range set in the grayscale control table but does not want to experience the new functions, then configure the customer number and status in the table to make it a high-priority exception adjustment.

[0022] Preferably, in step S4, in the single application, the business process selected according to the grayscale identifier includes grayscale function and scope control, resource path mapping, and dynamic resource guidance; the grayscale function and scope control is that when the customer logs in, the application background queries the database according to the requested customer information and returns the grayscale identifier corresponding to the customer;

[0023] Resource path mapping is that the application backend calculates and returns the cookie and path corresponding to the current request of the application frontend according to the returned grayscale identifier according to the rules;

[0024] Dynamic resource guidance is that the application front end accesses the corresponding production version or gray version of static resources based on the cookie identifier returned by the application back end; it is also based on the resource path returned by the application back end, by setting different reverse proxy strategies on the web server, configuring different regular expressions and forwarding paths in ProxyPass and ProxyPassReversse, so as to forward the request to the production version or gray version of the back end resources.

[0025] Preferably, in step S5, in the microservice architecture, the process of using the API gateway or service registration center to route the request to the corresponding version of the microservice instance according to the grayscale identifier is as follows:

[0026] S51. When the customer logs in, the application background queries the gray and white lists in the database according to the requested customer information and returns the grayscale identifier corresponding to the customer;

[0027] S52, the application backend calculates the cookie and path corresponding to the current request and returns it to the application frontend according to the returned grayscale identifier and the rules;

[0028] S53, the application front end accesses the corresponding production version or gray version static resource based on the cookie identifier returned by the application back end, and also sets the corresponding NextRouteVersion in the message requesting the back end based on the resource path returned by the application back end;

[0029] S54. The application backend routes the user to the corresponding production version or gray version of the microservice according to the NextRouteVersion carried in the frontend http request header and the configuration of the registration center.

[0030] Preferably, in step S6, when mapping the resource paths between the front-end and back-end, in the front-end project, the menu items are dynamically rendered according to the user's grayscale identifier. When the user clicks the menu item, the correct resource path is obtained from the mapping table according to the grayscale identifier and a jump is performed.

[0031] Preferably, in step S7, the user identity, menu items and grayscale master switch factors are mainly based on the information returned by the application backend based on queries from the database. The returned information includes whether the function is a grayscale function, whether the customer is a grayscale customer and whether the grayscale master switch is turned on.

[0032] Preferably, the comprehensive calculation should jump to the calculation of production resources or grayscale resources. The overall principle is: when the grayscale switch is turned off or the function is non-grayscale, the path of newPath is uniformly taken; when the grayscale switch is turned on and the function is also grayscale, if the customer is a grayscale customer, the path of newPath is returned, if the customer is a non-grayscale customer, the path path is returned.

[0033] Compared with the prior art, the grayscale publishing method of the front-end and back-end separation system proposed in the present invention has the following advantages:

[0034] 1. The present invention solves the problem of inconsistent versions of grayscale releases under the front-end and back-end separation architecture by transmitting grayscale identifiers between the front-end and back-end, thereby improving user experience and system stability; the present invention provides a variety of flow control methods, supports a general flow control mechanism based on the last digit of the customer number, and supports dynamic adjustment of the grayscale user range with an exception list to meet the needs of different business scenarios, realizes dynamic mapping of front-end and back-end resource paths, makes the grayscale release process smoother, and reduces the impact on users;

[0035] 2. The present invention is applicable to both monolithic and microservice architectures, has strong versatility, and is convenient for promotion and application in different types of projects. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a flowchart of the present invention;

[0037] Figure 2 It is a schematic diagram of the process of the monolithic architecture solution of the present invention;

[0038] Figure 3 It is a schematic diagram of the flow of the microservice architecture solution of the present invention. DETAILED DESCRIPTION

[0039] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. The specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0040] The present invention provides Figure 1-3A grayscale release method for a front-end and back-end separation system shown includes the following steps:

[0041] S1. Design two tables in the database to support two dynamic grayscale ratio adjustment methods;

[0042] The two tables designed in the database are a grayscale strategy table and a user grayscale information table, wherein the grayscale strategy table stores the overall strategy and parameters for grayscale ratio adjustment, including strategy ID, strategy name, start time, end time, user percentage, and new logic flag; the user grayscale information table stores whether each user participates in the grayscale test and specific grayscale information. By connecting the user ID and the strategy ID in parallel, it is possible to determine whether each user participates in the current grayscale test and obtain information on its grayscale version, start and end time.

[0043] The dynamic grayscale ratio adjustment method is to adjust the grayscale ratio by modifying the fields in the grayscale strategy table or to dynamically adjust the grayscale state of the user by modifying the fields in the user grayscale table.

[0044] S2. Divide the grayscale user groups in proportion according to the last two digits of the customer number to achieve random and balanced user selection;

[0045] When dividing the grayscale user groups, the two digits between the starting and ending customer numbers are set as grayscale customers. For example, when the values ​​of the two digits between the starting and ending customer numbers are 10 and 20 respectively, customers with customer numbers ending in 10-20 will be set as grayscale customers. This simple method realizes proportional control of the grayscale release ratio.

[0046] The key to achieving consistency of front-end and back-end versions is proposed by proposing a method of carrying grayscale identifiers in HTTP Cookies and request headers. HTTP Cookies are a small piece of data sent by the server to the user's browser and saved locally. It will be carried and sent to the server the next time the browser initiates a request to the same server.

[0047] S3. Maintain an exception whitelist to specify specific customers to participate in or not participate in grayscale testing to meet specific business needs;

[0048] The exception whitelist inclusion rule is: when a customer is not within the interval range set in the grayscale control table but wants to experience the post-merger function, or when a customer is within the interval range set in the grayscale control table but does not want to experience the new function, then configure its customer number and status in the table to make it a high-priority exception adjustment;

[0049] By designing a dual flow control mechanism based on the customer number suffix and whitelist, the proportion and scope of grayscale release can be dynamically adjusted.

[0050] S4. In a single application, by adding routing logic at the service layer, different business processes are selected according to the grayscale identifier;

[0051] like Figure 2 As shown in the figure, in a single application, the business process selected according to the grayscale identifier includes grayscale function and scope control, resource path mapping, and dynamic resource guidance; the grayscale function and scope control is when the customer logs in, the application background queries the database according to the requested customer information and returns the grayscale identifier corresponding to the customer;

[0052] Resource path mapping is that the application backend calculates and returns the cookie and path corresponding to the current request of the application frontend according to the returned grayscale identifier according to the rules;

[0053] Dynamic resource guidance is that the application front end accesses the corresponding production version or gray version of static resources based on the cookie identifier returned by the application back end; it is also based on the resource path returned by the application back end, by setting different reverse proxy strategies on the web server, configuring different regular expressions and forwarding paths in ProxyPass and ProxyPassReversse, so as to forward the request to the production version or gray version of the back end resources.

[0054] S5. In the microservice architecture, use the API gateway or service registry to route requests to the corresponding version of the microservice instance based on the grayscale identifier;

[0055] like Figure 3 As shown in the figure, in the microservice architecture, the process of using the API gateway or service registration center to route requests to the corresponding version of the microservice instance according to the grayscale identifier is as follows:

[0056] S51. When the customer logs in, the application background queries the gray and white lists in the database according to the requested customer information and returns the grayscale identifier corresponding to the customer;

[0057] S52, the application backend calculates the cookie and path corresponding to the current request and returns it to the application frontend according to the returned grayscale identifier and the rules;

[0058] S53, the application front end accesses the corresponding production version or gray version static resource based on the cookie identifier returned by the application back end, and also sets the corresponding NextRouteVersion in the message requesting the back end based on the resource path returned by the application back end;

[0059] S54. The application backend routes the user to the corresponding production version or gray version of the microservice according to the NextRouteVersion carried in the frontend http request header and the configuration of the registration center.

[0060] S6. Map the resource paths between the front-end and back-end so that the same menu operation can return different front-end jump paths according to the grayscale identifier;

[0061] When mapping the resource paths between the front-end and back-end, in the front-end project, the menu items are dynamically rendered according to the user's grayscale identifier. When the user clicks the menu item, the correct resource path is obtained from the mapping table according to the grayscale identifier and the jump is performed.

[0062] By creating mapping rules for front-end and back-end resource paths, we ensure the consistency and controllability of user operations in both grayscale and production environments.

[0063] S7, combined with the user identity, menu items and grayscale total switch factors, the comprehensive calculation should jump to the production resource or grayscale resource;

[0064] The combination of user identity, menu items and the grayscale master switch factors is mainly based on the information returned by the application backend based on queries from the database. The returned information includes whether the function is a grayscale function, whether the customer is a grayscale customer, and whether the grayscale master switch is turned on. Through this series of comprehensive information, it is comprehensively calculated whether to return PATH (representing normal resources) or NEW_PATH (representing grayscale resources).

[0065] The overall principle for the comprehensive calculation to jump to the calculation of production resources or grayscale resources is: when the grayscale switch is turned off or the function is non-grayscale, the path of newPath is uniformly taken; when the grayscale switch is turned on and the function is also grayscale, if the customer is a grayscale customer, the path of newPath is returned; if the customer is a non-grayscale customer, the path is returned.

[0066] In summary, the present invention provides a variety of flow control methods, supports a general flow control mechanism based on the last digit of the customer number, and supports dynamic adjustment of the grayscale user range with an exception list to meet the needs of different business scenarios, and realizes dynamic mapping of front-end and back-end resource paths, making the grayscale publishing process smoother and reducing the impact on users; through the transmission of grayscale identification between the front-end and back-end, the version inconsistency problem of grayscale release under the front-end and back-end separation architecture is solved, and the user experience and system stability are improved. The present invention is suitable for monolithic and microservice architectures, has strong versatility, and is convenient for promotion and application in different types of projects.

[0067] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A grayscale release method for a front-end and back-end separation system, characterized by: The steps include: S1. Design two tables in the database to support two dynamic grayscale ratio adjustment methods; S2. Divide the grayscale user groups in proportion according to the last two digits of the customer number; S3. Maintain an exception whitelist to specify specific customers to participate in or not participate in the grayscale test to meet specific business needs; S4. In a single application, by adding routing logic at the service layer, different business processes are selected according to the grayscale identifier; S5. In the microservice architecture, use the API gateway or service registry to route requests to the corresponding version of the microservice instance based on the grayscale identifier; S6. Map the resource paths between the front-end and back-end so that the same menu operation can return different front-end jump paths according to the grayscale identifier; S7. Combining the user identity, menu items and grayscale master switch factors, the comprehensive calculation should jump to production resources or grayscale resources.

2. According to claim 1, a grayscale release method for a front-end and back-end separation system is characterized in that: In step S1, the two tables designed in the database are a grayscale strategy table and a user grayscale information table, wherein the grayscale strategy table stores the overall strategy and parameters for grayscale ratio adjustment, and the overall strategy and parameters include strategy ID, strategy name, start time, end time, user percentage, and new logic flag; the user grayscale information table stores whether each user participates in the grayscale test and specific grayscale information. By connecting the user ID and the strategy ID in parallel, it is possible to determine whether each user participates in the current grayscale test and obtain information on its grayscale version, start and end time.

3. The grayscale release method of the front-end and back-end separation system according to claim 2 is characterized by: The dynamic grayscale ratio adjustment method is to adjust the grayscale ratio by modifying the fields in the grayscale strategy table or to dynamically adjust the grayscale state of the user by modifying the fields in the user grayscale table.

4. The grayscale release method of the front-end and back-end separation system according to claim 3 is characterized by: In step S2, when dividing the grayscale user group, the two fields between the first and last two customer numbers are set as grayscale customers.

5. The grayscale release method of the front-end and back-end separation system according to claim 4 is characterized in that: In step S3, the exception whitelist inclusion rule is: when a customer is not within the interval range set in the grayscale control table but wants to experience the subsequent functions, or when a customer is within the interval range set in the grayscale control table but does not want to experience the new functions, then configure the customer number and status in the table to make it a high-priority exception adjustment.

6. The grayscale publishing method of the front-end and back-end separation system according to claim 5 is characterized in that: In step S4, in the single application, the business process selected according to the grayscale identifier includes grayscale function and scope control, resource path mapping, and dynamic resource guidance; the grayscale function and scope control is that when the customer logs in, the application background queries the database according to the requested customer information and returns the grayscale identifier corresponding to the customer; Resource path mapping is that the application backend calculates and returns the cookie and path corresponding to the current request of the application frontend according to the returned grayscale identifier according to the rules; Dynamic resource guidance is that the application front end accesses the corresponding production version or gray version of static resources based on the cookie identifier returned by the application back end; it is also based on the resource path returned by the application back end, by setting different reverse proxy strategies on the web server, configuring different regular expressions and forwarding paths in ProxyPass and ProxyPassReversse, so as to forward the request to the production version or gray version of the back end resources.

7. The grayscale release method of the front-end and back-end separation system according to claim 6 is characterized by: In step S5, in the microservice architecture, the process of using the API gateway or service registration center to route the request to the corresponding version of the microservice instance according to the grayscale identifier is as follows: S51. When the customer logs in, the application background queries the gray and white lists in the database according to the requested customer information and returns the grayscale identifier corresponding to the customer; S52, the application backend calculates the cookie and path corresponding to the current request and returns it to the application frontend according to the returned grayscale identifier and the rules; S53, the application front end accesses the corresponding production version or gray version static resource based on the cookie identifier returned by the application back end, and also sets the corresponding NextRouteVersion in the message requesting the back end based on the resource path returned by the application back end; S54. The application backend routes the user to the corresponding production version or gray version of the microservice according to the NextRouteVersion carried in the frontend http request header and the configuration of the registration center.

8. The grayscale publishing method of the front-end and back-end separation system according to claim 7 is characterized in that: In step S6, when mapping the resource paths between the front-end and back-end, in the front-end project, the menu items are dynamically rendered according to the user's grayscale identifier. When the user clicks the menu item, the correct resource path is obtained from the mapping table according to the grayscale identifier and a jump is performed.

9. The grayscale publishing method of the front-end and back-end separation system according to claim 8 is characterized in that: In step S7, the user identity, menu items and grayscale switch factors are mainly based on the information returned by the application backend based on the query from the database. The returned information includes whether the function is a grayscale function, whether the customer is a grayscale customer and whether the grayscale switch is turned on.

10. The grayscale release method of the front-end and back-end separation system according to claim 9, characterized in that: The overall principle for the comprehensive calculation to jump to the calculation of production resources or grayscale resources is: when the grayscale switch is turned off or the function is non-grayscale, the path of newPath is uniformly taken; when the grayscale switch is turned on and the function is also grayscale, if the customer is a grayscale customer, the path of newPath is returned; if the customer is a non-grayscale customer, the path is returned.