Grayscale shunting method and device, application server, medium and program product
By performing grayscale shunt at the application server level, the problem of rough grayscale traffic control of the gateway is solved, and finer granular flow control and more flexible traffic allocation are achieved.
Patent Information
- Application Number
- CN202411395693.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the gateway has a rough grayscale flow control due to complex routing pressure, performance problems, and related influences.
By performing grayscale shunt at the application server level, using application resources to finely control the flow, stripping away the complex routing pressure of the gateway. The application server dynamically decides whether to forward the request to the new version of the service or keep it on the old version based on the request characteristics, user attributes, or business logic.
It realizes finer granular control of grayscale traffic, and has more flexible traffic allocation, avoids complex routing pressures at the gateway layer, and improves the accuracy and effectiveness of traffic control.
Smart Images

Figure CN119420701A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of grayscale splitting technology, and in particular to a grayscale splitting method, device, application server, medium and program product. Background Art
[0002] As the frequency of application delivery increases, rapid application updates and delivery requirements have led to grayscale deployment and flow control verification becoming important means to ensure delivery quality.
[0003] In related technologies, the gateway serves as the entrance and exit of traffic, and is responsible for routing user requests to different backend service instances according to preset rules, such as limiting the number of requests entering the new version per second to prevent the new version from crashing due to excessive traffic, thereby achieving traffic control.
[0004] However, due to complex routing pressure, performance issues, association impacts and other factors, the gateway's grayscale traffic control is relatively rough. Summary of the invention
[0005] The main purpose of this application is to provide a grayscale diversion method, device, application server, medium and program product, aiming to solve the technical problem of rough grayscale flow control.
[0006] To achieve the above purpose, the present application proposes a grayscale splitting method, which is applicable to an application server. The grayscale splitting method includes:
[0007] When the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request.
[0008] In one embodiment, when the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request, including:
[0009] When the request interceptor of the application server intercepts the current processing request distributed by the gateway, the current processing request is forwarded to the diversion instance;
[0010] The grayscale diversion module in the diversion instance is used to perform grayscale diversion on the current processing request.
[0011] In one embodiment, grayscale diversion is performed on the current processing request by a grayscale diversion module in a diversion instance, including:
[0012] Determine the target availability zone corresponding to the current processing request;
[0013] Forward the current processing request to the offload instance in the target availability zone;
[0014] The grayscale diversion module in the diversion instance is used to perform grayscale diversion on the current processing request.
[0015] When the target release mode is the canary release mode, the offloaded instance is the new version instance;
[0016] In one embodiment, the step of performing grayscale diversion on the current processing request by the grayscale diversion module in the diversion instance includes:
[0017] Perform grayscale identification on the current processing request through the grayscale diversion module in the diversion instance;
[0018] When the current processing request is identified as a grayscale request, the current processing request is processed by the offload instance to obtain a processing result;
[0019] When the current processing request is identified as a non-grayscale request, the current processing request is diverted to the old version instance for processing to obtain the processing result.
[0020] When the target release mode is the blue-green release mode, the diversion instance is the old version instance;
[0021] In one embodiment, the step of performing grayscale diversion on the current processing request by the grayscale diversion module in the diversion instance includes:
[0022] Perform grayscale identification on the current processing request through the grayscale diversion module in the diversion instance;
[0023] When the current processing request is identified as a grayscale request, the current processing request is diverted to the grayscale instance for processing to obtain a processing result; the grayscale instance is a new version instance in the same availability zone;
[0024] When the current processing request is identified as a non-grayscale request, the current processing request is processed by the offload instance to obtain a processing result.
[0025] In one embodiment, when the request interceptor of the application server intercepts the current processing request distributed by the gateway, after the step of gray-scale diversion of the current processing request by the gray-scale diversion module of the application server, the method further includes:
[0026] Store the processing results in the asynchronous queue of the offload instance;
[0027] Control any thread bucket among the multiple thread buckets to consume the processing results in the asynchronous queue, obtain grayscale processing index data, and store the grayscale processing index data in the current time block of the thread bucket; each thread bucket has a time ring, the time ring includes multiple time blocks connected end to end in sequence, and the time ring rotates with time, and the time block corresponding to the current time among the multiple time blocks is the current time block;
[0028] When it is detected that the current time block of all thread buckets changes, the grayscale processing index data in the previous time block of the current time block in all thread buckets is extracted and aggregated to obtain the aggregated index data;
[0029] The aggregated indicator data is sent to the grayscale monitoring center in the application server so that the grayscale monitoring center analyzes the aggregated indicator data and obtains the success rate of the new version instance processing data requests.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a grayscale splitting device, the grayscale splitting device comprising:
[0031] The processing module is used to perform grayscale diversion on the current processing request through the grayscale diversion module of the application server when the request interceptor of the application server intercepts the current processing request distributed by the gateway.
[0032] In addition, to achieve the above objectives, the present application also proposes an application server, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the grayscale splitting method described above.
[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the grayscale splitting method described above are implemented.
[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the grayscale splitting method described above are implemented.
[0035] One or more technical solutions proposed in this application have at least the following technical effects:
[0036] In this application, compared with the related art, in which grayscale traffic is controlled by a gateway, this application fully utilizes application resources by separating fine-grained flow control from the gateway and sinking it to applications that require complex diversion rules, and relieves the complex routing pressure of the public gateway layer. That is, by performing grayscale diversion at the application server level, the distribution of traffic can be flexibly controlled according to actual business needs and system load. The application server can dynamically decide whether to forward the request to the new version of the service or keep it on the old version based on the characteristics of the request, the user's attributes, or other business logic, making traffic control more accurate and effective, thereby enabling more fine-grained control of grayscale traffic. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the grayscale splitting method of the present application;
[0040] Figure 2 Flow diagram of the whitelist configuration form for this application;
[0041] Figure 3 A schematic diagram of the process of selecting a diversion instance for this application;
[0042] Figure 4 A schematic diagram of the processing flow for processing data for the grayscale indicator of this application;
[0043] Figure 5 This is a schematic diagram of the architecture of the application server for this application;
[0044] Figure 6 A schematic diagram of the diversion operation performed on the current processing request for this application diversion instance;
[0045] Figure 7 This is a schematic diagram of the module structure of the grayscale splitting device according to an embodiment of the present application;
[0046] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the application server in the embodiment of the present application.
[0047] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0049] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0050] The main solution of the embodiment of the present application is: when the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request.
[0051] In this embodiment, for ease of description, the following description is made with the application server as the execution entity.
[0052] With the increase in the frequency of application delivery, the rapid application update and delivery requirements have led to grayscale deployment and flow control verification becoming important means to ensure delivery quality. For example, in financial transaction scenarios, grayscale verification is required for transactions with specific identifiers such as specific customer groups and amounts, or transactions with specific interfaces.
[0053] In related technologies, the gateway serves as the entrance and exit of traffic, and is responsible for routing user requests to different backend service instances according to preset rules, such as limiting the number of requests entering the new version per second to prevent the new version from crashing due to excessive traffic, thereby achieving traffic control.
[0054] However, due to complex routing pressure, performance issues, association impacts and other factors, the gateway's grayscale traffic control is relatively rough.
[0055] This application provides a solution. Compared with the related art, in which grayscale traffic is controlled by a gateway, this application fully utilizes application resources by separating fine-grained control from the gateway and sinking it to applications that require complex diversion rules, and relieves the complex routing pressure of the public gateway layer. That is, by performing grayscale diversion at the application server level, the distribution of traffic can be flexibly controlled according to actual business needs and system load. The application server can dynamically decide whether to forward the request to the new version of the service or keep it on the old version based on the characteristics of the request, the user's attributes, or other business logic, making traffic control more accurate and effective, thereby enabling more fine-grained control of grayscale traffic.
[0056] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an application server, etc. The following takes the application server as an example to illustrate this embodiment and the following embodiments.
[0057] Based on this, the present application embodiment provides a grayscale splitting method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the grayscale splitting method of the present application.
[0058] In this embodiment, the grayscale splitting method includes step S10:
[0059] Step S10: When the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request.
[0060] In this embodiment, the current processing request intercepted by the request interceptor may be a request distributed from the gateway and not yet processed. The current processing request may be a data transaction request sent by the user end or other servers. The grayscale diversion module is set at the user layer of the application server, and the grayscale diversion module includes an instance anchor component, a flow control rule acquisition component, a diversion component, and an indicator collection and reporting component.
[0061] After intercepting the current processing request, the request interceptor can grayscale divert the current processing request through the grayscale diversion module of the application server. In order to accurately divert the current processing request, further, as an optional implementation, step S10 specifically includes:
[0062] Step S101: When the request interceptor of the application server intercepts the current processing request distributed by the gateway, the current processing request is forwarded to the offload instance.
[0063] Step S102: grayscale diversion is performed on the current processing request through the grayscale diversion module in the diversion instance.
[0064] In this embodiment, the diversion instance can be a specific version instance that actually implements a specific diversion configuration or strategy in grayscale release or traffic management, which can distribute requests or traffic to different version instances according to flow control rules.
[0065] It should be noted that when the grayscale diversion module in the diversion instance performs grayscale diversion on the current processing request, in order to flexibly respond to different loads and business needs, the diversion instance can start a scheduled task and regularly read the flag parameters of the flow control rules from the service center of the application server. After reading the flag parameters, the diversion instance determines whether to stop the diversion function according to the flag parameters. When the diversion function needs to be stopped, the diversion instance closes the diversion and releases the resources occupied by the grayscale diversion module in the diversion instance. When the diversion function does not need to be stopped, the diversion instance reads the latest flow control rules from the service center of the application server, that is, updates the parameters. After obtaining the latest flow control rules, determine whether there is a whitelist configuration form in the latest flow control rules. If there is no whitelist configuration form, the diversion instance no longer performs subsequent operations and returns to the step of regularly reading the flag parameters of the flow control rules from the service center of the application server. If there is a whitelist configuration table, determine whether the whitelist configuration form is consistent with the existing whitelist configuration form. If the whitelist configuration form is consistent with the existing whitelist configuration form, the traffic diversion instance will no longer perform subsequent operations and return to the step of periodically reading the flag parameters of the traffic control rules from the service center of the application server. If the whitelist configuration form is inconsistent with the existing whitelist configuration form, the whitelist configuration form will be synchronized to all old version instances. Figure 2As shown, Figure 2 The whitelist configuration form is a flowchart. The whitelist configuration form only exists in the whitelist verification phase. If it is not the whitelist verification phase, the whitelist configuration forms of all old instances are cleared.
[0066] When grayscale diversion is performed on the current processing request through the grayscale diversion module in the diversion instance, in order to ensure that each new version instance can be accurately grayscale verified and the stable operation of the application server is guaranteed, further, as an optional implementation, step S102 specifically includes:
[0067] Step S1021, determining the target available zone corresponding to the current processing request.
[0068] Step S1022: forward the current processing request to the offload instance in the target availability zone.
[0069] Step S1023, grayscale diversion is performed on the current processing request through the grayscale diversion module in the diversion instance.
[0070] In this embodiment, the application server may have multiple sub-libraries, each sub-library may have multiple partitions, and the version instances may be stored in the available partitions of each sub-library in a dispersed manner. Each available partition may have multiple version instances for processing the current processing request.
[0071] Specifically, after the current processing request distributed by the gateway is intercepted by the interceptor, the characteristics or requirements of the current processing request can be analyzed so that the target availability zone corresponding to the current processing request can be quickly determined. After the target availability zone corresponding to the current processing request is determined, the current processing request can be forwarded to the diversion instance in the target availability zone so that the grayscale diversion module in the diversion instance can perform grayscale diversion on the current processing request.
[0072] It should be noted that before forwarding the current processing request to the offload instance in the available zone, you need to select the offload instance from the available zone first. Figure 3 As shown, Figure 3 Schematic diagram of the selected flow for the diversion example. Figure 3In the grayscale release, the grayscale diversion module can be used to read the resource information and configuration information of each version instance, and upload the configuration information to the service center. After receiving the resource information and configuration information of each version instance, the service center parses the resource information and configuration information according to the regional rules to select a new version instance from multiple new version instances in the partition as the grayscale instance, and parses the registration rules of the grayscale instance to determine the target release mode of the grayscale instance. When the target release mode of the grayscale instance is the canary release mode, the grayscale instance is used as the diversion instance. When the target release mode is the blue-green release mode, an old version instance is determined from the partition of the grayscale instance, the old version instance is used as the diversion instance, and the old version instance is bound to the new version instance.
[0073] In this embodiment, when determining the diversion instance for the current transaction processing, the diversion instance is determined from multiple version instances in the partitions of multiple sub-libraries, that is, the grayscale instance is selected according to the sub-library dimension for refined grayscale verification, which can ensure that each version instance in each sub-library is accurately grayscale verified, thereby ensuring the stable operation of the application server.
[0074] It should be noted that different release modes correspond to different diversion instances. For example, when the target release mode is the canary release mode, the corresponding flow control component is the new-to-old flow control component, that is, when the target release mode is the canary release mode, the diversion instance is the new version instance. When the target release mode is the blue-green release mode, the corresponding flow control component is the old-to-new flow control component, that is, when the target release mode is the blue-green release mode, the diversion instance is the old version instance.
[0075] Therefore, in order to achieve accurate grayscale diversion, further, as an optional implementation, when the target release mode is the canary release mode and the diversion instance is a new version instance, step S1023 specifically includes:
[0076] Step A10, performing grayscale identification on the current processing request through the grayscale diversion module in the diversion instance.
[0077] Step A20, when the current processing request is identified as a grayscale request, the current processing request is processed by the diversion instance to obtain a processing result.
[0078] Step A30: When the current processing request is identified as a non-grayscale request, the current processing request is diverted to the old version instance for processing to obtain a processing result.
[0079] Specifically, when the target release mode is the canary release mode, the diversion instance is determined to be a new version instance, the current processing request is assigned to the diversion instance, and before the grayscale identification of the current processing request is performed, a loop detection can be performed on the current processing request, that is, to determine whether the current processing request is forwarded to the diversion instance by other version instances. In the case where the current processing request is forwarded to the diversion instance by other version instances, the diversion instance directly processes the current processing request and no longer performs grayscale identification on the current processing request, thereby avoiding loop forwarding of the current processing request and preventing the current processing request from falling into an infinite loop.
[0080] In the case that the current processing request is not forwarded to the diversion instance by other version instances, the grayscale diversion module in the diversion instance performs grayscale identification on the current processing request, that is, through the flow control rule, determine whether the target label of the current processing request is a grayscale label or a non-grayscale label. The flow control rule is any one of the flow ratio rule, interface field condition rule, core field rule or whitelist rule. For example, when the flow control rule is the flow ratio rule, for the current processing request, any number within the preset range is randomly used as the target number, and by comparing the ratio of the target number to 100 with the preset flow cutting ratio range, determine whether the ratio is within the preset flow cutting ratio range. If it is within the preset flow cutting ratio range, determine that the target label of the current processing request is a grayscale label; if it is not within the preset flow cutting ratio range, determine that the target label of the current processing request is a non-grayscale label.
[0081] Alternatively, when the flow control rule is an interface field condition rule, for the current processing request, it is determined whether the interface of the current processing request is a new interface. If it is determined that the interface of the current processing request is a new interface, the target label of the current processing request is determined to be a gray label; if the interface of the current processing request is not a new interface, the target label of the current processing request is determined to be a non-gray label.
[0082] Alternatively, when the flow control rule is a whitelist rule, for the current processing request, the configuration information such as user ID and request type is extracted from the current processing request, and the request information is compared with the whitelist configuration table to determine whether there is one or more configuration information corresponding to the request information in the whitelist configuration table. In the case that one or more configuration information corresponding to the request information exists in the whitelist configuration table, the target label of the current processing request is determined to be a gray label; in the case that one or more configuration information corresponding to the request information does not exist in the whitelist configuration table, the target label of the current processing request is determined to be a non-gray label. Among them, the whitelist configuration table contains preset configuration information.
[0083] After the grayscale identification of the current processing request is performed in the above manner and the target tag of the current processing request is determined, the version instance for processing the current processing request can be determined based on the target tag of the current processing request, that is, when the target tag is a grayscale tag, the current processing request is determined to be a grayscale request. At this time, the current processing request is processed by the diversion instance to obtain the processing result, and the processing result is returned to the user end. When the target tag is a non-grayscale tag, the current processing request is determined to be a non-grayscale request. At this time, the current processing request can be forwarded to the old version instance for processing through load balancing routing to obtain the processing result, and after obtaining the processing result, the processing result is transparently transmitted to the user end.
[0084] It should be noted that when the grayscale identification is performed on the current processing request, the identification is performed through any of the aforementioned methods. Therefore, when the current processing request is identified as a non-grayscale request requested by the old version instance, the interface of the current processing request may be a new interface. At this time, it is necessary to use the new version instance to process the current processing request. Therefore, the old version instance processes the current processing request and obtains the processing result. Before the processing result is transmitted to the user, it is necessary to first determine whether the interface of the current processing request is a new interface. In the case where it is determined that the interface of the current processing request is not a new interface, the processing result is directly transmitted to the user end; in the case where it is determined that the interface of the current processing request is a new interface, the current processing request is forwarded to the diversion instance for processing, and when the interface of subsequent current transaction requests is the new interface, the subsequent current transactions are processed by the diversion instance.
[0085] Correspondingly, when the target release mode is the blue-green release mode and the diversion instance is an old version instance, step S1023 specifically includes:
[0086] Step B10: grayscale identification is performed on the current processing request through the grayscale diversion module in the diversion instance.
[0087] Step B20, when the current processing request is identified as a grayscale request, the current processing request is diverted to the grayscale instance for processing to obtain a processing result; the grayscale instance is a new version instance in the same availability zone.
[0088] Step B30: When the current processing request is identified as a non-grayscale request, the current processing request is processed by the diversion instance to obtain a processing result.
[0089] Specifically, when the target release mode is the blue-green release mode, the diversion instance is determined to be an old version instance. Before the grayscale identification of the current processing request is performed, a loop detection can also be performed on the current processing request, that is, to determine whether the current processing request is forwarded to the diversion instance by other version instances. In the case where the current processing request is forwarded to the diversion instance by other version instances, the diversion instance directly processes the current processing request and no longer performs grayscale identification on the current processing request, thereby avoiding the current processing request from being forwarded in a loop and preventing the current processing request from falling into an infinite loop.
[0090] When the current processing request is not forwarded to the diversion instance by other version instances, the grayscale diversion module in the diversion instance performs grayscale identification on the current processing request, that is, through the flow control rules, it is determined whether the target label of the current processing request is a grayscale label or a non-grayscale label. The specific identification method can be referred to as shown above and will not be repeated here.
[0091] After determining the target tag of the current processing request, the version instance for processing the current processing request can be determined based on the target tag of the current processing request, that is, when the target tag is a grayscale tag, the current processing request is determined to be a grayscale request. At this time, the current processing request is diverted to the grayscale instance for processing to obtain the processing result. After obtaining the processing result, the grayscale instance returns the processing result to the diversion instance. After receiving the processing result, the diversion instance transmits the processing result to the user end. When the target tag is a non-grayscale tag, the current processing request is determined to be a non-grayscale request. At this time, the diversion instance processes the current processing request to obtain the processing result, and transmits the processing result to the user end.
[0092] In this embodiment, before the grayscale identification of the current processing request is performed by the grayscale diversion module in the diversion instance, it is first determined whether the diversion instance is a new version instance or an old version instance according to the target release mode, so that the current processing request can be accurately diverted under different release modes. At the same time, when performing grayscale verification, the current processing request is used to perform grayscale verification on a grayscale instance, that is, only the request of one instance is controlled to perform refined grayscale flow control and grayscale verification, so as to perform accurate grayscale verification within a smaller impact range, reduce the production impact caused by the verification of new functions, and avoid the risk of large-scale failures of application servers.
[0093] It should be noted that, after grayscale splitting is performed, in order to facilitate observation and early warning of the operation of the grayscale instance, further, as an optional implementation, after step S10, the following is further included:
[0094] Step S11, storing the processing result in the asynchronous queue of the offload instance.
[0095] Step S12, controlling any thread bucket among the multiple thread buckets to consume the processing results in the asynchronous queue, obtaining grayscale processing index data, and storing the grayscale processing index data in the current time block of the thread bucket.
[0096] Each thread bucket has a time ring, which includes a plurality of time blocks connected end to end in sequence, and the time ring rotates with time, and the time block corresponding to the current moment among the plurality of time blocks is the current time block.
[0097] Step S13, when it is monitored that the current time block of all thread buckets changes, the grayscale processing index data in the previous time block of the current time block in all thread buckets is extracted and aggregated to obtain aggregated index data.
[0098] Step S14, sending the aggregated indicator data to the grayscale monitoring center in the application server, so that the grayscale monitoring center analyzes the aggregated indicator data to obtain the success rate of the new version instance processing data requests.
[0099] In this embodiment, the processing result includes grayscale processing indicator data such as request status and time consumption of the grayscale instance processing the current request. The request status can be that the grayscale instance successfully processes the current processing request, or the grayscale instance fails to process the current processing request.
[0100] Specifically, refer to Figure 4 As shown, Figure 4 The figure is a schematic diagram of the processing flow of grayscale index processing data. Each thread bucket has multiple time rings, and the time ring includes multiple time blocks connected end to end in sequence, such as time block 1, time block 2, ..., time block 8. Among them, Figure 4 The eight time blocks shown in the figure are only a specific example. In actual applications, the user can adjust the number of thread buckets, the time ring size, and the number of time blocks at will, and this embodiment does not limit this.
[0101] After the offload instance processes the current processing request and obtains the processing results, namely, task result 1 and task result 2, the processing results can be stored in the asynchronous queue of the offload instance. After the processing results are stored in the asynchronous queue, any thread bucket among the multiple thread buckets can be controlled to consume the processing results in the asynchronous queue, that is, any thread bucket among thread bucket 1, thread bucket 2, ..., thread bucket N can be controlled to consume the processing results stored in the asynchronous message queue. After consuming the processing results, the thread bucket can obtain the grayscale processing data index from the processing results and store the grayscale processing index data in the current time block of the thread bucket.
[0102] Since the time ring in the thread bucket rotates with time, when the current time block of all thread buckets is monitored to change, the grayscale processing data in the previous time block of the current time block in all thread buckets can be extracted. For example, when the current interval block of all thread buckets is monitored to change to time block 5, the grayscale processing data in time block 4 of all thread buckets is extracted. After extracting the grayscale processing index data in the previous time block of the current time block in all thread buckets, all the extracted grayscale index processing data are aggregated to obtain aggregated index data, and the aggregated index data is sent to the grayscale monitoring center of the application server. After receiving the aggregated index data, the grayscale center can analyze the aggregated index data to obtain the success rate of the grayscale instance processing request, and can output warning information when the success rate is lower than the preset threshold, so that problems can be discovered and solved in time during the operation of small grayscale traffic, realizing the transition from manual discovery by users to automatic discovery of problems by application servers.
[0103] In this embodiment, the grayscale processing index data is stored in the time ring. Since the time ring rotates with time, when the current time block changes, the new grayscale processing index data will be overwritten and written into the corresponding time block. The memory consumption of processing the grayscale processing index data can be controlled below 1MB by reusing the bounded time ring. In addition, by using the time ring algorithm, the grayscale processing data can be screened, aggregated, and other processes can be performed, and variable domains such as thread buckets, time rings, and screened time blocks can be extracted to construct a low-power, high-performance, and flexibly adjustable grayscale processing index data processing mode. At the same time, users can adjust the number of thread buckets, the size of the time ring, and the time block at will according to different usage scenarios. The processing performance can be improved by increasing the number of thread buckets, and the memory consumption can be reduced by reducing the size of the time ring; the granularity of the indicator can be adjusted by screening the time ring time block.
[0104] In this embodiment, compared with the related art, in which grayscale traffic is controlled by a gateway, this application fully utilizes application resources and relieves the complex routing pressure of the public gateway layer by separating fine-grained control from the gateway and sinking it to applications that require complex diversion rules. That is, by performing grayscale diversion at the application server level, the distribution of traffic can be flexibly controlled according to actual business needs and system load. The application server can dynamically decide whether to forward the current processing request to the new version instance or keep it on the old version instance based on the characteristics of the current processing request, the user's attributes or other business logic, making the traffic control more accurate and effective, thereby enabling more fine-grained control of grayscale traffic.
[0105] To facilitate a better understanding of this embodiment, a specific example is provided below.
[0106] Reference Figure 5 to Figure 6 As shown, Figure 5 This is a schematic diagram of the application server architecture. Figure 6 A schematic diagram of the offloading instance performing offloading operations on the current processing request. Figure 5 In the application server, there are user layer, service center and data layer. In the user layer, the application server includes the grayscale diversion module, which includes instance anchoring component, flow control rule acquisition component, diversion component and indicator collection and reporting component. The aforementioned components can be used to perform instance anchoring (i.e., determine the new version instance participating in the grayscale test from the same sub-database and the same availability zone), rule synchronization (i.e., read the new flow control rules from the service center and synchronize the new flow control rules to the diversion instance), precise flow control (i.e., achieve more refined control of grayscale traffic), monitoring indicator collection and sending (i.e., aggregate the grayscale processing indicator data and send the aggregated indicator data to the grayscale monitoring center) and other operations. In the service center, users can perform operations such as policy configuration, project release, monitoring display, and permission management, and control grayscale traffic through operations such as instance selection, rule confirmation, and rule issuance. Grayscale traffic can be observed through operations such as indicator aggregation, baseline comparison, and notification alarms, and the aforementioned indicator data can be uploaded to the MySQL database or ES database of the data layer for storage.
[0107] exist Figure 6 In the example, the interceptor in the application server can intercept the current processing request distributed by the gateway when grayscale diversion is required. If grayscale diversion is not required, the interceptor will not intercept the current processing request distributed by the gateway. After intercepting the current processing request, it is determined that the target available partition for the current processing request can be determined, the current processing request is forwarded to the diversion instance in the target available zone, and the specified protocol of the diversion instance is parsed to determine the target release mode of the diversion instance, that is, to determine whether the target release mode is the canary release mode or the blue-green release mode. When the target release mode is the canary release mode, the flow control component is the new-to-old flow control component, that is, when the target release mode is the canary release mode, the diversion instance is the new version instance. When the target release mode is the blue-green release mode, the corresponding flow control component is the old-to-new flow control component, that is, when the target release mode is the blue-green release mode, the diversion instance is the old version instance.
[0108] When the target release mode is the canary release mode, the diversion instance is determined to be a new version instance. Before the grayscale identification of the current processing request is performed, a loop detection can be performed on the current processing request, that is, to determine whether the current processing request is forwarded to the diversion instance by other version instances. If the current processing request is forwarded to the diversion instance by other version instances, the diversion instance directly processes the current processing request and no longer performs grayscale identification on the current processing request, thereby avoiding loop forwarding of the current processing request and preventing the current processing request from falling into an infinite loop.
[0109] If the current processing request is not forwarded to the diversion instance by other version instances, the grayscale diversion module in the diversion instance will perform grayscale identification on the current processing request, that is, determine whether the target label of the current processing request is a grayscale label or a non-grayscale label through the flow control rules. For example, by extracting core fields such as user ID and request accumulation from the current transaction request, the target label of the current processing request is determined through the core fields and flow control rules.
[0110] After the grayscale identification of the current processing request is performed in the above manner and the target tag of the current processing request is determined, the version instance that processes the current processing request can be determined according to the target tag of the current processing request, that is, when the target tag is a grayscale tag, the current processing request is determined to be a grayscale request. At this time, the current processing request is processed by the diversion instance, that is, when the grayscale rule transaction is hit, the transaction process of this instance is obtained, and the processing result is returned to the user end. When the target tag is a non-grayscale tag, the current processing request is determined to be a non-grayscale request. At this time, the current processing request can be forwarded to the old version instance for processing through load balancing routing, that is, when the grayscale rule transaction is not hit, the old version instance cluster processes the current processing request to obtain the processing result, and after obtaining the processing result, the processing result is transparently transmitted to the user end.
[0111] It should be noted that when the grayscale identification is performed on the current processing request, the identification is performed through any of the aforementioned methods. Therefore, when the current processing request is identified as a non-grayscale request requested by the old version instance, the interface of the current processing request may be a new interface. At this time, it is necessary to use the new version instance to process the current processing request. Therefore, the old version instance processes the current processing request and obtains the processing result. Before the processing result is transmitted to the user, it is necessary to first determine whether the interface of the current processing request is a new interface. In the case where it is determined that the interface of the current processing request is not a new interface, the processing result is directly transmitted to the user end; in the case where it is determined that the interface of the current processing request is a new interface, the current processing request is forwarded to the diversion instance for processing, and when the interface of subsequent current transaction requests is the new interface, the subsequent current transactions are processed by the diversion instance.
[0112] When the target release mode is the blue-green release mode, the diversion instance is determined to be an old version instance. Before the grayscale identification of the current processing request, the current processing request can also be loop detected, that is, to determine whether the current processing request is forwarded to the diversion instance by other version instances. In the case that the current processing request is forwarded to the diversion instance by other version instances, the diversion instance directly processes the current processing request and no longer performs grayscale identification on the current processing request, thereby avoiding loop forwarding of the current processing request and preventing the current processing request from falling into an infinite loop.
[0113] When the current processing request is not forwarded to the diversion instance by other version instances, the grayscale diversion module in the diversion instance performs grayscale identification on the current processing request, that is, through the flow control rules, it is determined whether the target label of the current processing request is a grayscale label or a non-grayscale label. The specific identification method can be referred to as shown above and will not be repeated here.
[0114] After determining the target tag of the current processing request, the version instance for processing the current processing request can be determined according to the target tag of the current processing request, that is, when the target tag is a grayscale tag, the current processing request is determined to be a grayscale request. At this time, the current processing request is diverted to the grayscale instance for processing, that is, in the case of hitting the grayscale rule transaction, it is the grayscale instance transaction process to obtain the processing result. After obtaining the processing result, the grayscale instance returns the processing result to the diversion instance. After receiving the processing result, the diversion instance transmits the processing result to the user end. When the target tag is a non-grayscale tag, the current processing request is determined to be a non-grayscale request. At this time, the current processing request is processed by the diversion instance, that is, in the case of not hitting the grayscale rule transaction, it is the transaction process of this instance. The processing result is obtained and the processing result is transparently transmitted to the user end.
[0115] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the grayscale splitting method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0116] This application also provides a grayscale splitting device, please refer to Figure 7 , the grayscale splitting device comprises:
[0117] The processing module is used to perform grayscale diversion on the current processing request through the grayscale diversion module of the application server when the request interceptor of the application server intercepts the current processing request distributed by the gateway.
[0118] The grayscale shunting device provided by the present application adopts the grayscale shunting method in the above embodiment, which can solve the technical problem of rough grayscale flow control. Compared with the prior art, the beneficial effects of the grayscale shunting device provided by the present application are the same as the beneficial effects of the grayscale shunting method provided by the above embodiment, and other technical features in the grayscale shunting device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0119] The present application provides an application server, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the grayscale splitting method in the above-mentioned embodiment 1.
[0120] Reference below Figure 8 , which shows a structural diagram of an application server suitable for implementing an embodiment of the present application. Figure 8 The application server shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0121] like Figure 8 As shown, the application server may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the application server are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the application server to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an application server with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0122] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0123] The application server provided by the present application adopts the grayscale shunting method in the above embodiment, which can solve the technical problem of rough grayscale flow control. Compared with the prior art, the beneficial effects of the application server provided by the present application are the same as the beneficial effects of the grayscale shunting method provided by the above embodiment, and other technical features in the application server are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0124] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0125] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0126] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the grayscale splitting method in the above-mentioned embodiment.
[0127] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0128] The computer-readable storage medium may be included in the application server; or may exist independently without being installed in the application server.
[0129] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the application server, the application server: when the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request.
[0130] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0133] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned grayscale flow splitting method, and can solve the technical problem that the grayscale flow control is relatively rough. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the grayscale flow splitting method provided by the above-mentioned embodiment, and will not be repeated here.
[0134] The present application also provides a computer program product, including a computer program, which implements the steps of the grayscale splitting method as described above when executed by a processor.
[0135] The computer program product provided by the present application can solve the technical problem of relatively rough grayscale flow control. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the grayscale flow splitting method provided by the above embodiment, which will not be repeated here.
[0136] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A grayscale splitting method, characterized in that: Applicable to the application server, the grayscale diversion method includes: In the case where the request interceptor of the application server intercepts the current processing request distributed by the gateway, the grayscale diversion module of the application server performs grayscale diversion on the current processing request.
2. The grayscale splitting method according to claim 1, characterized in that: In the case where the request interceptor of the application server intercepts the current processing request distributed by the gateway, grayscale diversion of the current processing request by the grayscale diversion module of the application server includes: When the request interceptor of the application server intercepts the current processing request distributed by the gateway, forwarding the current processing request to the diversion instance; Grayscale diversion is performed on the current processing request through the grayscale diversion module in the diversion instance.
3. The grayscale splitting method according to claim 2, characterized in that: The grayscale diversion module in the diversion instance performs grayscale diversion on the current processing request, including: Determine a target availability zone corresponding to the current processing request; Forwarding the current processing request to the offload instance in the target availability zone; Grayscale diversion is performed on the current processing request through the grayscale diversion module in the diversion instance.
4. The grayscale splitting method according to claim 3, characterized in that: When the target release mode is the canary release mode, the offload instance is a new version instance; The step of performing grayscale diversion on the current processing request by the grayscale diversion module in the diversion instance comprises: Performing grayscale identification on the current processing request by the grayscale shunting module in the shunting instance; In the case where the current processing request is identified as a grayscale request, the current processing request is processed by the offload instance to obtain a processing result; When the current processing request is identified as a non-grayscale request, the current processing request is diverted to an old version instance for processing to obtain a processing result.
5. The grayscale splitting method according to claim 3, characterized in that: When the target release mode is a blue-green release mode, the diversion instance is an old version instance; The step of performing grayscale diversion on the current processing request by the grayscale diversion module in the diversion instance comprises: Performing grayscale identification on the current processing request by the grayscale shunting module in the shunting instance; In the case where the current processing request is identified as a grayscale request, the current processing request is diverted to a grayscale instance for processing to obtain a processing result; the grayscale instance is a new version instance in the same availability zone; In the case where the current processing request is identified as a non-grayscale request, the current processing request is processed by the diversion instance to obtain a processing result.
6. The grayscale splitting method according to claim 4 or 5, characterized in that: After the step of grayscale diversion of the current processing request by the grayscale diversion module of the application server when the request interceptor of the application server intercepts the current processing request distributed by the gateway, the method further includes: Storing the processing result in the asynchronous queue of the diversion instance; Control any thread bucket among the multiple thread buckets to consume the processing results in the asynchronous queue, obtain grayscale processing index data, and store the grayscale processing index data in the current time block of the thread bucket; each thread bucket has a time ring, the time ring includes multiple time blocks connected end to end in sequence, and the time ring rotates with time, and the time block corresponding to the current time among the multiple time blocks is the current time block; When it is detected that the current time block of all the thread buckets changes, the grayscale processing index data in the previous time block of the current time block in all the thread buckets are extracted and aggregated to obtain aggregated index data; The aggregated target processing results are sent to the grayscale monitoring center in the application server, so that the grayscale monitoring center analyzes the aggregated indicator data to obtain the success rate of the new version instance processing data request.
7. A grayscale splitting device, characterized in that: Applicable to an application server, the grayscale splitting device comprises: The processing module is used to perform grayscale diversion on the current processing request through the grayscale diversion module of the application server when the request interceptor of the application server intercepts the current processing request distributed by the gateway.
8. An application server, characterized in that: The application server comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the grayscale splitting method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the grayscale splitting method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the grayscale splitting method according to any one of claims 1 to 6 are implemented.