Content refreshing method and device, electronic equipment and storage medium
By extracting the domain name and cache expiration time in the CDN refresh request, combined with the traffic node cluster, the processing of the refresh node cluster is optimized, which solves the problem of low CDN content refresh efficiency, achieves more efficient refresh task allocation and resource management, and alleviates edge problems. Nodal pressure.
Patent Information
- Application Number
- CN202410093781.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2024-10-18
AI Technical Summary
Existing CDN content refreshing solutions have the problem of low resource refreshing efficiency. Especially when high-priority users have a large number of refreshing needs, the refreshing efficiency cannot be improved, and the topological relationship between distribution network nodes cannot effectively improve the URL refreshing efficiency.
After receiving the refresh request, extract the domain name from the request, obtain the node cluster and cache expiration time of the domain name distribution, combine the traffic node cluster, determine the node cluster to be refreshed, and merge the refresh requests based on the path hierarchy tree to optimize the refresh task distribution. Reduce the amount of invalid refreshes and reduce the pressure on edge nodes.
It improves the effectiveness of content refresh tasks, reduces the amount of invalid refreshes, reduces the pressure on edge nodes, improves refresh efficiency, and adapts to the changing business environment.
Smart Images

Figure CN118803067A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a content refreshing method, device, electronic device and storage medium. Background Art
[0002] Content delivery network (CDN) content refresh is a complex and critical task. Large-scale refresh requests may put pressure on the CDN's own business and affect the normal access experience of other users.
[0003] The CDN content refresh solution provided by the prior art is: by establishing queues with different priority levels, the refresh tasks are published to the topic queues corresponding to the priority of the CDN users in the publish-subscribe message system. The refresh efficiency of users with high priority levels is higher, but when there are a large number of refresh demands from users with high priority levels, the refresh efficiency cannot be improved; or, the topological relationship between the nodes of the distribution network is utilized, but the refresh efficiency of the URL is not improved, and the refresh amount is not reduced; or, by comparing the source site content with the content to be refreshed, the refresh is completed when there is inconsistency, but since the content comparison requires the content to be pulled from the source site, the access pressure of the source site is increased.
[0004] The above CDN content refresh solution has the problem of low resource refresh efficiency. Summary of the invention
[0005] The embodiments of the present application provide a content refresh method, device, electronic device and storage medium to solve the problem of low resource refresh efficiency in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a content refreshing method, including:
[0007] After receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request;
[0008] Based on the domain name, a node cluster and a cache expiration time for domain name distribution are obtained; the cache expiration time represents an expiration time of resources stored in the cache;
[0009] Obtaining a traffic node cluster within a cache effective time; the cache effective time is determined based on the cache expiration time;
[0010] Based on the node cluster distributed by the domain name and the traffic node cluster, a node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed; the node cluster to be refreshed represents a node cluster with traffic within the cache effectiveness time.
[0011] According to a content refreshing method provided by the present application, refreshing the node cluster to be refreshed includes:
[0012] Reading at least one of the refresh requests from the pending message queue;
[0013] Decomposing the uniform resource locator URL in the refresh request to extract the resource path in the URL;
[0014] Based on the resource path, construct a path hierarchy tree;
[0015] Based on the path hierarchy tree, merging the refresh requests;
[0016] Based on the merged refresh request, the to-be-refreshed node cluster is refreshed.
[0017] According to a content refresh method provided by the present application, merging the refresh request based on the path hierarchy tree includes:
[0018] Determine the service load index score of each node to be refreshed based on the performance indicators and weights of each node to be refreshed in the node cluster to be refreshed;
[0019] Obtaining a merged path level and an upgrade threshold associated with the service load index score; the upgrade threshold represents the processing volume of the URL;
[0020] If the level of any parent node of the path hierarchy tree is greater than or equal to the merged path level, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold, all refresh requests corresponding to the parent node are merged.
[0021] According to a content refresh method provided by the present application, refreshing the to-be-refreshed node cluster based on the merged refresh request includes:
[0022] Reading at least one merged refresh request from a refresh message queue; the refresh message queue stores the merged refresh request;
[0023] A refresh request is sent to the node to be refreshed in the node to be refreshed cluster; wherein the node to be refreshed refreshes the cache content based on the received refresh request.
[0024] According to a content refresh method provided by the present application, before reading at least one refresh request from the to-be-processed message queue, the method further includes:
[0025] If the domain name is in the upgrade whitelist, the refresh request and the node cluster to be refreshed are written into the pending message queue.
[0026] According to a content refresh method provided by the present application, the node cluster distributed based on the domain name and the traffic node cluster determine the node cluster to be refreshed, including:
[0027] The intersection of the node cluster for domain name distribution and the traffic node cluster is extracted to remove nodes that are not distributed but have traffic, and obtain the node cluster to be refreshed.
[0028] According to a content refresh method provided by the present application, determining the cache validity time includes:
[0029] Determine a time difference between a current time and the cache expiration time;
[0030] The cache validity time is determined based on the time difference and the current time.
[0031] In a second aspect, an embodiment of the present application provides a content refreshing device, including:
[0032] A domain name determination module, configured to extract a domain name corresponding to a requested resource from the refresh request after receiving the refresh request;
[0033] An acquisition module, used to acquire, based on the domain name, a node cluster and a cache expiration time for domain name distribution; the cache expiration time represents an expiration time of resources stored in the cache;
[0034] A traffic node cluster determination module, used to obtain a traffic node cluster within a cache validity period; the cache validity period is determined based on the cache expiration period;
[0035] The refresh module is used to determine the node cluster to be refreshed based on the node cluster distributed by the domain name and the traffic node cluster, and refresh the node cluster to be refreshed; the node cluster to be refreshed represents the node cluster with traffic within the cache effectiveness time.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing a computer program, wherein the processor implements the steps of the content refresh method described in the first aspect when executing the program.
[0037] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the content refresh method described in the first aspect are implemented.
[0038] The content refresh method, device, electronic device and storage medium provided by the embodiments of the present application, after receiving the refresh request, extract the domain name corresponding to the requested resource from the refresh request; based on the domain name, obtain the node cluster and cache expiration time of the domain name distribution; the cache expiration time represents the expiration time of the resource stored in the cache; obtain the traffic node cluster within the cache effective time; the cache effective time is determined based on the cache expiration time; based on the node cluster and traffic node cluster distributed by the domain name, determine the node cluster to be refreshed, and refresh the node cluster to be refreshed, the node cluster to be refreshed represents the node cluster with traffic within the cache effective time. The present application combines the domain name business traffic and the refresh task, refreshes the nodes with traffic within the cache effective time range, improves the effectiveness of the refresh task, reduces the amount of invalid refreshes, and alleviates the pressure on edge nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 It is a flowchart of a content refresh method provided in an embodiment of the present application;
[0041] Figure 2 This is a schematic diagram of refreshing request splitting provided in an embodiment of the present application;
[0042] Figure 3 It is a schematic diagram of a resource refresh process provided by an embodiment of the present application;
[0043] Figure 4 It is a flowchart of a content refresh method for adaptive precise flow control provided in an embodiment of the present application;
[0044] Figure 5 is a structural diagram of a content refreshing device provided in an embodiment of the present application;
[0045] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] Figure 1 is a flow chart of a content refresh method provided in an embodiment of the present application. Figure 1 , the present application embodiment provides a content refreshing method, which may include:
[0048] Step 100, after receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request;
[0049] The execution subject of the embodiment of the present application is a resource refresh processor, which refers to a component or service used to process CDN content refresh requests. Its functions include processing refresh requests, managing refresh tasks, optimizing refresh strategies, and providing API interfaces.
[0050] In a system or network, each resource (such as files, pictures, videos, etc.) can be identified and accessed through a unique Uniform Resource Locator (URL), where the URL includes a domain name. By parsing the URL, the domain name information can be obtained. In addition, URLs can be used to accurately locate and access resources on the Internet, including web pages, pictures, videos, files, etc. Browsers and other network applications use URLs to initiate requests and obtain corresponding resources.
[0051] A domain name, also known as a network domain, is a name of a computer or computer group on the Internet consisting of a string of names separated by dots, used to locate and identify computers during data transmission. Through a domain name, users can access websites, send emails, etc.
[0052] After receiving the refresh request sent by the refresh client, the resource refresh processor parses the refresh request to parse out the resource content that needs to be deleted from the cache and extracts the domain name corresponding to the requested resource. Among them, the refresh request can be understood as a content deletion request, which carries a URL or other resource identifier to determine the specific resource that needs to be deleted / refreshed.
[0053] For example, suppose there is a refresh request:
[0054] DELETE http: / / example.com / images / logo.png;
[0055] In this refresh request, example.com in the URL is the domain name, and / images / logo.png is the specific resource path. When parsing the refresh request, the system extracts the domain name example.com and uses it as an identifier to determine the resource to be deleted.
[0056] Step 200, based on the domain name, obtain the node cluster and cache expiration time of the domain name distribution;
[0057] After extracting the domain name based on the refresh request, the domain name configuration management server is requested based on the domain name to obtain the current distribution status of the domain name, the cache expiration time (i.e., the cache expiration time) Delta, the upgrade whitelist WhiteList, the weight parameter, and the node cluster SourceMap of the domain name distribution. Among them, the cache expiration time represents the expiration time of the resources stored in the cache, i.e., the cache expiration time.
[0058] For example, first determine the interface address or API endpoint of the domain name configuration management server; then communicate with the domain name configuration management server through an HTTP request, and at the same time, build a request according to the document or API description of the domain name configuration management server, including specifying the domain name to be queried and the required information; finally send a request to the domain name configuration management server, and receive the request content returned by the domain name configuration management server, including:
[0059] Current distribution status: indicates the current distribution status of the specified domain name in the domain name configuration management server, such as whether it is enabled, whether it is running normally, etc.
[0060] Cache expiration time Delta: indicates the cache expiration time interval. When the cache expires, the CDN node will request resources from the origin server again.
[0061] Upgrade WhiteList: Specifies a whitelist of users who can access upgrade resources.
[0062] Weight parameter: A weight parameter used to control the distribution of traffic. Different nodes can be set with different weight values to adjust the load balance between nodes.
[0063] Node cluster SourceMap for domain name distribution: represents the node cluster managed by the domain name configuration management server, that is, the server set that provides resource distribution services. SourceMap records the address, status, weight and other information of each node to achieve load balancing and resource distribution.
[0064] Step 300, obtaining a traffic node cluster within the cache validity period;
[0065] The cache effective time refers to the time in CDN when a user requests a resource and CDN checks the cache status of the resource and decides whether to return the resource content from the cache. In other words, the cache effective time is the time period within the validity period of the cached resource during which CDN can directly return the resource from the cache.
[0066] The cache effective time is determined based on the cache expiration time. Specifically, the time difference between the current time and the cache expiration time is determined, and the cache effective time is determined based on the time difference and the current time. For example, assuming that the current time Now is 12 noon, the cache expiration time (cache expiration time) Delta is 1 hour, and the traffic calculation time interval is obtained: [Now-Delta, Now] = [11:00AM, 12:00PM], and then the traffic calculation time interval is determined as the cache effective time.
[0067] Get the traffic node cluster within the cache validity period. For example, suppose there is a domain name example.com and the cache validity period is [11:00AM, 12:00PM]. Query the traffic distribution of the domain name example.com within the cache validity period from the business monitoring manager. The query results are shown in Table 1:
[0068] Table 1
[0069] Time interval Number of visits 11:00AM-11:15AM 1000 11:15AM-11:30AM 1500 11:30AM-11:45AM 2000 11:45AM-12:00PM 1800
[0070] According to Table 1, the flow node cluster FlowMap can be obtained, as shown in Table 2:
[0071] Table 2
[0072]
[0073] The traffic node cluster FlowMap shows the traffic distribution of the domain name example.com in the time interval [11:00AM, 12:00PM]. It can be seen that the traffic volume varies in different time periods and on different nodes.
[0074] Step 400: Determine a node cluster to be refreshed based on the node cluster distributed by the domain name and the traffic node cluster, and refresh the node cluster to be refreshed.
[0075] It should be noted that refresh means forcing the CDN node to go back to the source and obtain the latest file. When using CDN services, in order to increase the speed of resource access and reduce the pressure on the source station, the CDN node will cache the resources so that it can respond to user requests faster the next time it is accessed. However, due to the existence of the caching mechanism, it may happen that the CDN node still returns the old version after the resource is updated. Based on this, you can use the refresh function provided by CDN to force a refresh of the CDN node's cache. Specifically, after submitting a URL or directory refresh request, the cached content of the CDN node will be forced to expire. When requesting resources from the CDN node again, the CDN will directly return to the source station to obtain the corresponding resource return and cache it, so as to ensure that the user obtains the latest version of the resource.
[0076] Based on the node clusters and traffic node clusters of domain name distribution, the node clusters to be refreshed are determined. Specifically, the intersection of the node clusters and traffic node clusters of domain name distribution is extracted to remove nodes that are not distributed and have traffic, and obtain the node clusters to be refreshed. For example, assuming that the node cluster of domain name distribution is SourceMap, the traffic node cluster is FlowMap, and the node cluster to be refreshed is TargetMap, the relationship between the three is: SourceMap∩FlowMap=TargetMap, where the purpose of taking the intersection of SourceMap and FlowMap is to remove nodes that are not distributed and have traffic, and the node cluster to be refreshed SourceMap represents the node clusters that have traffic within the cache validity period.
[0077] It is understandable that nodes that are not distributed and have traffic are not nodes that normally provide domain name services. For example, traffic is caused by hotlinking, that is, traffic caused by abnormal access such as hotlinking. Refreshing these nodes will occupy computing and network resources, and cannot change abnormal access behavior. Therefore, only the TargetMap of the node cluster to be refreshed is refreshed, that is, the nodes with traffic within the cache effective time range are refreshed.
[0078] The content refresh method provided by the embodiment of the present application is as follows: after receiving the refresh request, the domain name corresponding to the requested resource is extracted from the refresh request; based on the domain name, the node cluster and cache expiration time of the domain name distribution are obtained; the cache expiration time represents the expiration time of the resource stored in the cache; the traffic node cluster within the cache effective time is obtained; the cache effective time is determined based on the cache expiration time; based on the node cluster and traffic node cluster distributed by the domain name, the node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed. The embodiment of the present application combines the domain name business traffic and the refresh task, refreshes the nodes with traffic within the cache effective time range, improves the effectiveness of the refresh task, reduces the amount of invalid refreshes, and alleviates the pressure on edge nodes.
[0079] Based on the above embodiment, refreshing the node cluster to be refreshed includes:
[0080] Step 411, reading at least one refresh request from the pending message queue;
[0081] Step 412, disassemble the uniform resource locator URL in the refresh request to extract the resource path in the URL;
[0082] Step 413, constructing a path hierarchy tree based on the resource path;
[0083] Step 414, merging the refresh request based on the path hierarchy tree;
[0084] Step 415: Refresh the to-be-refreshed node cluster based on the merged refresh request.
[0085] After extracting the domain name to which the resource belongs from the refresh request, if the domain name does not exist in the domain name configuration management server, or the node cluster distributed by the domain name is empty, it will directly return to the end, that is, no refresh operation will be performed. If the node cluster distributed by the domain name is not empty, it will determine whether the domain name is in the upgrade whitelist; if the domain name is in the upgrade whitelist, the refresh request and the node cluster to be refreshed will be written into the pending message queue.
[0086] Read at least one refresh request from the pending message queue, disassemble the uniform resource locator URL in the refresh request to extract the resource path in the URL, and build a path hierarchy tree based on the resource path. The pending message queue stores the request information that needs to be refreshed, which contains multiple URL addresses. For each URL address, it needs to be disassembled and classified for subsequent processing. The purpose of disassembling the URL is to convert it into the form of a path hierarchy tree.
[0087] For example, batch read refresh requests from the pending message queue, disassemble the request URL, such as splitting the requests http: / / a.com / a / b / c / d / 1.txt, http: / / a.com / a / b / c / d / 2.txt, http: / / a.com / a / b / e / 3.txt into a path hierarchy tree, such as Figure 2 As shown. The path hierarchy tree can be easily searched and managed. For example, the number of URLs under a certain path hierarchy can be counted, and specific operations can be performed on a certain path hierarchy. At the same time, URLs can be classified and summarized in the form of a path hierarchy tree for better management and maintenance.
[0088] Based on the path hierarchy tree, refresh requests are merged. Specifically, based on the performance indicators and weights of each node to be refreshed in the node cluster to be refreshed, the service load index score of each node to be refreshed is determined; the merged path level and upgrade threshold associated with the service load index score are obtained; if the level of any parent node in the path hierarchy tree is greater than or equal to the merged path level, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold, all refresh requests corresponding to the parent node are merged. Among them, the performance indicators include at least:
[0089] Node CPU usage: indicates the CPU usage of the node to be refreshed, reflecting the CPU resource usage of the processes running on the node.
[0090] Memory usage percentage: indicates the percentage of the current memory usage of the node to be refreshed to the total memory.
[0091] Node network load percentage: indicates the percentage of the current network load of the node to be refreshed to the total network bandwidth.
[0092] Business traffic percentage to total business traffic: indicates the percentage of business traffic currently processed by the node to be refreshed to the total business traffic.
[0093] For example, the CPU usage, memory usage percentage, node network load percentage, and business traffic percentage of the total business volume of the node to be refreshed are obtained through monitoring services, and then a calculation model is established based on the performance indicators to evaluate the service load index score. Among them, the service load index score = node CPU usage * w1 + memory usage percentage * w2 + node network load percentage * w3 + business traffic percentage of the total business volume * w4, where w1, w2, w3 and w4 represent weights.
[0094] The upgrade threshold num and the merged path level n are further determined based on the service load index score, as shown in Table 3.
[0095] Table 3 Service load index combined parameter comparison model
[0096] Service Load Index Score Merge path level n Upgrade threshold num (80,100] 5 400 (60,80] 5 600 (40,60] 6 800 (0,40] 6 1000
[0097] The upgrade threshold represents the processing volume of the URL. After determining the upgrade threshold num and the merged path level n, when the level of a parent node in the path hierarchy tree is greater than or equal to the merged path level n, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold num, all refresh requests under the parent node are merged, for example, upgraded to the upper directory refresh request with the URL http: / / a.com / a / b / c / d / .
[0098] For example, assuming that the merge path level n is 5, the upgrade threshold num is 400, and the parent node / d is at level 5, the condition of being greater than or equal to the merge path level n is met. The number of leaf nodes of the parent node / d is further determined. If the number of leaf nodes is 500, all refresh requests under the parent node are merged; if the number of leaf nodes is 200, they are not merged.
[0099] Based on the merged refresh request, the cluster of nodes to be refreshed is refreshed. Specifically, at least one merged refresh request is read from the refresh message queue, wherein the refresh message queue stores the merged refresh request; then, a refresh request is sent to the nodes to be refreshed in the cluster of nodes to be refreshed; wherein the nodes to be refreshed refresh the cached content based on the received refresh request. For example, the cached content is refreshed through the CDN node, i.e., the cached content on the CDN server is refreshed to ensure that the user can obtain the latest resources.
[0100] Optionally, the refresh message queue also stores whether there are merged refresh requests.
[0101] The embodiment of the present application uses an adaptive load calculation algorithm for refresh resources, automatically adjusts the conditions for merging and upgrading according to indicators such as the current request flow and system performance, dynamically performs merge and upgrade operations as root directory refreshes, makes the best decision based on the current actual situation, reduces the access pressure on the edge and source stations, and improves resource refresh efficiency. Specifically, for a large number of refresh requests from the same customer, they are split into a path hierarchy tree, and the node CPU usage, memory occupancy percentage, node network load percentage, and business traffic percentage of the total business volume are used to calculate the service load index score. When the service load index score is high, the threshold for merging and upgrading is lowered to merge requests faster; conversely, when the service load index score is low, the threshold for merging and upgrading is increased to avoid excessive merging of requests, so that refresh convergence can quickly respond to and adapt to the ever-changing business environment, reduce the number of refresh requests, and improve refresh efficiency.
[0102] In order to further analyze and explain the content refreshing method provided by this application, refer to Figure 3 to Figure 4 And the following examples.
[0103] The embodiment of the present application specifically provides a content refresh method with adaptive precise traffic control. The basic principle is to use the current node traffic situation and domain name to configure the cache expiration time. When deleting resources, it is determined whether the resource is in service within the cache expiration period based on the above two information. If there is no traffic, it is returned directly without the need to perform a large number of invalid refresh operations without actual business traffic. At the same time, the resources that need to be refreshed are upgraded and merged to further reduce the refresh request volume and improve refresh efficiency.
[0104] refer to Figure 3 The terminals involved in the overall process of resource refresh include: management client, domain name configuration management server, resource refresh processor, refresh client, business monitoring and CDN node.
[0105] The overall process of resource refresh includes:
[0106] Step 1: The administrator configures the domain name whitelist and the weight of the node performance indicators through the management page in the management client. For example, configure the domain name upgrade whitelist, adaptive calculation weight parameter node CPU usage weight w1, memory usage weight w2, node network load percentage weight w3, and business traffic percentage weight w4. For example, add the domain name a.com, w1 is 20, w2 is 20, w3 is 30, w4 is 30, w1+w2+w3+w4=100.
[0107] Step 2: The client refreshes through the refresh client, and the refresh client sends a refresh request to the resource refresh processor.
[0108] Step 3: After receiving the refresh request, the resource refresh processor obtains the domain name configuration information from the domain name configuration management server and obtains the monitoring data from the business monitoring;
[0109] Step 4: The resource refresh processor processes the refresh request based on the domain name configuration information and monitoring data, and sends the refresh request to the CDN node after processing;
[0110] Step 5: The CDN node refreshes resources. For example, after receiving a refresh request, the CDN node will update the cache of the corresponding file, directory, or URL address according to the request. Based on this, the cache on the CDN node will be refreshed and provide the latest resources to the user.
[0111] Further, refer to Figure 4 ,The content refreshing method for adaptive precise flow control includes the following steps:
[0112] Step 1: The resource refresh processor receives a content refresh request sent by the refresh client, which can also be understood as a content deletion request.
[0113] Step 2: Parse the content refresh request, obtain the domain name Domain corresponding to the resource, request the domain name configuration management server based on the domain name, obtain the current distribution status, cache expiration time Delta, upgrade whitelist WhiteList, weight parameters, and domain name distribution node cluster SourceMap.
[0114] Step 3: If the domain name does not exist, or the node cluster for domain name distribution is empty, the process returns to the end directly; if the node cluster for domain name distribution is not empty, proceed to step 4.
[0115] Step 4: Based on the domain name Domain and cache expiration time Delta obtained in the second step, and the current time Now, obtain the traffic calculation time interval [Now-Delta, Now], query the business monitoring manager for the traffic distribution of the domain name Domain within the calculated time interval, and obtain the traffic node cluster FlowMap.
[0116] Step 5: According to the traffic node distribution and distribution node situation, take the intersection to remove the nodes that are not currently distributed but have traffic, and obtain the actual node cluster to be refreshed after screening TargetMap, SourceMap∩FlowMap=TargetMap.
[0117] Step 6: If the TargetMap of the node cluster to be refreshed is empty, return directly to the end; if TargetMap is not empty, proceed to step 7.
[0118] Step 7: Determine whether the domain name is in the upgrade whitelist WhiteList. If not, proceed to step 11; if so, proceed to step 8.
[0119] Step 8: Write the refresh request and TargetMap information into the pending message queue.
[0120] Step 9: Batch read refresh information from the pending message queue, disassemble the request URL, for example, request http: / / a.com / a / b / c / d / 1.txt, http: / / a.com / a / b / c / d / 2.txt, http: / / a.com / a / b / e / 3.txt, split into a path hierarchy tree, such as Figure 2 shown.
[0121] Step 10: Obtain the CPU usage, memory usage percentage, node network load percentage, and business traffic percentage of the total business volume of the node to be refreshed through the monitoring service, and establish a calculation model. The service load index score = node CPU usage * w1 + memory usage percentage * w2 + node network load percentage * w3 + business traffic percentage of the total business volume * w4.
[0122] After calculating the service load index score, the upgrade threshold num and merge path level n associated with the service load index score are obtained according to the parameter control model. When the level of a parent node is greater than or equal to the merge path level n, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold num, all refresh requests under the parent node are merged, such as upgrading to an upper directory refresh request with the url http: / / a.com / a / b / c / d / . Otherwise, the refresh merge upgrade action is not performed and it remains the original request, and the eleventh step is performed.
[0123] Step 11: Put the refresh request into the final refresh message queue.
[0124] Step 12: Batch read the refresh information from the final refresh message queue, and send a refresh request to the nodes in the TargetMap of the node cluster to be refreshed.
[0125] Step 13: The edge performs a refresh operation and returns the operation result.
[0126] When requesting resource acquisition, the embodiment of the present application combines domain name service traffic and refresh tasks, and performs refresh processing on nodes with traffic within the cache effective time range, thereby improving the effectiveness of refresh tasks, reducing the amount of invalid refreshes, and alleviating the pressure on edge nodes. On the other hand, the refresh convergence degree is high. For a large number of refresh requests from the same customer, they are split into a path hierarchy tree, and the node CPU usage, memory occupancy percentage, node network load percentage, and service traffic percentage of the total service volume are used to calculate the service load index score. When the service load index score is high, the merge upgrade threshold is lowered to merge requests faster; conversely, when the service load index score is low, the merge upgrade threshold is increased to avoid excessive merge requests, so that refresh convergence can quickly respond to and adapt to the ever-changing business environment, reduce the amount of refresh requests, and improve refresh efficiency.
[0127] The content refreshing device provided in the embodiment of the present application is described below. The content refreshing device described below and the content refreshing method described above can refer to each other.
[0128] refer to Figure 5 , Figure 5 It is a structural diagram of the content refresh device provided in an embodiment of the present application. The content refresh device provided in an embodiment of the present application includes: a domain name determination module 501, an acquisition module 502, a traffic node cluster determination module 503 and a refresh module 504.
[0129] A domain name determination module 501 is used to extract the domain name corresponding to the requested resource from the refresh request after receiving the refresh request;
[0130] The acquisition module 502 is used to acquire the node cluster and cache expiration time of the domain name distribution based on the domain name; the cache expiration time represents the expiration time of the resources stored in the cache;
[0131] The traffic node cluster determination module 503 is used to obtain the traffic node cluster within the cache validity period; the cache validity period is determined based on the cache expiration period;
[0132] The refresh module 504 is used to determine the node cluster to be refreshed based on the node cluster distributed by the domain name and the traffic node cluster, and refresh the node cluster to be refreshed; the node cluster to be refreshed represents the node cluster with traffic within the cache validity time.
[0133] The content refresh device provided by the embodiment of the present application extracts the domain name corresponding to the requested resource from the refresh request after receiving the refresh request; based on the domain name, obtains the node cluster and cache expiration time of the domain name distribution; the cache expiration time represents the expiration time of the resource stored in the cache; obtains the traffic node cluster within the cache effective time; the cache effective time is determined based on the cache expiration time; based on the node cluster and traffic node cluster distributed by the domain name, determines the node cluster to be refreshed, and refreshes the node cluster to be refreshed. The embodiment of the present application combines the domain name business traffic and the refresh task, refreshes the nodes with traffic within the cache effective time range, improves the effectiveness of the refresh task, reduces the amount of invalid refreshes, and alleviates the pressure on edge nodes.
[0134] In one embodiment, the refresh module 504 is further configured to:
[0135] Reading at least one of the refresh requests from the pending message queue;
[0136] Decomposing the uniform resource locator URL in the refresh request to extract the resource path in the URL;
[0137] Based on the resource path, construct a path hierarchy tree;
[0138] Based on the path hierarchy tree, merging the refresh requests;
[0139] Based on the merged refresh request, the to-be-refreshed node cluster is refreshed.
[0140] In one embodiment, the refresh module 504 is further configured to:
[0141] Determine the service load index score of each node to be refreshed based on the performance indicators and weights of each node to be refreshed in the node cluster to be refreshed;
[0142] Obtaining a merged path level and an upgrade threshold associated with the service load index score; the upgrade threshold represents the processing volume of the URL;
[0143] If the level of any parent node of the path hierarchy tree is greater than or equal to the merged path level, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold, all refresh requests corresponding to the parent node are merged.
[0144] In one embodiment, the refresh module 504 is further configured to:
[0145] Reading at least one merged refresh request from a refresh message queue; the refresh message queue stores the merged refresh request;
[0146] A refresh request is sent to the node to be refreshed in the node to be refreshed cluster; wherein the node to be refreshed refreshes the cache content based on the received refresh request.
[0147] In one embodiment, the refresh module 504 is further configured to:
[0148] If the domain name is in the upgrade whitelist, the refresh request and the node cluster to be refreshed are written into the pending message queue.
[0149] In one embodiment, the refresh module 504 is further configured to:
[0150] The intersection of the node cluster for domain name distribution and the traffic node cluster is extracted to remove nodes that are not distributed but have traffic, and obtain the node cluster to be refreshed.
[0151] In one embodiment, the acquisition module 502 is further configured to:
[0152] Determine a time difference between a current time and the cache expiration time;
[0153] The cache validity time is determined based on the time difference and the current time.
[0154] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call a computer program in the memory 630 to execute the steps of the content refresh method, for example including:
[0155] After receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request;
[0156] Based on the domain name, a node cluster and a cache expiration time for domain name distribution are obtained; the cache expiration time represents an expiration time of resources stored in the cache;
[0157] Obtaining a traffic node cluster within a cache effective time; the cache effective time is determined based on the cache expiration time;
[0158] Based on the node cluster distributed by the domain name and the traffic node cluster, a node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed; the node cluster to be refreshed represents a node cluster with traffic within the cache effectiveness time.
[0159] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0160] On the other hand, an embodiment of the present application further provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the content refresh method provided in the above embodiments are implemented, for example, including:
[0161] After receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request;
[0162] Based on the domain name, a node cluster and a cache expiration time for domain name distribution are obtained; the cache expiration time represents an expiration time of resources stored in the cache;
[0163] Obtaining a traffic node cluster within a cache effective time; the cache effective time is determined based on the cache expiration time;
[0164] Based on the node cluster distributed by the domain name and the traffic node cluster, a node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed; the node cluster to be refreshed represents a node cluster with traffic within the cache effectiveness time.
[0165] On the other hand, an embodiment of the present application further provides a computer program product, the computer program product including a computer program, the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can perform the steps of the content refresh method provided in the above embodiments, for example, including:
[0166] After receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request;
[0167] Based on the domain name, a node cluster and a cache expiration time for domain name distribution are obtained; the cache expiration time represents an expiration time of resources stored in the cache;
[0168] Obtaining a traffic node cluster within a cache effective time; the cache effective time is determined based on the cache expiration time;
[0169] Based on the node cluster distributed by the domain name and the traffic node cluster, a node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed; the node cluster to be refreshed represents a node cluster with traffic within the cache effectiveness time.
[0170] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0171] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0172] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. 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 application.
Claims
1. A content refreshing method, characterized in that: include: After receiving the refresh request, extracting the domain name corresponding to the requested resource from the refresh request; Based on the domain name, obtain the node cluster and cache expiration time of the domain name distribution; The cache expiration time represents the expiration time of the resources stored in the cache; Obtaining a traffic node cluster within a cache effective time; the cache effective time is determined based on the cache expiration time; Based on the node cluster distributed by the domain name and the traffic node cluster, a node cluster to be refreshed is determined, and the node cluster to be refreshed is refreshed; the node cluster to be refreshed represents a node cluster with traffic within the cache effectiveness time.
2. The content refreshing method according to claim 1, characterized in that: The refreshing of the to-be-refreshed node cluster includes: Reading at least one of the refresh requests from the pending message queue; Decomposing the uniform resource locator URL in the refresh request to extract the resource path in the URL; Based on the resource path, construct a path hierarchy tree; Based on the path hierarchy tree, merging the refresh requests; Based on the merged refresh request, the to-be-refreshed node cluster is refreshed.
3. The content refreshing method according to claim 2, characterized in that: The merging of the refresh request based on the path hierarchy tree includes: Determine the service load index score of each node to be refreshed based on the performance indicators and weights of each node to be refreshed in the node cluster to be refreshed; Obtaining a merged path level and an upgrade threshold associated with the service load index score; the upgrade threshold represents the processing volume of the URL; If the level of any parent node of the path hierarchy tree is greater than or equal to the merged path level, and the number of leaf nodes of the parent node is greater than or equal to the upgrade threshold, all refresh requests corresponding to the parent node are merged.
4. The content refreshing method according to claim 2, characterized in that: The refreshing of the to-be-refreshed node cluster based on the merged refresh request includes: Reading at least one merged refresh request from a refresh message queue; the refresh message queue stores the merged refresh request; A refresh request is sent to the node to be refreshed in the node to be refreshed cluster; wherein the node to be refreshed refreshes the cache content based on the received refresh request.
5. The content refreshing method according to claim 2, characterized in that: Before reading at least one refresh request from the pending message queue, the method further includes: If the domain name is in the upgrade whitelist, the refresh request and the node cluster to be refreshed are written into the pending message queue.
6. The content refreshing method according to claim 1, characterized in that: The node cluster distributed based on the domain name and the traffic node cluster, determining the node cluster to be refreshed, comprises: The intersection of the node cluster for domain name distribution and the traffic node cluster is extracted to remove nodes that are not distributed but have traffic, and obtain the node cluster to be refreshed.
7. The content refreshing method according to claim 1, characterized in that: Determining the cache effective time includes: Determining a time difference between a current time and the cache expiration time; The cache validity time is determined based on the time difference and the current time.
8. A content refreshing device, characterized in that: include: A domain name determination module, configured to extract a domain name corresponding to a requested resource from the refresh request after receiving the refresh request; An acquisition module, used to acquire a node cluster and a cache expiration time of domain name distribution based on the domain name; The cache expiration time represents the expiration time of the resources stored in the cache; A traffic node cluster determination module, used to obtain a traffic node cluster within a cache validity period; the cache validity period is determined based on the cache expiration period; The refresh module is used to determine the node cluster to be refreshed based on the node cluster distributed by the domain name and the traffic node cluster, and refresh the node cluster to be refreshed; the node cluster to be refreshed represents the node cluster with traffic within the cache effectiveness time.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the content refreshing method according to any one of claims 1 to 7 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the content refreshing method according to any one of claims 1 to 7 are implemented.
