Grayscale release method, device, equipment and storage medium for static resources
The CDN stores static resources of different grayscale versions and generates grayscale routing rules based on user requests, which solves the problem that static resource grayscale release cannot be diverted, realizes version diversion to different users, and improves controllability and stability.
Patent Information
- Application Number
- CN202210295475.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-03-24
AI Technical Summary
The grayscale release method of existing static resources cannot be diversion, resulting in low controllability.
The CDN stores static resources of different grayscale versions, and dynamically generates grayscale routing rules based on the grayscale parameters in the user's request, and determines the target resource loading environment in combination with the grayscale version release strategy to realize version diversion to different users.
Improve the controllability of static resource grayscale release and ensure the stability and reliability of the grayscale release process.
Smart Images

Figure CN114666343B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of R&D management, and in particular to a method, device, equipment and storage medium for grayscale release of static resources. Background Art
[0002] Grayscale releases are a method of release that allows for a smooth transition between black and white. A / B testing can be conducted, where some users continue to use feature A while others begin using feature B. If users have no objections to feature B, the rollout can be gradually expanded to include all users. Grayscale releases ensure overall system stability, allowing issues to be identified and addressed during the initial grayscale phase to minimize their impact.
[0003] Existing grayscale publishing methods for static resources are mostly controlled through the Nginx server, using weighted polling percentages to control access traffic, but they cannot be combined with business to divert traffic, resulting in low controllability. Summary of the Invention
[0004] The main purpose of the present invention is to solve the problem that the existing grayscale release method of static resources cannot be diverted, resulting in low controllability.
[0005] A first aspect of the present invention provides a method for grayscale publishing of static resources, comprising:
[0006] Cache multiple preset grayscale versions of static resources in target content delivery network (CDN) source nodes according to different cache addresses. The cached grayscale versions of static resources are distributed by the CDN source nodes to CDN child nodes in various locations.
[0007] Receiving a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching the grayscale version;
[0008] intercepting and proxying the grayscale parameters based on a preset grayscale proxy object to update the locally stored grayscale routing rules, wherein the grayscale routing rules include a routing address of the request information pointing to the grayscale version instance;
[0009] Based on a preset grayscale version release strategy, determine a target resource loading environment corresponding to the grayscale parameters;
[0010] Determine the target CDN subnode corresponding to the data access request, and according to the routing address, obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
[0011] Optionally, in a first implementation of the first aspect of the present invention, before caching the preset multiple grayscale versions of the static resource into the target CDN source node according to different cache addresses, the method includes: receiving and responding to a compilation request sent by the terminal;
[0012] Initialize the resource compilation environment, wherein the initialized resource compilation environment includes the software development kit and grayscale version information;
[0013] The software development kit is called, and static resources for each grayscale version are generated based on the grayscale version information, wherein the static resources for each grayscale version include a traffic entry file and the currently released version content. Optionally, in a second implementation of the first aspect of the present invention, the grayscale parameters include cookie information of the browser in the terminal, and the grayscale proxy object based on the preset proxy intercepts and proxies the grayscale parameters to update the locally stored grayscale routing rules, including:
[0014] Get the locally stored grayscale routing rules containing multiple template variables;
[0015] The preset grayscale proxy object proxy is called, and according to the preset template engine rules, the template variables in the grayscale routing rules are replaced with the cookie information to update the grayscale routing rules.
[0016] Optionally, in a third implementation of the first aspect of the present invention, after the data access request sent by the receiving terminal and before the preset grayscale proxy object intercepts and proxies the grayscale parameters to update the locally stored grayscale routing rules, the method further includes:
[0017] According to the preset grayscale version release strategy, determining whether the grayscale parameter is within the grayscale operation range;
[0018] If the grayscale parameter is not within the grayscale operation range, the data access request is forwarded to a preset standard environment to obtain static resources that do not include grayscale content.
[0019] Optionally, in a fourth implementation manner of the first aspect of the present invention, the grayscale parameters include user characteristics, and judging whether the grayscale parameters are within the grayscale operation range according to the preset grayscale version release policy includes:
[0020] Determining a first probability value that the current user is a grayscale user based on the user characteristics in the grayscale parameters;
[0021] If the first probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0022] Optionally, in a fifth implementation manner of the first aspect of the present invention, after determining that the grayscale parameter is not within the grayscale operating range if the first probability value is less than a preset threshold, the method further includes:
[0023] If the first probability value is greater than or equal to the preset threshold, determining a second probability value that the data access request is a grayscale request based on the first probability value and a preset grayscale traffic ratio;
[0024] If the second probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0025] Optionally, in a sixth implementation of the first aspect of the present invention, determining the first probability value that the current user is a grayscale user based on the user characteristics in the grayscale parameter includes:
[0026] Obtain preset portrait data for identifying grayscale users;
[0027] Based on a similarity algorithm, the similarity between the user features in the grayscale parameters and the portrait data of the grayscale user is calculated, and the similarity is determined as a first probability value that the current user is a grayscale user.
[0028] A second aspect of the present invention provides a device for grayscale publishing of static resources, comprising:
[0029] A resource caching module is used to cache multiple preset grayscale versions of static resources in a target content delivery network (CDN) source node according to different cache addresses, wherein the cached grayscale versions of static resources are distributed by the CDN source node to CDN sub-nodes in various locations;
[0030] a request receiving module, configured to receive a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching the grayscale version;
[0031] A routing update module, configured to intercept and proxy the grayscale parameters based on a preset grayscale proxy object to update the locally stored grayscale routing rules, wherein the grayscale routing rules include a routing address for request information pointing to the grayscale version instance;
[0032] An environment determination module, configured to determine a target resource loading environment corresponding to the grayscale parameters based on a preset grayscale version release strategy;
[0033] A resource return module is used to determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
[0034] Optionally, in a first implementation manner of the second aspect of the present invention, the apparatus further includes a resource compilation module, and the resource compilation module is configured to:
[0035] a receiving unit, configured to receive and respond to a compilation request sent by the terminal;
[0036] An initialization unit, configured to initialize a resource compilation environment, wherein the initialized resource compilation environment includes a software development kit and grayscale version information;
[0037] A generation unit is used to call the software development kit and generate static resources for each grayscale version based on the grayscale version information, wherein the static resources for each grayscale version include a traffic entry file and the currently released version content.
[0038] Optionally, in a second implementation of the second aspect of the present invention, the routing update module specifically includes:
[0039] A rule acquisition unit, used to obtain the locally stored grayscale routing rules containing multiple template variables;
[0040] The rule updating unit is used to call the preset grayscale proxy object proxy, follow the preset template engine rules, and use the cookie information to replace the template variables in the grayscale routing rules to update the grayscale routing rules.
[0041] Optionally, in a third implementation of the second aspect of the present invention, the apparatus further includes a grayscale parameter determination module, and the grayscale parameter determination module specifically includes:
[0042] a judging unit, configured to judge whether the grayscale parameter is within a grayscale operating range according to the preset grayscale version release strategy;
[0043] A forwarding unit is configured to forward the data access request to a preset standard environment to obtain static resources that do not include grayscale content if the grayscale parameter is not within the grayscale operation range.
[0044] Optionally, in a fourth implementation manner of the second aspect of the present invention, the grayscale parameter includes a user feature, and the judgment unit is configured to:
[0045] Determining a first probability value that the current user is a grayscale user based on the user characteristics in the grayscale parameters;
[0046] If the first probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0047] Optionally, in a fifth implementation manner of the second aspect of the present invention, the grayscale parameter includes a user feature, and the judgment unit is configured to:
[0048] Determining a first probability value that the current user is a grayscale user based on the user characteristics in the grayscale parameters;
[0049] If the first probability value is less than a preset threshold, determining that the grayscale parameter is not within the grayscale operating range;
[0050] If the first probability value is greater than or equal to the preset threshold, determining a second probability value that the data access request is a grayscale request based on the first probability value and a preset grayscale traffic ratio;
[0051] If the second probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0052] Optionally, in a sixth implementation of the second aspect of the present invention, the judgment unit is configured to:
[0053] Obtain preset portrait data for identifying grayscale users;
[0054] Based on a similarity algorithm, the similarity between the user features in the grayscale parameters and the portrait data of the grayscale user is calculated, and the similarity is determined as a first probability value that the current user is a grayscale user.
[0055] If the first probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0056] The third aspect of the present invention provides a grayscale release device for static resources, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the grayscale release device for static resources executes the above-mentioned grayscale release method for static resources.
[0057] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, enable the computer to execute the aforementioned method for grayscale publishing of static resources.
[0058] In the technical solution provided by the present invention, different grayscale version resources are stored through CDN, and then grayscale routing rules are dynamically generated according to the grayscale parameters carried in the user request. The target resource loading environment of the grayscale version corresponding to the grayscale parameter is determined according to the grayscale version release strategy. Finally, according to the target resource loading environment and the grayscale routing rules, the corresponding target grayscale version resource is obtained and sent to the user's terminal, thereby realizing version diversion for different users and improving controllability. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 This is a schematic diagram of a first embodiment of a method for grayscale publishing of static resources in an embodiment of the present invention;
[0060] Figure 2 Schematic diagram of a second embodiment of a method for grayscale publishing of static resources in an embodiment of the present invention;
[0061] Figure 3 This is a schematic diagram of an embodiment of a device for grayscale publishing of static resources in an embodiment of the present invention;
[0062] Figure 4 Schematic diagram of another embodiment of a device for grayscale publishing of static resources in an embodiment of the present invention;
[0063] Figure 5 The figure is a schematic diagram of an embodiment of a device for grayscale publishing of static resources in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The embodiments of the present invention provide a method, apparatus, device and storage medium for grayscale release of static resources, which have higher controllability.
[0065] The terms "first," "second," "third," "fourth," and the like (if any) in the description and claims of the present invention and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0066] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 An embodiment of a method for grayscale publishing of static resources in an embodiment of the present invention includes:
[0067] 101. Cache multiple preset grayscale versions of static resources in target content delivery network (CDN) source nodes according to different cache addresses. The cached grayscale versions of static resources are distributed by the CDN source node to CDN child nodes in various locations.
[0068] It is understandable that static resources include traffic entry files and the resource content they depend on. For example, the traffic entry file in a static page is a Hypertext Markup Language file (i.e., an HTML file), which depends on various data resources, such as images, cascading styles, JavaScript scripts, etc. When the traffic entry file is opened, these dependent data resources will be loaded into the corresponding location in the traffic entry file, thereby rendering the page on the front end to present it to the user. For the original version of static resources, each version update can be recorded as a grayscale version, that is, the grayscale version is a data version between the original version and the online version that is open to some users for testing.
[0069] It is understandable that the server caches the static resources of each grayscale version to the CDN source node. Preferably, the server is an Nginx server, which is a high-performance HTTP and reverse proxy web server for load balancing and resource scheduling.
[0070] Content Delivery Network (CDN) can be used to accelerate access to data resources. The server caches each grayscale version of static resources in the CDN source node, and relies on edge nodes deployed in various places to load balance and distribute content for each grayscale version of static resources through the source CDN sub-node, so that users can obtain the required content nearby, reduce network congestion, and improve user access response speed and hit rate.
[0071] Optionally, before step 101, the server may also receive and respond to a compilation request sent by the terminal, and then start initializing the resource compilation environment, wherein the initialized resource compilation environment includes a software development kit and grayscale version information, and finally call the software development kit and generate static resources for each grayscale version based on the grayscale version information, wherein the static resources for each grayscale version include a traffic entry file and the currently released version content.
[0072] 102. Receive a data access request sent by a terminal, where the data access request carries a grayscale parameter for matching a grayscale version;
[0073] It can be understood that the data access request is sent to the server by the user executing instructions in the terminal or clicking a submit button, etc., wherein the request carries grayscale parameters for identifying information such as the user, browser, and operating system, and the grayscale parameters are used to match the corresponding grayscale version, that is, there is a many-to-one quantitative relationship between the grayscale parameters and the grayscale version.
[0074] Optionally, the grayscale parameters may be determined by a grayscale pre-operation pre-set by the user, wherein the grayscale pre-operation may be an operation for obtaining user information, an operation for obtaining browser information, an operation for obtaining operating system information, etc. The corresponding grayscale parameters may be the user information, browser information, and operating system information corresponding to the current terminal.
[0075] 103. Based on the preset grayscale proxy object proxy, intercept and proxy grayscale parameters to update the locally stored grayscale routing rules, wherein the grayscale routing rules include the routing address of the request information pointing to the grayscale version instance;
[0076] It is understandable that in this embodiment, the grayscale parameter can be cookie information stored in the browser. The server first obtains the grayscale routing rules containing multiple template variables stored locally, and then calls the preset grayscale proxy object proxy. According to the preset template engine rules, the template variables in the grayscale routing rules are replaced with cookie information to update the grayscale routing rules. For example, the locally stored grayscale routing rules contain the template variable {{% user-age%}}. When the cookie information user-age is obtained, the preset template rule engine specifies that the template variable {{% user-age%}} is replaced with the value of the cookie information user-age. Further, the server parses the grayscale routing rules, thereby jumping to the corresponding routing address through redirection (rewrite) and proxy forwarding (proxy_pass).
[0077] 104. Determine the target resource loading environment corresponding to the grayscale parameters according to the preset grayscale version release strategy;
[0078] It is understood that the grayscale version release strategy is used to indicate the corresponding matching relationship between grayscale parameters and grayscale versions, as well as the resource loading environment in which the grayscale version is located. For example, the corresponding relationship between user type and grayscale version, the corresponding relationship between browser type and grayscale version, the corresponding relationship between operating system type and grayscale version, or the corresponding relationship between a combination of user type, browser type, and operating system type and grayscale version;
[0079] Optionally, in one embodiment, different grayscale weight values can be set for different types of grayscale parameters in the combination, and then the sum of the grayscale weight values of the grayscale parameter combination is calculated, and then the corresponding grayscale version and its resource loading environment are determined according to the sum of the grayscale weight values.
[0080] The resource loading environment is not limited to a test environment, a production environment, a pre-release environment, etc. The server then matches the grayscale version corresponding to the grayscale parameter and its corresponding target resource loading environment according to the grayscale version release strategy.
[0081] 105. Determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among all CDN subnodes.
[0082] It is understandable that the target CDN sub-node is determined based on the geographical location of the terminal that issues the data access request, that is, the CDN sub-node closest to the terminal. The CDN sub-node is a cache server.
[0083] Specifically, a user enters a domain name in a browser to request data access. When the server receives the data request, it first calls the DNS host to perform domain name resolution on the domain name in the user's data request to obtain the corresponding CNAME. Secondly, it searches the domain name's corresponding mapping record table to obtain multiple IP addresses corresponding to the CNAME. Then, based on the terminal's geographic location, it determines the IP addresses corresponding to adjacent CDN subnodes and, from these, determines the closest target CDN subnode. Optionally, in one embodiment, the server also obtains the load of the CDN subnode. If the load of a CDN subnode reaches a dangerous threshold, even if it is the CDN subnode closest to the terminal, it will not be determined as the target CDN subnode. Instead, the CDN subnode that is next closest to the terminal and whose load is below the dangerous threshold will be used as the target CDN subnode.
[0084] Finally, the terminal forwards the data request including the routing address and target resource loading environment to the target CDN child node based on the IP address of the optimal edge cache node; when the target CDN child node receives the data request, it first queries whether the required data resources exist in its own cache space. If the required data resources exist, it returns them directly; otherwise, it sends the data request to the CDN source node to obtain the required data resources, and persistently stores the different grayscale versions of the static resources locally for subsequent use, and returns them to the terminal.
[0085] Optionally, after completing the release of the grayscale version, the server can also delete the generated grayscale version, thereby deleting all files corresponding to the grayscale version and taking the grayscale version offline.
[0086] In this embodiment, different grayscale version resources are stored through CDN, and then grayscale routing rules are dynamically generated based on the grayscale parameters carried in the user request. The target resource loading environment of the grayscale version corresponding to the grayscale parameter is determined according to the grayscale version release strategy. Finally, according to the target resource loading environment and the grayscale routing rules, the corresponding target grayscale version resource is obtained and sent to the user's terminal, thereby realizing version diversion for different users and improving controllability.
[0087] See Figure 2 A second embodiment of the method for grayscale publishing of static resources in an embodiment of the present invention includes:
[0088] 201. Cache multiple preset grayscale versions of static resources in target content delivery network (CDN) source nodes according to different cache addresses. The cached grayscale versions of static resources are distributed by the CDN source node to CDN child nodes in various locations.
[0089] 202. Receive a data access request sent by a terminal, where the data access request carries a grayscale parameter for matching a grayscale version;
[0090] Among them, steps 201-202 are similar to the execution steps of the above steps 101-102, and the details are not repeated here.
[0091] 203. According to the preset grayscale version release strategy, determine whether the grayscale parameter is within the grayscale operation range;
[0092] It is understandable that the grayscale version release policy can be flexibly set according to specific business needs. Users can specify that the value of any key in the grayscale version release policy is equal to, included in, greater than, or less than the grayscale parameter. Therefore, the server can determine whether the grayscale parameters obtained in the above steps are within the grayscale operation range specified by the grayscale version release policy, where the grayscale operation range is the range of terminals that need to perform grayscale operations as specified by the grayscale rules. If the server determines that the grayscale parameters obtained in the above steps are within the grayscale operation range, steps 205-207 are executed.
[0093] In this embodiment, the grayscale version release policy can set a grayscale operating range based on the number of grayscale versions corresponding to the current traffic entry file. For example, if the current traffic entry file only has one grayscale version, the grayscale parameter range greater than the preset parameter is set as the grayscale operating range, and the range less than the preset parameter is set as the non-grayscale operating range.
[0094] If the obtained grayscale parameters are within the grayscale operation range, the target grayscale version information corresponding to the current request can be determined based on the unique grayscale version; if there are multiple grayscale versions corresponding to the current traffic entry file, the grayscale version release strategy further divides the grayscale operation range into detailed parts and specifies the specific grayscale operation range corresponding to each grayscale version.
[0095] 204. If the grayscale parameter is not within the grayscale operation range, forward the data access request to a preset standard environment to obtain static resources that do not contain grayscale content;
[0096] It is understood that when it is determined that the obtained grayscale parameters exceed the grayscale operating range, it is determined that the data access request cannot obtain any grayscale version of the static resource, and the data access request is forwarded to the standard environment to obtain the original version of the static data, and the data access request is returned to the terminal. This embodiment does not limit the method for determining whether the obtained grayscale parameters exceed the grayscale operating range.
[0097] For example, in one embodiment, the obtained grayscale parameters include user characteristics. Based on the user characteristics, the server determines a first probability value that the current user is a grayscale user. Specifically, the first probability value may be calculated using an algorithm such as similarity, or determined by training a grayscale user recognition model, which is not limited in this embodiment. If the first probability value is less than a preset threshold, it is determined that the grayscale parameters are not within the grayscale operating range.
[0098] Optionally, if the first probability value is greater than or equal to the preset threshold, the server can also determine a second probability value that the data access request is a grayscale request based on the first probability value and the preset grayscale traffic ratio. If the second probability value is less than the preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
[0099] 205. Based on the preset grayscale proxy object proxy, intercept and proxy the grayscale parameters to update the locally stored grayscale routing rules, wherein the grayscale routing rules include the routing address of the request information pointing to the grayscale version instance;
[0100] 206. Determine a target resource loading environment corresponding to the grayscale parameters according to the preset grayscale version release strategy;
[0101] 207. Determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among all CDN subnodes.
[0102] Among them, steps 205-207 are similar to the execution steps of the above steps 101-102, and the details are not repeated here.
[0103] In this embodiment, the process of determining whether to obtain a grayscale version of a static resource is described in detail. By determining whether the obtained grayscale parameters are within the grayscale operating range, if the grayscale parameters are within the grayscale operating range, the corresponding grayscale version of the static resource is continued to be obtained. Otherwise, the request is forwarded to the standard environment to obtain the original version of the static resource, thereby improving the accuracy of resource acquisition.
[0104] The above describes the grayscale release method of static resources in the embodiment of the present invention. The following describes the grayscale release device of static resources in the embodiment of the present invention. Figure 3 An embodiment of a device for grayscale publishing of static resources in an embodiment of the present invention includes:
[0105] The resource caching module 301 is configured to cache multiple preset grayscale versions of static resources in a target content delivery network (CDN) source node according to different cache addresses. The cached grayscale versions of static resources are distributed by the CDN source node to CDN child nodes in various locations.
[0106] A request receiving module 302 is configured to receive a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching a grayscale version;
[0107] A routing update module 303 is configured to intercept and proxy the grayscale parameters based on a preset grayscale proxy object to update the locally stored grayscale routing rules, wherein the grayscale routing rules include a routing address for request information pointing to the grayscale version instance;
[0108] An environment determination module 304 is configured to determine a target resource loading environment corresponding to the grayscale parameters based on a preset grayscale version release strategy;
[0109] The resource return module 305 is used to determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
[0110] In this embodiment, different grayscale version resources are stored through CDN, and then grayscale routing rules are dynamically generated based on the grayscale parameters carried in the user request. The target resource loading environment of the grayscale version corresponding to the grayscale parameter is determined according to the grayscale version release strategy. Finally, according to the target resource loading environment and the grayscale routing rules, the corresponding target grayscale version resource is obtained and sent to the user's terminal, thereby realizing version diversion for different users and improving controllability.
[0111] See Figure 4 Another embodiment of the device for grayscale publishing of static resources in the embodiment of the present invention includes:
[0112] The resource caching module 301 is configured to cache multiple preset grayscale versions of static resources in a target content delivery network (CDN) source node according to different cache addresses. The cached grayscale versions of static resources are distributed by the CDN source node to CDN child nodes in various locations.
[0113] A request receiving module 302 is configured to receive a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching a grayscale version;
[0114] A routing update module 303 is configured to intercept and proxy the grayscale parameters based on a preset grayscale proxy object to update the locally stored grayscale routing rules, wherein the grayscale routing rules include a routing address for request information pointing to the grayscale version instance;
[0115] An environment determination module 304 is configured to determine a target resource loading environment corresponding to the grayscale parameters based on a preset grayscale version release strategy;
[0116] The resource return module 305 is used to determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
[0117] The routing update module 303 specifically includes:
[0118] A rule acquisition unit 3031 is used to acquire a locally stored grayscale routing rule containing multiple template variables;
[0119] The rule updating unit 3032 is configured to call a preset grayscale proxy object proxy, and update the grayscale routing rule by replacing the template variables in the grayscale routing rule with the cookie information according to the preset template engine rule.
[0120] In the embodiment of the present invention, the modular design allows the hardware of each part of the grayscale release device of static resources to focus on the realization of a certain function, thereby maximizing the performance of the hardware. At the same time, the modular design also reduces the coupling between the modules of the device, making maintenance more convenient.
[0121] above Figure 3 and Figure 4 The grayscale release device for static resources in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The grayscale release device for static resources in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0122] Figure 5 It is a structural diagram of a grayscale release device for static resources provided by an embodiment of the present invention. The grayscale release device 500 for static resources may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more massive storage devices) for storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the grayscale release device 500 for static resources. Furthermore, the processor 510 can be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the grayscale release device 500 for static resources.
[0123] The static resource grayscale release device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be understood by those skilled in the art that Figure 5 The illustrated structure of the device for grayscale publishing of static resources does not constitute a limitation on the device for grayscale publishing of static resources, and may include more or fewer components than illustrated, or a combination of certain components, or a different arrangement of components.
[0124] The present invention also provides a device for grayscale release of static resources, which includes a memory and a processor. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor executes the steps of the grayscale release method of static resources in the above-mentioned embodiments.
[0125] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer, the computer executes the steps of the grayscale release method of static resources.
[0126] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program code.
[0128] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for grayscale release of static resources, characterized in that: The grayscale release method of the static resource includes: Cache multiple preset grayscale versions of static resources in target content delivery network (CDN) source nodes according to different cache addresses, wherein the cached grayscale versions of static resources are distributed by the CDN source nodes to CDN sub-nodes in various locations; Receiving a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching the grayscale version; Obtain a locally stored grayscale routing rule containing multiple template variables, then call a preset grayscale proxy object proxy, follow the preset template engine rules, and use cookie information to replace the template variables in the grayscale routing rule to update the grayscale routing rule, wherein the grayscale routing rule includes a routing address for request information pointing to the grayscale version instance; Based on a preset grayscale version release strategy, determine a target resource loading environment corresponding to the grayscale parameters; Determine the target CDN subnode corresponding to the data access request, and according to the routing address, obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
2. The method for grayscale publishing of static resources according to claim 1, characterized in that: The method of caching the preset multiple grayscale versions of static resources to the target CDN source node according to different cache addresses includes: receiving and responding to a compilation request sent by the terminal; Initialize the resource compilation environment, wherein the initialized resource compilation environment includes the software development kit and grayscale version information; The software development kit is called, and static resources of each grayscale version are generated based on the grayscale version information, wherein the static resources of each grayscale version include a traffic entry file and the currently released version content.
3. The method for grayscale publishing of static resources according to claim 1, characterized in that: The grayscale parameters include cookie information of the browser in the terminal, and the grayscale proxy object based on the preset grayscale proxy intercepts and proxies the grayscale parameters to update the locally stored grayscale routing rules, including: Get the locally stored grayscale routing rules containing multiple template variables; The preset grayscale proxy object proxy is called, and according to the preset template engine rules, the template variables in the grayscale routing rules are replaced with the cookie information to update the grayscale routing rules.
4. The method for grayscale publishing of static resources according to claim 1, characterized in that: After the data access request is received from the terminal, and before the preset grayscale proxy object intercepts and proxies the grayscale parameters to update the locally stored grayscale routing rules, the method further includes: According to the preset grayscale version release strategy, determining whether the grayscale parameter is within the grayscale operation range; If the grayscale parameter is not within the grayscale operation range, the data access request is forwarded to a preset standard environment to obtain static resources that do not include grayscale content.
5. The method for grayscale publishing of static resources according to any one of claims 1 to 4, characterized in that: The grayscale parameters include user characteristics, and judging whether the grayscale parameters are within the grayscale operation range according to the preset grayscale version release strategy includes: Determining a first probability value that the current user is a grayscale user based on the user characteristics in the grayscale parameters; If the first probability value is less than a preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
6. The method for grayscale publishing of static resources according to claim 5, characterized in that: After determining that the grayscale parameter is not within the grayscale operating range if the first probability value is less than a preset threshold, the method further includes: If the first probability value is greater than or equal to the preset threshold, determining a second probability value that the data access request is a grayscale request based on the first probability value and a preset grayscale traffic ratio; If the second probability value is less than the preset threshold, it is determined that the grayscale parameter is not within the grayscale operating range.
7. The method for grayscale publishing of static resources according to claim 5, characterized in that: The determining, based on the user characteristics in the grayscale parameters, a first probability value that the current user is a grayscale user includes: Obtain preset portrait data for identifying grayscale users; Based on a similarity algorithm, the similarity between the user features in the grayscale parameters and the portrait data of the grayscale user is calculated, and the similarity is determined as a first probability value that the current user is a grayscale user.
8. A device for grayscale publishing of static resources, characterized in that: The grayscale publishing device of the static resource includes: A resource caching module is used to cache multiple preset grayscale versions of static resources in a target content delivery network (CDN) source node according to different cache addresses, wherein the cached grayscale versions of static resources are distributed by the CDN source node to CDN sub-nodes in various locations; a request receiving module, configured to receive a data access request sent by a terminal, wherein the data access request carries a grayscale parameter for matching the grayscale version; A routing update module is used to obtain a locally stored grayscale routing rule containing multiple template variables, then call a preset grayscale proxy object proxy, follow the preset template engine rules, and use cookie information to replace the template variables in the grayscale routing rule to update the grayscale routing rule, wherein the grayscale routing rule includes a routing address for request information pointing to the grayscale version instance; An environment determination module, configured to determine a target resource loading environment corresponding to the grayscale parameters based on a preset grayscale version release strategy; A resource return module is used to determine the target CDN subnode corresponding to the data access request, and obtain the target grayscale version of the static resource from the target resource loading environment in the target CDN subnode according to the routing address, and send the target grayscale version of the static resource to the terminal, wherein the target CDN subnode is the CDN subnode closest to the terminal's geographical location among the CDN subnodes.
9. A device for grayscale publishing of static resources, characterized in that: The grayscale release device for static resources includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instruction in the memory to enable the static resource grayscale release device to execute the static resource grayscale release method according to any one of claims 1 to 7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the grayscale release method of the static resources according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
WEB terminal gray release method, device and system
CN112486550A