WO2021007752A1 - Return-to-source method and related device in content delivery network - Google Patents

Return-to-source method and related device in content delivery network Download PDF

Info

Publication number
WO2021007752A1
WO2021007752A1 PCT/CN2019/096028 CN2019096028W WO2021007752A1 WO 2021007752 A1 WO2021007752 A1 WO 2021007752A1 CN 2019096028 W CN2019096028 W CN 2019096028W WO 2021007752 A1 WO2021007752 A1 WO 2021007752A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
url
cache
refresh
refreshed
Prior art date
Application number
PCT/CN2019/096028
Other languages
French (fr)
Chinese (zh)
Inventor
周香鹤
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2019/096028 priority Critical patent/WO2021007752A1/en
Priority to CN201980008635.7A priority patent/CN112513830A/en
Publication of WO2021007752A1 publication Critical patent/WO2021007752A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Definitions

  • This application relates to the field of content distribution networks, and in particular to a back-to-source method and related devices in a content distribution network.
  • the Content Delivery Network includes multiple cache nodes, and the multiple cache nodes include multiple edge cache nodes and at least one central cache node.
  • the edge cache nodes obtain the resources of the source station through the central cache node.
  • a user visits the origin site relying on the edge cache nodes deployed in various places can obtain the required content from the nearby edge cache nodes, thereby reducing network congestion and improving user access response speed and hit rate.
  • the edge cache nodes and central cache nodes of the CDN need to perform corresponding resource updates.
  • the edge cache node sends back a source request to the central cache node, and obtains updated resources from the central cache node. If the central cache node stores updated resources, it will directly return the updated resources to the edge cache node. If the resources cached by the central cache node are old resources before the source site updates the resources, the central cache node may send the updated resources to the edge cache node. Returning to the old resources then makes the client unable to obtain the updated resources from the edge cache node, resulting in a poor user experience.
  • embodiments of the present invention provide a back-to-origin method and related devices in a content distribution network, which can avoid the situation that the central cache node returns old resources to the edge cache node.
  • an embodiment of the present invention provides a back-to-origin method in a content distribution network.
  • the method includes the following steps: an edge cache node receives a cache refresh request sent by a control platform, and the cache refresh request carries a uniform resource locator of the resource to be refreshed URL, the edge cache node sends a back-to-origin request to the central cache node, and the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
  • the refresh time is carried in the cache refresh request, and the refresh time is set by the control platform.
  • control platform uses the time when the user triggers the refresh instruction for the URL of the resource to be refreshed on the control platform as the refresh time of the resource to be refreshed.
  • the refresh time is uniformly set by the control platform, and the edge cache node and the central cache node only need to judge based on the received refresh time, which makes the processing flow relatively simple.
  • the time when the edge cache node receives the cache refresh request is used as the refresh time.
  • the refresh time does not need to be sent by the control platform to the edge cache node, so bandwidth can be saved.
  • the refresh time needs to be transmitted over the network, so the time when the edge cache node receives the cache refresh request is later than the refresh time set by the control platform, which can more accurately reflect the refresh time of the resource to be refreshed at the edge cache node.
  • the back-to-origin method in the content distribution network further includes the following steps: the edge cache node receives the first resource access request sent by the client, and correspondingly, the edge cache The node sends back the source request to the central cache node in response to the first resource access request.
  • the first resource access request carries the URL of the resource to be accessed
  • the edge cache node sends back the source request to the central cache node in response to the resource access request, which specifically includes the following steps: the edge cache node determines the URL of the resource to be accessed and the resource to be accessed. When the URL of the refresh resource matches and the URL of the resource to be accessed does not hit the cache, a request is sent back to the central cache node.
  • the edge cache node When the edge cache node determines that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache, it sends a back-to-origin request carrying the URL of the resource to be refreshed and the refresh time to the central cache node. It can be ensured that the central cache node can determine whether to return to the source site node according to the refresh time after the edge cache node obtains the cache refresh request, which can avoid sending old resources to the edge cache node.
  • the edge cache node determines that the URL of the resource to be accessed matches the URL of the resource to be refreshed, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time, it sends the URL and URL of the resource to be refreshed to the central cache node.
  • the refresh time return request can ensure that the central cache node can determine whether to return to the origin node based on the refresh time after the edge cache node obtains the cache refresh request, which can avoid sending old resources to the edge cache node.
  • the edge cache node is provided with a refresh table, and after the edge cache node receives the cache refresh request sent by the control platform, the method further includes the following steps: the edge cache node records the URL and refresh time of the resource to be refreshed in the refresh table.
  • the edge cache node By refreshing the table to record the URL and refresh time of the resource to be refreshed, the edge cache node only needs to query whether the refresh table records the URL of the resource to be refreshed to know whether the edge cache node has received the cache refresh request sent by the control platform, which can effectively improve the processing speed .
  • the method further includes: the edge cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time.
  • the timing deletion mechanism can save the storage space and memory resources of edge cache nodes.
  • the method further includes: the edge cache node receives a second resource access request sent by the client, and the second resource access The request carries the URL of the resource to be accessed.
  • the edge cache node determines that the URL of the resource to be accessed is not in the refresh table and the URL of the resource to be accessed hits the cache, the edge cache node sends the resource access request response information to the client, and the resource access request response Information carries resources to be accessed.
  • the edge cache node Since the URL of the resource to be refreshed is not recorded in the refresh table, the edge cache node has not received a cache refresh request for the URL before determining, and can directly return the resource to be accessed to the client at this time.
  • an embodiment of the present invention provides a back-to-origin method in a content distribution network, including the following steps: a central cache node receives a first back-to-origin request sent by an edge cache node, and the first back-to-origin request carries the URL of the resource to be refreshed And the refresh time of the resource to be refreshed, the central cache node compares the refresh time with the cache time of the resource to be refreshed when the URL of the resource to be refreshed hits the cache, and when it is determined that the refresh time is later than the cache time, The origin node sends a second back-to-origin request.
  • the central cache node Since the back-to-origin request carries the refresh time of the resource to be refreshed and the URL of the resource to be refreshed, after the central cache node receives the back-to-origin request, when the URL of the resource to be refreshed hits the cache, it will confirm the cached according to the refresh time of the resource to be refreshed. Whether the resource to be refreshed is the old resource before the source station performs the resource update can avoid the situation that the central cache node directly sends the old resource to the edge cache node when the URL of the resource to be refreshed hits the cache.
  • control platform uses the time when the user triggers the refresh instruction for the URL of the resource to be refreshed on the control platform as the refresh time of the resource to be refreshed.
  • the refresh time is uniformly set by the control platform, and the edge cache node and the central cache node only need to judge based on the received refresh time, which makes the processing flow relatively simple.
  • the method further includes: the central cache node receives a second cache refresh request sent by the control platform, where the second cache refresh request carries the URL of the resource to be refreshed, The central cache node determines that the time when the second cache refresh request is received is later than the cache time.
  • the central cache node When the central cache node confirms that the refresh time is later than the cache time, and the central cache node judges that the time when the second cache refresh request is received is later than the cache time, it sends the second back-to-origin request to the origin node, which can effectively reduce Number of return to source.
  • the central cache node is provided with a refresh table, and after the central cache node receives the first back-to-origin request sent by the edge cache node, the method further includes: the central cache node records the URL and refresh time of the resource to be refreshed in the refresh table.
  • the central cache node By refreshing the table to record the URL and refresh time of the resource to be refreshed, the central cache node only needs to query whether the refresh table records the URL of the resource to be refreshed to know whether the central cache node has received the cache refresh request sent by the control platform, which can effectively improve the processing speed .
  • the method further includes: the central cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time.
  • the timing deletion mechanism can save the storage space and memory resources of edge cache nodes.
  • the central cache node Since the URL of the resource to be refreshed is not recorded in the refresh table, the central cache node has not received a cache refresh request for the URL before determining, and can directly return the resource to be accessed to the client at this time.
  • an embodiment of the present invention provides an edge cache node, including: a receiving module for receiving a cache refresh request sent by a control platform, the cache refresh request carrying a uniform resource locator URL of the resource to be refreshed, and a sending module for Send a back-to-origin request to the central cache node, and the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
  • the third aspect or any implementation manner of the third aspect is implemented by the device corresponding to the first aspect or any implementation manner of the first aspect, and the description in the first aspect or any implementation manner of the first aspect is applicable to the third aspect Or any implementation of the third aspect, which will not be repeated here.
  • the fourth aspect or any implementation manner of the fourth aspect is implemented by the device corresponding to the second aspect or any implementation manner of the second aspect, and the description in the second aspect or any implementation manner of the second aspect is applicable to the fourth aspect Or any implementation manner of the fourth aspect, which will not be repeated here.
  • an embodiment of the present invention provides a computer-readable storage medium.
  • the computer-readable storage medium stores instructions.
  • the instructions run on a computer, the computer can execute the first aspect or any one of the first aspects. The method in the way.
  • an embodiment of the present invention provides a computer-readable storage medium.
  • the computer-readable storage medium stores instructions. When the instructions are run on a computer, the computer executes the second aspect or any one of the implementation manners of the second aspect. Method in.
  • Figure 1 is a system structure diagram of a CDN system according to an embodiment of the present invention.
  • Figure 2 is a flowchart of a CDN resource refresh method according to an embodiment of the present invention
  • FIG. 4 is another schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention.
  • Fig. 5 is another schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention.
  • Fig. 6 is a flowchart of a cache refresh method of a content distribution network according to an embodiment of the present invention.
  • Fig. 8 is another flowchart of a back-to-source method in a CDN according to an embodiment of the present invention.
  • FIG. 9 is a data interaction diagram of a cache refresh method of a content distribution network according to an embodiment of the present invention.
  • FIG 10 is another data interaction diagram of the cache refresh method of the content distribution network according to the embodiment of the present invention.
  • FIG. 11 is a schematic diagram of the device structure of an edge cache node according to an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of an apparatus structure of a central cache node according to an embodiment of the present invention.
  • FIG. 13 is a schematic diagram of another device structure of an edge cache node according to an embodiment of the present invention.
  • Source station node Set the node of the source station as the data source of the content distribution network.
  • This node can be, for example, a server that provides web browsing services.
  • the data cached by the cache node of the content distribution network comes from the source station node.
  • the origin site node is set with a domain name, and users can access the origin site node or cache node that caches the resources of the origin site according to the domain name.
  • the domain name set for the origin site node is appdl. hicloud.com, the client accesses the origin site by visiting appdl.hicloud.com.
  • URL On the World Wide Web (WWW), each information resource has a unified and unique address on the Internet. This address is called URL.
  • the URL consists of three parts: resource type and resource storage The host domain name, resource file name, and URL have a one-to-one correspondence with the source site's resources.
  • protocol is the protocol, used to specify the transmission protocol used, for example, HTTP protocol, format is HTTP://, or HTTPS://, ftp protocol, format is FTP://, MMS protocol, format is MMS://, ed2k protocol, the format is ed2k://, the most commonly used is the HTTP protocol, which is also the most widely used protocol in the WWW at present, the URL does not display the protocol, which means it is the HTTP protocol.
  • port is a port number, an integer, and optional. When omitted, the default port of the scheme is used. Various transmission protocols have default port numbers. For example, the default port of http is 80. If omitted, the default port number will be used. Sometimes for security or other considerations, you can redefine the port on the server, that is, use a non-standard port number. In this case, the port number cannot be omitted from the URL.
  • path is a path, a string separated by zero or more "/" symbols, generally used to represent a directory or file address on the host.
  • TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt which means the file 1.txt under the directory TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/.
  • the URL can also be TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/
  • Client The terminal device used by the user to access the origin site or CDN, such as personal computer, tablet computer, mobile phone, etc.
  • Content distribution network includes multiple cache nodes, which cache some or all of the resources of the active station.
  • the multiple cache nodes are specifically edge cache nodes and at least one central cache node. Multiple edge cache nodes are distributed in different regions.
  • the superior node of an edge cache node is a central cache node, and the superior node of the central cache node is the origin node.
  • DNS Domain Name System
  • the client only knows the domain name of the origin site node, but in order to enable the client to access the resources of the origin site nearby, when the client sends an access request for the origin site node’s domain name, DNS
  • the server can convert the domain name of the origin site node to the IP address of the edge cache node closest to the client, and return the IP address to the client.
  • the client can directly access the closest edge cache node based on the IP address.
  • the cache node obtains the resource corresponding to the domain name to be accessed. It is worth noting that the access request sent by the client may specifically carry a URL, which includes the domain name of the source site node and the path of the resource to be accessed on the source site node.
  • the central cache node when it does not cache the resource corresponding to the URL or confirms that the cached resource is an old resource, it also needs to return to the source node of the superior. Specifically, the central cache node sends another source to the superior source node. For a back-to-origin request, in response to the back-to-origin request, the higher-level source site node sends another back-to-origin response message to the central cache node when the resource corresponding to the URL is cached locally. , The central cache node caches the resource, and returns the resource to the edge cache node,
  • Control platform used to manage the CDN, the control platform has established data connections with each cache node, and provides a CDN control interface. After updating the resources on the source site node, the user can log in to the CDN control interface of the control platform and submit the refresh task to the control The platform enables the control platform to send a cache refresh request for a specific URL to all cache nodes of the CDN.
  • the cache refresh request is used to instruct all cache nodes of the CDN to record that the resource corresponding to the URL has been updated.
  • the control platform can be set on an independent server, or on any cache node, or on a virtual machine, which is not limited in the embodiment of the present invention.
  • the control platform may be, for example, a content management system (Content Management System, CMS).
  • CMS Content Management System
  • CMS is used for information management, information publishing, and website maintenance, and is a web interactive content management and publishing application system developed .
  • CMS includes the entire process of information collection, sorting, classification, review, release and management. It has complete information management and release management functions. Users can easily submit the information that needs to be released at any time without having to master complicated technologies.
  • caching refers to storing all or part of the source station's resources in the local memory of the edge cache node and the central cache node.
  • the cache table records the URL, cache time, and the storage address of the resource corresponding to the URL in the local memory of the resource that has been cached in the local storage.
  • the cache time is the time point when the cache node caches the resource in the local storage.
  • Resources including web pages, videos, audios, animations and other data.
  • Figure 1 is a system structure diagram of a CDN system according to an embodiment of the present invention.
  • the CDN system includes an origin node 10, a control platform 20, a content distribution network CDN, and clients 101-105. .
  • Edge cache nodes are located in different regions. For example, edge cache nodes 70 can be located in South China, edge cache nodes 71 are located in Central China, edge cache nodes 72 are located in West China, and edge cache nodes 73 are located in North China. The edge cache node 74 is located in East China.
  • the upper node of the edge cache node 70-72 is the central cache node 60
  • the upper node of the edge cache node 73-74 is the central cache node 61
  • the upper node of the central cache node 60-61 is the source Station node 10.
  • client 101 is located in South China, so the distance between client 101 and edge cache node 70 is the closest, client 102 is located in Central China, so client 102 and edge cache node 71 are in the same area, and client 103 is located in West China. Therefore, the client 103 and the edge cache node 72 are in the same area, and the client 104 is located in North China. Therefore, the client 104 and the edge cache node 73 are in the same area.
  • the client 105 is located in East China. Therefore, the client 105 and the edge cache node 74 are located in the same area. In the same area.
  • the central cache node 60 at the higher level sends back the source request. If the central cache node 60 caches the resource corresponding to the URL of the source site, it returns the request to the edge cache node 70 Resources. If the central cache node 60 does not cache the resource corresponding to the URL of the source site, the central cache node 60 sends another source request to the source site.
  • the user logs in to the CDN control interface provided by the control platform 20, enters the URL and sends out the target
  • the refresh command of the URL the URL is the URL of the resource to be refreshed.
  • the central cache node After the central cache node records that the resource to be refreshed has been refreshed at the origin site, when it receives a resource access request for the URL of the resource to be refreshed sent by the edge cache node, it will not send it to the
  • the edge cache node sends the resource to be refreshed, but sends another back-to-origin request to the origin node.
  • the origin node sends the user's updated resource to be refreshed to the central cache node according to the back-to-origin request, and the central cache node caches the resource to be refreshed , And send the resource to be refreshed to the edge cache node, and the edge cache node provides the resource to be refreshed to the client.
  • control platform Since the control platform first sends a cache refresh request to the central cache node, and after ensuring that the central cache node records that the resource to be refreshed has been updated, it sends a cache refresh request to the edge cache node, thus avoiding the edge cache node from receiving the cache refresh request first If the central cache node receives a cache refresh request, this situation will cause the client to pull old resources from the central cache node.
  • the edge cache node receives the cache refresh request sent by the control platform and records that after the resource to be refreshed has been refreshed at the origin site, if it receives a resource access request for the URL of the resource to be refreshed from the client at this time, Even if the edge cache node caches a resource to be refreshed, it cannot be returned to the client because the resource is a resource before the update.
  • the edge cache node sends a return request for the URL of the resource to be refreshed to the upper-level central cache node.
  • the upper-level central cache node has not yet received the cache refresh request sent by the control platform, and locally caches the resources to be refreshed before the source station is updated. The upper-level central cache node will return the local cache to the edge cache node for the return request.
  • control platform sends a cache refresh request to all central cache nodes in the CDN and Edge cache nodes can ensure that the client pulls old resources from the central cache node will not happen.
  • Step 111 The control platform 20 obtains the URL of the resource to be refreshed.
  • appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt represents the directory of the origin site appdl.hicloud.com TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node 1.txt in /, you need to refresh all subdirectories and files in this directory.
  • the CDN control interface can also provide back-to-source message setting options.
  • the user can choose to set the back-to-source message header.
  • Figure 4 is a control platform according to an embodiment of the present invention.
  • Another schematic diagram of the provided CDN control interface is shown in Figure 4.
  • you can set the HyperText Transfer Protocol (HTTP header), and the user can choose to send from the edge cache node to the central cache node.
  • a refresh time is added to the header of the back-to-origin request, and the refresh time is the time point when the edge cache node receives the first cache refresh request (which will be described in detail below).
  • Step 112 After the user clicks the "click to refresh" option, the control platform 20 may send the first cache refresh request carrying the URL of the resource to be refreshed to the edge cache nodes 70-75 at the same time, and send the URL of the resource to be refreshed The second cache refresh request to the central cache node 60-61.
  • Step 113 The control platform 20 receives the first cache refresh success message returned by the edge cache nodes 70-75 according to the first cache refresh request, and receives the second cache returned by the central cache node 60-61 according to the second cache refresh request In the case of successful refresh information, it prompts that the resource to be refreshed has been successfully refreshed.
  • FIG. 5 is another schematic diagram of the CDN control interface provided by the control platform according to an embodiment of the present invention.
  • FIG. 5 shows the URL of the resource to be refreshed:
  • the function of setting back-to-origin packets can also be set in edge cache nodes 70-75 by default. Users do not need to set back-to-origin packet headers on the CDN control interface, and edge cache nodes 70-75 are sending by default Set the refresh time for the return request to the member node of the superior center.
  • the control platform 20 sends the first cache refresh request carrying the URL of the resource to be refreshed to the edge cache nodes 70-75, and sends the second cache refresh request carrying the URL of the resource to be refreshed to the central cache node 60-61, there is no need to wait for the edge cache
  • the cache refresh success message of the node can improve the URL refresh speed of the CDN, thereby improving the user experience.
  • the above URL refresh method is to add refresh time to the header of the back-to-origin request sent by the edge cache node to the central cache node to ensure that the edge cache node will not obtain the old resources from the superior central cache node. The principle will be described in detail.
  • FIG. 6 is a flowchart of a method for refreshing a cache of a content distribution network according to an embodiment of the present invention. For clarity, the method is executed by the edge cache node 70 in the CDN system shown in FIG. It is noted that other edge cache nodes in the CDN system shown in FIG. 1 can also perform this method.
  • the method includes the following steps:
  • Step 201 The edge cache node 70 receives a first cache refresh request sent by the control platform 20, where the first cache refresh request carries the URL of the resource to be refreshed.
  • the URL of the resource to be refreshed can be, for example:
  • appdl.hicloud.com is the domain name of the origin node
  • TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/ is a directory of the origin node.
  • Step 202 The edge cache node 70 records the URL of the resource to be refreshed carried in the first cache refresh request and the refresh time of the URL of the resource to be refreshed, and sends a first cache refresh success message to the control platform 20.
  • the refresh time of the URL of the resource to be refreshed is the point in time when the edge cache node 70 receives the first cache refresh request.
  • the edge cache node 70 is provided with a refresh table. After the edge cache node 70 receives the first cache refresh request sent by the control platform 20, the edge cache node 70 records the URL of the resource to be refreshed and the refresh time in the refresh table, specifically , Record the URL of the resource to be refreshed and the refresh time can be recorded as an entry in the refresh table.
  • the edge cache node 70 may delete the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time. For example, when the resource to be refreshed is a directory, it may be one month later. Delete the entry that records the URL and refresh time of the resource to be refreshed. When the resource to be refreshed is a file, you can delete the URL and refresh time of the resource to be refreshed in the refresh table after 10 seconds, because refreshing the table will occupy storage space and memory The timing deletion mechanism can save the storage space and memory resources of the edge cache node 70.
  • the edge cache node 70 refreshes the table and records the URL and refresh time of the resource to be refreshed, if the URL of the resource to be refreshed hits the cache, the edge cache node 70 will delete the pending resource in the local storage. Refresh the resource and delete the entry in the cache table where the URL of the resource to be refreshed is located.
  • Step 203 The edge cache node 70 receives the resource access request sent by the client 101, the resource access request carries the URL of the resource to be accessed, and the resource access request is used to request the resource to be accessed.
  • the URL of the resource to be accessed can be, for example:
  • the resource to be accessed is the file 1.txt in the source site node whose domain name is appdl.hicloud.com is /TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/.
  • Step 204 The edge cache node judges whether the URL of the resource to be accessed matches the URL of the resource to be refreshed, if yes, execute step 205, if not, execute step 210.
  • the edge cache node 70 determines that the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, or when it is determined that the URL of the resource to be refreshed is the prefix of the URL of the resource to be accessed, determines the URL of the resource to be accessed and the URL of the resource to be refreshed.
  • the URL of the refresh resource matches.
  • the URL of the resource to be accessed is:
  • the URL of the resource to be refreshed is:
  • the URL of the resource to be refreshed is the prefix of the URL of the resource to be accessed. At this time, the URL of the resource to be accessed matches the URL of the resource to be refreshed.
  • the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, and at this time the URL of the resource to be accessed matches the URL of the resource to be refreshed.
  • Step 205 The edge cache node 70 determines whether the URL of the resource to be accessed hits the cache, if yes, execute step 206, if not, execute step 207.
  • the edge cache node 70 determines whether the URL of the resource to be accessed is the same as the URL recorded in the local cache table, if they are the same, the cache is hit, and if they are not the same, the cache is not hit.
  • step 206 select among the multiple cache times corresponding to the same URL in the cache table. The cache time closest to the current time is used as the cache time.
  • the refresh time is the time point when the edge cache node 70 receives the first cache refresh request
  • the cache time is the time point when the edge cache node 70 caches the resource to be accessed in the local memory. If the refresh time is later than the latest The cache time indicates that the resource to be accessed cached to the edge cache node 70 is the old resource before the source station is updated. At this time, step 207 needs to be performed to return to the source to the upper-level central cache node 60. If the first refresh time is not later than the latest The cache time indicates that the resource to be accessed cached to the edge cache node 70 is a new resource after the source station is updated, and the resource is a resource after the source station is refreshed. At this time, step 212 is executed to return the resource to the client 101.
  • the edge cache node 70 may obtain the refresh time by querying a local refresh table, and obtain the cache time by querying a local cache table.
  • Step 207 The edge cache node 70 sends a first back-to-origin request to the upper-level central cache node 60.
  • the first back-to-origin request carries the refresh time and the URL of the resource to be refreshed.
  • the first back-to-origin request is an HTTP message
  • the header of the HTTP message is customized with a refresh time type.
  • the refresh time can be reflected in UNIX timestamp, for example: 1562280282, and UNIX timestamp is 1970 The number of seconds that have passed since January 1 of the year.
  • the refresh time type is, for example, x-refresh-sendtime
  • the HTTP packet header carries the following information:
  • Step 208 The edge cache node 70 receives the back-to-origin request response information sent by the central cache node 60, and the back-to-origin response information carries the URL of the resource to be refreshed and the resource to be refreshed.
  • the central cache node 60 generates back-to-origin request response information according to the first back-to-origin request.
  • Step 209 The edge cache node 70 caches the URL of the resource to be refreshed and the resource to be refreshed, and records the cache time.
  • the edge cache node 70 records the URL of the resource to be refreshed, the cache time, and the storage address of the resource to be refreshed in the local memory as an entry in the cache table. It is worth noting that the cache table may record data corresponding to the same URL. There are multiple cache times, so in step 206, the cache time closest to the current time is selected as the cache time.
  • the edge cache node 70 periodically deletes entries in the cache table.
  • Step 211 The edge cache node 70 sends a second back-to-origin request to the central cache node 60, and the second back-to-origin request carries the URL of the resource to be refreshed.
  • Step 212 The edge cache node 70 sends resource access request response information to the client 101, and the resource access request response information carries the URL of the resource to be accessed and the resource to be accessed.
  • the edge cache node 70 sends a first back-to-origin request to the central cache node 60 in response to the resource access request.
  • the first back-to-origin request carries the refresh time and the URL of the resource to be refreshed, and the refresh time is the edge cache. The time point when the node 70 receives the cache refresh request.
  • the central cache node 60 After the central cache node 60 receives the first back-to-origin request, if the URL of the resource to be refreshed hits the cache, it confirms whether the cached resource to be refreshed is old according to the first refresh time. Resources can avoid the situation that the central cache node 60 directly sends old resources to the edge cache node 70 when the URL of the resource to be refreshed hits the cache.
  • step 202 after the edge cache node 70 deletes the URL of the resource to be refreshed and the refresh time after refreshing the table after a predetermined time, if the client 101 sends another resource access for the URL of the resource to be refreshed The request is sent to the edge cache node 70. At this time, the edge cache node 70 cannot find the URL of the resource to be refreshed in the refresh table. At this time, the edge cache node 70 sends back to the source after confirming that the URL of the resource to be refreshed hits the cache. The request response information is sent to the central cache node 60, and the return request response information carries the URL of the resource to be refreshed and the cached resource to be refreshed.
  • the refresh time may also be uniformly set by the console 20 and carried in the first cache refresh request sent by the console 20 to the edge cache node 70.
  • the refresh time can be defined as the time point recorded by the control platform 20 when the user clicks the "click to refresh" button on the CDN control interface in FIG. 3.
  • the method includes the following steps:
  • Step 401 The central cache node 60 receives the back-to-origin request sent by the edge cache node 70.
  • the back-to-origin request may be the first back-to-origin request that carries the first refresh time and the URL of the resource to be refreshed in step 207 shown in Figure 6, or it may be the URL of the resource to be refreshed in step 211 without carrying it.
  • the second back-to-origin request with the first refresh time may be the first back-to-origin request that carries the first refresh time and the URL of the resource to be refreshed in step 207 shown in Figure 6, or it may be the URL of the resource to be refreshed in step 211 without carrying it.
  • the second back-to-origin request with the first refresh time may be the first back-to-origin request that carries the first refresh time and the URL of the resource to be refreshed in step 207 shown in Figure 6, or it may be the URL of the resource to be refreshed in step 211 without carrying it.
  • the second back-to-origin request with the first refresh time may be the first back-to-origin request that carries the first refresh time and the URL of the resource to
  • Step 402 The central cache node 60 judges whether the return-to-origin request carries the first refresh time, if yes, execute step 403, if not, execute step 408.
  • the return-to-origin request is an HTTP message
  • Step 403 The central cache node 60 determines whether the second cache refresh request sent by the control platform 20 has been received, if yes, execute step 404, if not, execute step 409.
  • the central cache node 60 when the central cache node 60 receives the second cache refresh request sent by the control platform 20, it records the URL of the resource to be refreshed and the time point when the central cache node 60 receives the second cache refresh request in the local refresh table. On the other hand, if the central cache node 60 receives the second cache refresh request sent by the control platform 20, the local refresh table is not set. At this time, the refresh table does not record the refresh URL and the central cache node 60 receives the second cache refresh The time of the request.
  • the central cache node 60 periodically deletes the URL and refresh time of the resource to be refreshed recorded in the local refresh table. For example, if the resource to be refreshed is a directory, the resource to be refreshed can be deleted one month later. Refresh the URL and refresh time of the resource. When the resource to be refreshed is a file, the URL and refresh time of the resource to be refreshed can be deleted after 10 days. Since refreshing the table will occupy storage space and memory, this timing deletion mechanism can save central cache The storage space and memory resources of the node 60.
  • Step 404 The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 405, if not, execute step 410.
  • the back-to-origin request is the first back-to-origin request shown in FIG. 6, where the URL of the resource to be refreshed carried in the back-to-origin request hits the cache.
  • the central cache node 60 executes the branch of step 405 to confirm whether to return the cached resource to the edge cache node 70 according to the first refresh time. Refresh resources.
  • the central cache node 60 executes step 410 to directly return to the origin node.
  • the central cache node 60 may delete the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time. For example, when the resource to be refreshed is a directory, it may be one month later. Delete the entry that records the URL and refresh time of the resource to be refreshed. When the resource to be refreshed is a file, you can delete the URL and refresh time of the resource to be refreshed in the refresh table after 10 seconds, because refreshing the table will occupy storage space and memory , The timing deletion mechanism can save the storage space and memory resources of the central cache node 60.
  • the central cache node 60 records the URL and refresh time of the resource to be refreshed in the refresh table, if the URL of the resource to be refreshed hits the cache, the central cache node 60 deletes the resource in the local storage. Refresh the resource and delete the entry in the cache table where the URL of the resource to be refreshed is located.
  • the resource to be refreshed is a directory
  • the central cache node 60 records the URL and refresh time of the resource to be refreshed in the refresh table, if the URL of the resource to be refreshed hits the cache, since the directory may include multiple files, the central cache node 60
  • the resource to be refreshed will not be deleted in the local storage, and the entry where the URL of the resource to be refreshed in the cache table is located will not be deleted.
  • Step 405 The central cache node 60 judges whether the latest refresh time is later than the local cache time, where the latest refresh time is the refresh time carried in the first back-to-origin request and the time point when the central cache node 60 receives the second cache refresh request If it is later, it means that the resource to be refreshed currently cached by the central cache node 60 is the resource before the source site refreshes the resource, that is, the old resource. At this time, the central cache node 60 performs step 410 to return to the source site node. If not, it means that the cached resource to be refreshed is the resource after the source station refreshes the resource, that is, it is a new resource. At this time, step 406 is executed to directly return the cached resource to be refreshed to the edge cache node 70.
  • Step 406 The central cache node 60 sends the first back-to-origin request response information to the edge cache node 70, and the first back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed.
  • Step 407 When the central cache node 60 does not receive the second cache refresh request sent by the control platform 20, step 407 is executed. In step 407, the central cache node 60 determines the status of the resource to be refreshed carried in the first back-to-source request. Whether the URL hits the cache, if yes, execute step 409, if not, execute step 410.
  • the back-to-origin request is the first back-to-origin request shown in FIG. 6.
  • step 409 is executed, and only according to the first The refresh time carried in the return-to-origin request determines whether to send the cached resource to be refreshed to the edge cache node 70.
  • step 410 is executed to directly return to the origin node.
  • Step 408 The central cache node 60 judges whether the refresh time carried in the first source request is later than the local cache time, if so, confirms that the cached resource to be refreshed is the old resource before the source station refreshes, and executes step 412 to directly The source site node 10 returns to the source. If not, it is confirmed that the cached resource to be refreshed is a new resource after the source site is refreshed, and step 406 is executed to return the locally cached resource to be refreshed to the edge cache node 70.
  • Step 409 The central cache node 60 determines whether the second cache refresh request sent by the control platform 20 has been received, if yes, execute step 411, if not, execute step 410.
  • the return-to-origin request is the second return-to-origin request shown in FIG. 6.
  • Step 410 The central cache node 60 determines whether the URL of the resource to be refreshed carried in the second back-to-origin request hits the cache, if yes, execute step 406 to return the resource to be refreshed to the edge cache node 70, if not, execute step 412 to the source
  • the station node 20 returns to the source.
  • Step 411 The central cache node 60 judges whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 406, if not, execute step 412.
  • Step 412 The central cache node 60 sends another back-to-origin request to the origin node 20, and the back-to-origin request carries the URL of the resource to be refreshed.
  • Step 413 The central cache node 60 receives the back-to-origin request response information sent by the source site node 20.
  • the back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed.
  • the central cache node 60 caches the resource to be refreshed in the local storage, and Record the URL of the resource to be refreshed, the cache time, and the storage address of the resource in the cache table.
  • the central cache node 60 when the central cache node 60 receives the back-to-origin request carrying the refresh time, even if the URL of the resource to be refreshed carried in the back-to-origin request hits the local cache, the central cache node 60 will refresh according to the refresh time. Time to further confirm whether the resource to be refreshed in its own cache is the resource after the source station is updated. After confirming whether the resource to be refreshed in its own cache is the resource after the source station is updated, the resource is returned to the edge cache node 70. Whether the resource to be refreshed is the resource before the refresh, the source is returned to the origin node 20 to ensure that the client 101 will not obtain the old resource from the edge cache node 70.
  • the refresh time can also be uniformly set by the console 20 and carried in the first cache refresh request sent by the console 20 to the edge cache node 70 and the console 20 sent to the central cache. Node 60 is in the second cache refresh request.
  • the refresh time can be defined as the time point recorded by the control platform 20 when the user clicks the "click to refresh" button on the CDN control interface in FIG. 3.
  • FIG. 8 is a flowchart of the back-to-origin method in the CDN according to an embodiment of the present invention. As shown in FIG. 8, the method includes the following steps:
  • Step 1001 The central cache node 60 receives the back-to-origin request sent by the edge cache node 70.
  • Step 1002 The central cache node 60 determines whether the return-to-origin request carries a refresh time, if yes, execute step 1003, if not, execute step 1006.
  • Step 1003 The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 1004, if not, execute step 1007.
  • Step 1004 The central cache node 60 determines whether the refresh time is later than the local cache time, if yes, execute step 1007, if not, execute step 1005.
  • Step 1005 The central cache node 60 sends first back-to-origin request response information to the edge cache node 70, and the first back-to-origin response information carries the URL of the resource to be refreshed and the resource to be refreshed.
  • Step 1006 The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 1005, if not, execute step 1007.
  • Step 1007 The central cache node 60 sends another back-to-origin request to the origin node 20, and the back-to-origin request carries the URL of the resource to be refreshed.
  • Step 1008 The central cache node 60 receives the back-to-origin request response information sent by the source site node 20, and the back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed, caches the resource to be refreshed in the local storage and in the cache table Record the URL, cache time, and storage address of the resource to be refreshed.
  • the refresh time is a time point uniformly set by the control platform 20, that is, the refresh time received by the central cache node 60 from the edge cache node 70 is the same as the refresh time it receives from the control platform 20. Therefore, in the method shown in FIG. 8, the central cache node 60 does not need to determine whether the second cache refresh request has been received before.
  • the steps shown in FIG. 8 are similar to the related steps in FIG. Refer to FIG. 7 for the related description of each step, which is not repeated here.
  • the central cache node 60 when the central cache node 60 receives the return-to-origin request carrying refresh time, even if the URL of the resource to be refreshed carried in the return-to-origin request hits the local cache, the central cache node 60 will still According to the refresh time, it is further confirmed whether the resource to be refreshed in its own cache is the resource after refresh. After confirming whether the resource to be refreshed in its own cache is the resource after refresh, the resource is returned to the edge cache node 70. Whether the refreshed resource is the resource before refreshing, the source is returned to the source site node 20 to ensure that the client 101 will not obtain the old resource from the edge cache node 70.
  • FIG. 9 is a data interaction diagram of a method for refreshing a cache of a content distribution network according to an embodiment of the present invention.
  • the method shown in FIG. 9 It includes the following steps:
  • Step 801 The user logs into the origin site node 10, and the resource corresponding to the specific URL of the origin site is updated by the user.
  • Step 802 The user logs into the CDN control interface and inputs a refresh command for a specific URL, and the control platform 20 receives the refresh command input by the user.
  • control platform 20 simultaneously sends multiple first cache refresh requests to all edge cache nodes in the CDN, and sends multiple second cache refresh requests to all central cache nodes in the CDN, the first cache refresh request and the second cache refresh request.
  • the cache refresh request carries the URL of the resource to be refreshed.
  • Step 807 After the central cache node 60 records the URL of the resource to be refreshed and the second refresh time to the local refresh table, it sends the second cache refresh success information to the control platform 20, where the second refresh time is the time received by the central cache node 60 The time point of the second cache refresh request.
  • Step 808 When receiving the cache refresh success information returned by all cache nodes in the CDN, the control platform 20 prompts the user that the resource to be refreshed has been refreshed in the CDN.
  • Step 809 The client 101 sends a resource access request carrying the URL of the resource to be accessed to the edge cache node 70.
  • Step 810 The edge cache node 70 generates a first back-to-origin request when the preset condition is met.
  • the preset conditions are:
  • the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache; or the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed, and the URL of the resource to be refreshed The URL of the resource hits the cache, and the refresh time is later than the cache time of the resource to be refreshed.
  • Step 811 The edge cache node 70 sends the first back-to-origin request to the central cache node 60.
  • Step 812 When the URL of the resource to be refreshed hits the cache, the central cache node 60 selects the later of the first refresh time and the second refresh time as the latest refresh time, if the latest refresh time is later than the URL of the resource to be refreshed During the cache time of the central cache node 60, a second back-to-origin request is generated.
  • Step 814 The origin node 10 sends a first response request to the central cache node 60.
  • the first response request carries resources to be refreshed.
  • the central cache node 60 updates the cache time 0 in this entry 1, and modifies the cache time 0 to the cache Time 1.
  • the central cache node 60 may also add entry 2: URL of the resource to be refreshed, cache time 1, storage address 1, and entry 1 is reserved.
  • the central cache node 60 searches for the cache time corresponding to the URL of the resource to be refreshed, it obtains entry 1 and entry 2 in the cache table according to the URL of the resource to be refreshed, compares the cache time in entry 1 and entry 2, and selects the later The cache time 2 is used as the cache time of the URL of the resource to be refreshed.
  • Step 816 The central cache node 60 sends a second response request to the edge cache node 70.
  • the first response request carries resources to be refreshed.
  • edge cache node 70 on the local cache table is similar to that of the central cache node 60, which will not be described in detail here.
  • Step 818 The edge cache node 70 sends a third response request to the client 101.
  • the third response request carries resources to be refreshed.
  • the back-to-origin request sent by the edge cache node to the central cache node carries a refresh time, even if the central cache node hits the cache, it will determine whether the resource that hits the cache is a new resource based on the refresh time. Based on this, control The platform 20 can send cache refresh requests to all cache nodes of the CDN at the same time, and there is no need to worry about the central cache node returning old resources to the edge cache nodes. Therefore, the refresh speed of the CDN can be significantly accelerated, thereby improving user experience.
  • the embodiment of the present invention can ensure that the central cache node 60 will not return the old resources to the edge cache node 70 in this case.
  • FIG. 10 is according to an embodiment of the present invention Another data interaction diagram of the cache refresh method of the content distribution network. The method shown in FIG. 10 includes the following steps:
  • Step 901 The user logs into the origin site node 10, and the resource corresponding to the specific URL of the origin site is updated by the user.
  • Step 902 The user logs in to the CDN control interface and inputs a refresh command for a specific URL, and the control platform 20 receives the refresh command input by the user.
  • control platform 20 simultaneously sends multiple first cache refresh requests to all edge cache nodes in the CDN, and sends multiple second cache refresh requests to all central cache nodes in the CDN, the first cache refresh request and the second cache refresh request.
  • the cache refresh request carries the URL of the resource to be refreshed.
  • Step 904 When receiving the first cache refresh request, the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table.
  • Step 905 After the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table, it sends the first cache refresh success information to the control platform 20, where the first refresh time is the edge cache node 70 received The time point of the first cache refresh request.
  • the preset conditions are:
  • the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache; or the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed, and the URL of the resource to be refreshed The URL of the resource hits the cache, and the refresh time is later than the cache time of the resource to be refreshed.
  • Step 908 The edge cache node 70 sends the first back-to-origin request to the central cache node 60.
  • Step 909 If the central cache node 60 confirms that the first refresh time is later than the cache time of the URL of the resource to be refreshed in the central cache node 60 when the URL of the resource to be refreshed hits the cache, a second return request is generated.
  • Step 911 The source site node 10 sends a first response request to the central cache node 60.
  • the first response request carries resources to be refreshed.
  • the central cache node 60 updates the cache time 0 in this entry 1, and modifies the cache time 0 to the cache Time 1.
  • the central cache node 60 may also add entry 2: URL of the resource to be refreshed, cache time 1, storage address 1, and entry 1 is reserved.
  • the central cache node 60 searches for the cache time corresponding to the URL of the resource to be refreshed, it obtains entry 1 and entry 2 in the cache table according to the URL of the resource to be refreshed, compares the cache time in entry 1 and entry 2, and selects the later The cache time 2 is used as the cache time of the URL of the resource to be refreshed.
  • Step 913 The central cache node 60 sends a second response request to the edge cache node 70.
  • the second response request carries resources to be refreshed.
  • edge cache node 70 on the local cache table is similar to that of the central cache node 60, which will not be described in detail here.
  • Step 915 The edge cache node 70 sends a third response request to the client 101.
  • Step 916 When the central cache node 60 receives the cache refresh request, it records the URL of the resource to be refreshed and the second refresh time to the local refresh table.
  • Step 917 After the central cache node 60 records the URL of the resource to be refreshed and the second refresh time to the local refresh table, it sends a second cache refresh success message to the control platform 20, where the second refresh time is received by the central cache node 60 The time point of the second cache refresh request.
  • the control platform 20 can send a cache refresh request to all cache nodes of the CDN at the same time, without worrying about the central cache node returning old resources to the edge cache node.
  • an embodiment of the present invention further provides an edge cache node 70, which includes a receiving module 701, a sending module 702, a judgment module 703, a recording module 704, and a timing deletion module 704. These modules are used to perform the operations shown in FIG. Related operations in the embodiment.
  • an embodiment of the present invention further provides a central cache node 60, including a receiving module 601, a sending module 602, a judgment module 603, a recording module 604, and a timing deletion module 604. These modules are used to execute FIG. 7 or FIG. 8 shows the related operations in the embodiment.
  • FIG. 13 is a schematic structural diagram of an edge cache node 70 provided by an embodiment of the present application.
  • the edge cache node 70 includes a processing unit 7000 and a communication interface 7103.
  • the processing unit 7000 is configured to execute functions defined by various software programs, for example, to implement the functions of the edge cache node 70.
  • the communication interface 7103 is used to communicate and interact with other computing nodes, and other devices may be other physical servers. Specifically, the communication interface 7103 may be a network adapter card.
  • the edge cache node 70 may further include an input/output interface 7101, and the input/output interface 7101 is connected to an input/output device for receiving input information and outputting operation results.
  • the input/output interface 7101 may be a mouse, a keyboard, a display, or an optical drive.
  • the edge cache node 70 may also include auxiliary storage 7102, which is generally also called external storage.
  • the storage medium of the auxiliary storage 7102 may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, an optical disk), Or semiconductor media (such as solid state drives) and so on.
  • the edge cache node 70 may further include a bus 7104.
  • the processing unit 7000, the communication interface 7103, the input/output interface 7101, and the auxiliary memory 7102 may be connected through the bus 7104.
  • the bus 7104 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • the bus 7104 can be divided into an address bus, a data bus, and a control bus. For ease of representation, only one line is used in FIG. 13, but it does not mean that there is only one bus or one type of bus.
  • the processing unit 7000 may have a variety of specific implementation forms.
  • the processing unit 7000 may include a processor 7002 and a memory 7001, and the processor 7002 performs related operations of the embodiment shown in FIG. 6 according to program instructions stored in the memory 7001.
  • the processor 7002 may be a central processing unit (central processing unit, CPU).
  • the processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (ASICs), ready-made programmable gate arrays (field programmable gate arrays, FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the processor 7002 adopts one or more integrated circuits to execute related programs to implement the technical solutions provided in the embodiments of the present application.
  • FIG. 14 is a schematic structural diagram of a central cache node 60 provided by an embodiment of the present application.
  • the central cache node 60 includes a processing unit 6000 and a communication interface 6103.
  • the processing unit 6000 is used to execute functions defined by various software programs, for example, to implement the functions of the central cache node 60.
  • the communication interface 6103 is used to communicate and interact with other computing nodes, and other devices may be other physical servers. Specifically, the communication interface 6103 may be a network adapter card.
  • the central cache node 60 may further include a bus 6104.
  • the processing unit 6000, the communication interface 6103, the input/output interface 6101, and the auxiliary memory 6102 may be connected through the bus 6104.
  • the bus 6104 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • PCI peripheral component interconnect standard
  • EISA extended industry standard architecture
  • the bus 6104 can be divided into an address bus, a data bus, and a control bus. For ease of representation, only one line is used for representation in FIG. 14, but it does not mean that there is only one bus or one type of bus.
  • the processing unit 6000 may have a variety of specific implementation forms.
  • the processing unit 6000 may include a processor 6002 and a memory 6001, and the processor 6002 performs related operations of the embodiment shown in FIG. 7 or FIG. 8 according to program instructions stored in the memory 6001.
  • the processor 6002 may be a central processing unit (central processing unit, CPU).
  • the processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (ASICs), ready-made programmable gate arrays (field programmable gate arrays, FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the processor 6002 adopts one or more integrated circuits to execute related programs to implement the technical solutions provided in the embodiments of the present application.
  • each unit in the central cache node 60 is used to implement the corresponding procedures of the methods in FIGS. 7 to 10, and are not repeated here for brevity.
  • the memory in the embodiment of the present application may include a volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviation: RAM); the memory may also include non-volatile memory.
  • Non-volatile memory English: non-volatile memory
  • read-only memory English: read-only memory, abbreviation: ROM
  • flash memory English: flash memory
  • hard disk English: hard disk drive, abbreviation: HDD
  • SSD solid-state drive
  • the memory may also include a combination of the foregoing types of memory.
  • the present application provides a computer-readable storage medium that stores instructions in the computer-readable storage medium, and when it runs on a computer, the computer executes any possible implementation in the above-mentioned embodiments. The method described.
  • the present application provides a computer program product containing instructions, which when run on a computer, enables the computer to execute the method described in any possible implementation manner in the foregoing embodiments.
  • the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage channels (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage channels including but not limited to disk storage, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed in the embodiments of the present invention are a return-to-source method and a related device in a content delivery network. The method comprises the following steps: an edge cache node receives a cache refreshing request transmitted by a control platform, wherein the cache refreshing request carries the uniform resource locator (URL) of a resource to be refreshed; the edge cache node transmits a return-to-source request to a central cache node, wherein the return-to-source request carries the URL of the resource to be refreshed and a refresh time of the resource to be refreshed. The present invention can avoid the occurrence of the case that the central cache node returns an old resource to the edge cache node.

Description

内容分发网络中的回源方法及相关装置Back-to-source method and related device in content distribution network 技术领域Technical field
本申请涉及内容分发网络领域,特别涉及一种内容分发网络中的回源方法及相关装置。This application relates to the field of content distribution networks, and in particular to a back-to-source method and related devices in a content distribution network.
背景技术Background technique
内容分发网络(Content Delivery Network,CDN)包括多个缓存节点,多个缓存节点包括多个边缘缓存节点和至少一个中心缓存节点,边缘缓存节点通过中心缓存节点获取源站的资源。用户在访问源站时,依靠部署在各地的边缘缓存节点,可就近从边缘缓存节点获取所需内容,从而降低网络拥塞,提高用户访问响应速度和命中率。The Content Delivery Network (CDN) includes multiple cache nodes, and the multiple cache nodes include multiple edge cache nodes and at least one central cache node. The edge cache nodes obtain the resources of the source station through the central cache node. When a user visits the origin site, relying on the edge cache nodes deployed in various places can obtain the required content from the nearby edge cache nodes, thereby reducing network congestion and improving user access response speed and hit rate.
在源站的资源更新之后,CDN的边缘缓存节点和中心缓存节点需要进行相应的资源更新。现有技术中,边缘缓存节点向中心缓存节点发送回源请求,从中心缓存节点获取更新后的资源。若中心缓存节点存储有更新后的资源,则直接向边缘缓存节点返回更新后的资源,若中心缓存节点缓存的资源是源站进行资源更新之前的旧资源,中心缓存节点可能会向边缘缓存节点返回旧资源,继而使得客户端无法从边缘缓存节点获取到更新后的资源,从而造成用户体验不佳。After the resources of the origin site are updated, the edge cache nodes and central cache nodes of the CDN need to perform corresponding resource updates. In the prior art, the edge cache node sends back a source request to the central cache node, and obtains updated resources from the central cache node. If the central cache node stores updated resources, it will directly return the updated resources to the edge cache node. If the resources cached by the central cache node are old resources before the source site updates the resources, the central cache node may send the updated resources to the edge cache node. Returning to the old resources then makes the client unable to obtain the updated resources from the edge cache node, resulting in a poor user experience.
发明内容Summary of the invention
为解决现有技术的问题,本发明实施例提供一种内容分发网络中的回源方法及相关装置,可避免中心缓存节点向边缘缓存节点返回旧资源的情况发生。In order to solve the problems of the prior art, embodiments of the present invention provide a back-to-origin method and related devices in a content distribution network, which can avoid the situation that the central cache node returns old resources to the edge cache node.
第一方面,本发明实施例提供一种内容分发网络中的回源方法,该方法包括以下步骤:边缘缓存节点接收控制平台发送的缓存刷新请求,缓存刷新请求携带有待刷新资源的统一资源定位符URL,边缘缓存节点向中心缓存节点发送回源请求,回源请求携带有待刷新资源的URL和待刷新资源的刷新时间。In the first aspect, an embodiment of the present invention provides a back-to-origin method in a content distribution network. The method includes the following steps: an edge cache node receives a cache refresh request sent by a control platform, and the cache refresh request carries a uniform resource locator of the resource to be refreshed URL, the edge cache node sends a back-to-origin request to the central cache node, and the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
由于回源请求携带有待刷新资源的刷新时间和待刷新资源的URL,中心缓存节点接收到回源请求之后,在待刷新资源的URL命中缓存的情况下,根据待刷新资源的刷新时间确认缓存的待刷新资源是否是源站进行资源更新之前的旧资源,可避免中心缓存节点在待刷新资源的URL命中缓存的情况下直接向边缘缓存节点发送旧资源的情况发生。Since the back-to-origin request carries the refresh time of the resource to be refreshed and the URL of the resource to be refreshed, after the central cache node receives the back-to-origin request, when the URL of the resource to be refreshed hits the cache, it will confirm the cached according to the refresh time of the resource to be refreshed. Whether the resource to be refreshed is the old resource before the source station performs the resource update can avoid the situation that the central cache node directly sends the old resource to the edge cache node when the URL of the resource to be refreshed hits the cache.
可选地,刷新时间携带在缓存刷新请求中,且刷新时间由控制平台设置。Optionally, the refresh time is carried in the cache refresh request, and the refresh time is set by the control platform.
可选地,控制平台根据用户在控制平台触发针对待刷新资源的URL的刷新指令的时间点作为待刷新资源的刷新时间。Optionally, the control platform uses the time when the user triggers the refresh instruction for the URL of the resource to be refreshed on the control platform as the refresh time of the resource to be refreshed.
刷新时间由控制平台统一设置,边缘缓存节点和中心缓存节点只需根据接收到的刷新时间进行判断,使得处理流程较为简单。The refresh time is uniformly set by the control platform, and the edge cache node and the central cache node only need to judge based on the received refresh time, which makes the processing flow relatively simple.
可选地,刷新时间是边缘缓存节点接收到缓存刷新请求的时间点。Optionally, the refresh time is the point in time when the edge cache node receives the cache refresh request.
相较于控制平台设置刷新时间,将边缘缓存节点接收到缓存刷新请求的时间点作为刷新时间,该刷新时间无需由控制平台发送至边缘缓存节点,因此可节约带宽,同时,由于控制平台设置的刷新时间需进行网络传输,因此边缘缓存节点接收到缓存刷新请求的时间点比控制平台设置的刷新时间晚,可以较为准确地反映待刷新资源在边缘缓存节点进行刷新的刷新时间。Compared with the refresh time set by the control platform, the time when the edge cache node receives the cache refresh request is used as the refresh time. The refresh time does not need to be sent by the control platform to the edge cache node, so bandwidth can be saved. At the same time, due to the setting of the control platform The refresh time needs to be transmitted over the network, so the time when the edge cache node receives the cache refresh request is later than the refresh time set by the control platform, which can more accurately reflect the refresh time of the resource to be refreshed at the edge cache node.
可选地,在边缘缓存节点向中心缓存节点发送回源请求之前,内容分发网络中的回源方法还包括以下步骤:边缘缓存节点接收客户端发送的第一资源访问请求,对应地,边缘缓存节点响应于第一资源访问请求向中心缓存节点发送回源请求。Optionally, before the edge cache node sends the back-to-origin request to the central cache node, the back-to-origin method in the content distribution network further includes the following steps: the edge cache node receives the first resource access request sent by the client, and correspondingly, the edge cache The node sends back the source request to the central cache node in response to the first resource access request.
由于CDN中,每次回源都要进行收费,因此,特定边缘缓存节点在接收到客户端发送的资源访问请求后才发出回源请求,无需所有边缘缓存节点均发出回源请求,可减少回源次数,节约费用。In CDN, a fee is charged for each return to the source. Therefore, a specific edge cache node sends a return request after receiving the resource access request sent by the client. There is no need for all edge cache nodes to issue a return request, which can reduce return to the source. Times, cost savings.
可选地,第一资源访问请求携带有待访问资源的URL,边缘缓存节点响应于资源访问请求向中心缓存节点发送回源请求,具体包括以下步骤:边缘缓存节点在确定待访问资源的URL与待刷新资源的URL匹配且待访问资源的URL没有命中缓存的情况下,向中心缓存节点发送回源请求。Optionally, the first resource access request carries the URL of the resource to be accessed, and the edge cache node sends back the source request to the central cache node in response to the resource access request, which specifically includes the following steps: the edge cache node determines the URL of the resource to be accessed and the resource to be accessed. When the URL of the refresh resource matches and the URL of the resource to be accessed does not hit the cache, a request is sent back to the central cache node.
边缘缓存节点在确定待访问资源的URL与待刷新资源的URL匹配且待访问资源的URL没有命中缓存的情况下,才向中心缓存节点发送携带有待刷新资源的URL和刷新时间的回源请求,可确保中心缓存节点能够在边缘缓存节点获取到缓存刷新请求之后,根据刷新时间来判断是否向源站节点回源,能避免向边缘缓存节点发送旧资源的情况发生。When the edge cache node determines that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache, it sends a back-to-origin request carrying the URL of the resource to be refreshed and the refresh time to the central cache node. It can be ensured that the central cache node can determine whether to return to the source site node according to the refresh time after the edge cache node obtains the cache refresh request, which can avoid sending old resources to the edge cache node.
可选地,资源访问请求携带有待访问资源的URL,边缘缓存节点响应于资源访问请求向中心缓存节点发送回源请求,还包括以下步骤:边缘缓存节点在确定待访问资源的URL与待刷新资源的URL匹配、待访问资源的URL命中缓存、且刷新时间晚于缓存时间的情况下,向中心缓存节点发送回源请求,其中缓存时间是边缘缓存节点缓存待访问资源的时间点。Optionally, the resource access request carries the URL of the resource to be accessed, and the edge cache node sends back the source request to the central cache node in response to the resource access request, and further includes the following steps: the edge cache node determines the URL of the resource to be accessed and the resource to be refreshed When the URL of the URL matches, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time, a back-to-origin request is sent to the central cache node, where the cache time is the time point at which the edge cache node caches the resource to be accessed.
边缘缓存节点在确定待访问资源的URL与待刷新资源的URL匹配、待访问资源的URL命中缓存、且刷新时间晚于缓存时间的情况下,才向中心缓存节点发送携带有待刷新资源的URL和刷新时间的回源请求,可确保中心缓存节点能够在边缘缓存节点获取到缓存刷新请求之后,根据刷新时间来判断是否向源站节点回源,能避免向边缘缓存节点发送旧资源的情况发生。When the edge cache node determines that the URL of the resource to be accessed matches the URL of the resource to be refreshed, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time, it sends the URL and URL of the resource to be refreshed to the central cache node. The refresh time return request can ensure that the central cache node can determine whether to return to the origin node based on the refresh time after the edge cache node obtains the cache refresh request, which can avoid sending old resources to the edge cache node.
可选地,边缘缓存节点设置有刷新表,边缘缓存节点接收控制平台发送的缓存刷新请求之后,该方法还包括以下步骤:边缘缓存节点在刷新表记录待刷新资源的URL和刷新时间。Optionally, the edge cache node is provided with a refresh table, and after the edge cache node receives the cache refresh request sent by the control platform, the method further includes the following steps: the edge cache node records the URL and refresh time of the resource to be refreshed in the refresh table.
通过刷新表记录待刷新资源的URL和刷新时间,边缘缓存节点仅需查询刷新表是否记录有待刷新资源的URL即可获知边缘缓存节点是否接收过控制平台发送的缓存刷新请求,能有效提高处理速度。By refreshing the table to record the URL and refresh time of the resource to be refreshed, the edge cache node only needs to query whether the refresh table records the URL of the resource to be refreshed to know whether the edge cache node has received the cache refresh request sent by the control platform, which can effectively improve the processing speed .
可选地,边缘缓存节点在刷新表记录待刷新资源的URL和刷新时间之后,该方法还包括:边缘缓存节点在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间。Optionally, after the edge cache node records the URL and refresh time of the resource to be refreshed in the refresh table, the method further includes: the edge cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time.
由于刷新表会占用存储空间和内存,该定时删除机制可节约边缘缓存节点的存储空间和内存资源。Since refreshing the table will occupy storage space and memory, the timing deletion mechanism can save the storage space and memory resources of edge cache nodes.
可选地,边缘缓存节点在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间之后,该方法还包括:边缘缓存节点接收客户端发送的第二资源访问请求,第二资源访问请求携带有待访问资源的URL,边缘缓存节点在确定待访问资源的URL不在刷新表且待访问资源的URL命中缓存的情况下,边缘缓存节点发送资源访问请求应答信息至客户端,资源访问请求应答信息携带有待访问资源。Optionally, after the edge cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time, the method further includes: the edge cache node receives a second resource access request sent by the client, and the second resource access The request carries the URL of the resource to be accessed. When the edge cache node determines that the URL of the resource to be accessed is not in the refresh table and the URL of the resource to be accessed hits the cache, the edge cache node sends the resource access request response information to the client, and the resource access request response Information carries resources to be accessed.
由于刷新表中没有记录待刷新资源的URL,因此边缘缓存节点在确定之前没接收过针对该URL的缓存刷新请求,此时可直接返回待访问资源至客户端。Since the URL of the resource to be refreshed is not recorded in the refresh table, the edge cache node has not received a cache refresh request for the URL before determining, and can directly return the resource to be accessed to the client at this time.
通过预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间,可以在待刷新资源在CDN全网刷新之后,保证待刷新资源的刷新纪录及时删除,从而避免影响针对待刷新资源的下一轮的缓存刷新请求。By deleting the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time, you can ensure that the refresh record of the resource to be refreshed is deleted in time after the resource to be refreshed is refreshed across the CDN network, thereby avoiding affecting the download of the resource to be refreshed. A round of cache refresh requests.
可选地,边缘缓存节点在确定待访问资源的URL与待刷新资源的URL相同,或在确定待刷新资源的URL是待访问资源的URL的前缀的情况下,确定待访问资源的URL与待刷新资源的URL匹配。Optionally, the edge cache node determines that the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, or when it is determined that the URL of the resource to be refreshed is the prefix of the URL of the resource to be accessed, determines the URL of the resource to be accessed and the URL of the resource to be refreshed. The URL of the refresh resource matches.
第二方面,本发明实施例提供一种内容分发网络中的回源方法,包括以下步骤:中心缓存节点接收边缘缓存节点发送的第一回源请求,第一回源请求携带有待刷新资源的URL和待刷新资源的刷新时间,中心缓存节点在待刷新资源的URL命中缓存的情况下,将刷新时间与待刷新资源的缓存时间进行比对,在确定刷新时间晚于缓存时间的情况下,向源站节点发送第二回源请求。In a second aspect, an embodiment of the present invention provides a back-to-origin method in a content distribution network, including the following steps: a central cache node receives a first back-to-origin request sent by an edge cache node, and the first back-to-origin request carries the URL of the resource to be refreshed And the refresh time of the resource to be refreshed, the central cache node compares the refresh time with the cache time of the resource to be refreshed when the URL of the resource to be refreshed hits the cache, and when it is determined that the refresh time is later than the cache time, The origin node sends a second back-to-origin request.
由于回源请求携带有待刷新资源的刷新时间和待刷新资源的URL,中心缓存节点接收到回源请求之后,在待刷新资源的URL命中缓存的情况下,根据待刷新资源的刷新时间确认缓存的待刷新资源是否是源站进行资源更新之前的旧资源,可避免中心缓存节点在待刷新资源的URL命中缓存的情况下直接向边缘缓存节点发送旧资源的情况发生。Since the back-to-origin request carries the refresh time of the resource to be refreshed and the URL of the resource to be refreshed, after the central cache node receives the back-to-origin request, when the URL of the resource to be refreshed hits the cache, it will confirm the cached according to the refresh time of the resource to be refreshed. Whether the resource to be refreshed is the old resource before the source station performs the resource update can avoid the situation that the central cache node directly sends the old resource to the edge cache node when the URL of the resource to be refreshed hits the cache.
可选地,刷新时间携带在边缘缓存节点从控制平台接收到的缓存刷新请求中,且刷新时间由控制平台设置。Optionally, the refresh time is carried in the cache refresh request received by the edge cache node from the control platform, and the refresh time is set by the control platform.
可选地,控制平台根据用户在控制平台触发针对待刷新资源的URL的刷新指令的时间点作为待刷新资源的刷新时间。Optionally, the control platform uses the time when the user triggers the refresh instruction for the URL of the resource to be refreshed on the control platform as the refresh time of the resource to be refreshed.
刷新时间由控制平台统一设置,边缘缓存节点和中心缓存节点只需根据接收到的刷新时间进行判断,使得处理流程较为简单。The refresh time is uniformly set by the control platform, and the edge cache node and the central cache node only need to judge based on the received refresh time, which makes the processing flow relatively simple.
可选地,刷新时间是边缘缓存节点接收到控制平台发送的第一缓存刷新请求的时间点。Optionally, the refresh time is the point in time when the edge cache node receives the first cache refresh request sent by the control platform.
相较于控制平台设置刷新时间,将边缘缓存节点接收到缓存刷新请求的时间点作为刷新时间,该刷新时间无需由控制平台发送至边缘缓存节点,因此可节约带宽,同时,由于控制平台设置的刷新时间需进行网络传输,因此边缘缓存节点接收到缓存刷新请求的时间点比控制平台设置的刷新时间晚,可以较为准确地反映待刷新资源在边缘缓存节点进行刷新的刷新时间。Compared with the refresh time set by the control platform, the time when the edge cache node receives the cache refresh request is used as the refresh time. The refresh time does not need to be sent by the control platform to the edge cache node, so bandwidth can be saved. At the same time, due to the setting of the control platform The refresh time needs to be transmitted over the network, so the time when the edge cache node receives the cache refresh request is later than the refresh time set by the control platform, which can more accurately reflect the refresh time of the resource to be refreshed at the edge cache node.
可选地,中心缓存节点向源站节点发送第二回源请求之前,该方法还包括:中心缓存节点接收控制平台发送的第二缓存刷新请求,第二缓存刷新请求携带有待刷新资源的URL,中心缓存节点判断接收到第二缓存刷新请求的时间点晚于缓存时间。Optionally, before the central cache node sends the second back-to-origin request to the source site node, the method further includes: the central cache node receives a second cache refresh request sent by the control platform, where the second cache refresh request carries the URL of the resource to be refreshed, The central cache node determines that the time when the second cache refresh request is received is later than the cache time.
中心缓存节点分别确认刷新时间晚于缓存时间,以及中心缓存节点判断接收到第二缓 存刷新请求的时间点晚于缓存时间的情况下,才向源站节点发送第二回源请求,可有效减少回源次数。When the central cache node confirms that the refresh time is later than the cache time, and the central cache node judges that the time when the second cache refresh request is received is later than the cache time, it sends the second back-to-origin request to the origin node, which can effectively reduce Number of return to source.
可选地,中心缓存节点设置有刷新表,中心缓存节点接收边缘缓存节点发送的第一回源请求之后,该方法还包括:中心缓存节点在刷新表记录待刷新资源的URL和刷新时间。Optionally, the central cache node is provided with a refresh table, and after the central cache node receives the first back-to-origin request sent by the edge cache node, the method further includes: the central cache node records the URL and refresh time of the resource to be refreshed in the refresh table.
通过刷新表记录待刷新资源的URL和刷新时间,中心缓存节点仅需查询刷新表是否记录有待刷新资源的URL即可获知中心缓存节点是否接收过控制平台发送的缓存刷新请求,能有效提高处理速度。By refreshing the table to record the URL and refresh time of the resource to be refreshed, the central cache node only needs to query whether the refresh table records the URL of the resource to be refreshed to know whether the central cache node has received the cache refresh request sent by the control platform, which can effectively improve the processing speed .
可选地,中心缓存节点在刷新表记录待刷新资源的URL和刷新时间之后,该方法还包括:中心缓存节点在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间。Optionally, after the central cache node records the URL and refresh time of the resource to be refreshed in the refresh table, the method further includes: the central cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time.
由于刷新表会占用存储空间和内存,该定时删除机制可节约边缘缓存节点的存储空间和内存资源。Since refreshing the table will occupy storage space and memory, the timing deletion mechanism can save the storage space and memory resources of edge cache nodes.
可选地,中心缓存节点在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间之后,该方法还包括:中心缓存节点接收边缘缓存节点发送的第三回源请求,第三回源请求携带有待刷新资源的URL,中心缓存节点在确定待刷新资源的URL不在刷新表且待刷新资源的URL命中缓存的情况下,发送资源访问请求应答信息至边缘缓存节点,资源访问请求应答信息携带有待刷新资源。Optionally, after the central cache node deletes the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time, the method further includes: the central cache node receives the third source request sent by the edge cache node, and the third time The source request carries the URL of the resource to be refreshed. When the central cache node determines that the URL of the resource to be refreshed is not in the refresh table and the URL of the resource to be refreshed hits the cache, it sends resource access request response information to the edge cache node, and the resource access request response information Carry resources to be refreshed.
由于刷新表中没有记录待刷新资源的URL,因此中心缓存节点在确定之前没接收过针对该URL的缓存刷新请求,此时可直接返回待访问资源至客户端。Since the URL of the resource to be refreshed is not recorded in the refresh table, the central cache node has not received a cache refresh request for the URL before determining, and can directly return the resource to be accessed to the client at this time.
通过预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间,可以在待刷新资源在CDN全网刷新之后,保证待刷新资源的刷新纪录及时删除,从而避免影响针对待刷新资源的下一轮的缓存刷新请求。By deleting the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time, you can ensure that the refresh record of the resource to be refreshed is deleted in time after the resource to be refreshed is refreshed across the CDN network, thereby avoiding affecting the download of the resource to be refreshed. A round of cache refresh requests.
第三方面,本发明实施例提供一种边缘缓存节点,包括:接收模块,用于接收控制平台发送的缓存刷新请求,缓存刷新请求携带有待刷新资源的统一资源定位符URL,发送模块,用于向中心缓存节点发送回源请求,回源请求携带有待刷新资源的URL和待刷新资源的刷新时间。In a third aspect, an embodiment of the present invention provides an edge cache node, including: a receiving module for receiving a cache refresh request sent by a control platform, the cache refresh request carrying a uniform resource locator URL of the resource to be refreshed, and a sending module for Send a back-to-origin request to the central cache node, and the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
第三方面或第三方面任意一种实现方式是第一方面或第一方面任意一种实现方式对应的装置实现,第一方面或第一方面任意一种实现方式中的描述适用于第三方面或第三方面任意一种实现方式,在此不再赘述。The third aspect or any implementation manner of the third aspect is implemented by the device corresponding to the first aspect or any implementation manner of the first aspect, and the description in the first aspect or any implementation manner of the first aspect is applicable to the third aspect Or any implementation of the third aspect, which will not be repeated here.
第四方面,本发明实施例提供一种中心缓存节点,包括:接收模块,用于接收边缘缓存节点发送的第一回源请求,第一回源请求携带有待刷新资源的URL和待刷新资源的刷新时间,判断模块,用于确认待刷新资源的URL命中缓存,刷新时间晚于待刷新资源的缓存时间,发送模块,用于在判断模块确认待刷新资源的URL命中缓存刷新时间晚于缓存时间的情况下,向源站节点发送第二回源请求。In a fourth aspect, an embodiment of the present invention provides a central cache node, including: a receiving module, configured to receive a first back-to-origin request sent by an edge cache node, the first back-to-origin request carrying the URL of the resource to be refreshed and the resource to be refreshed Refresh time, the judgment module, used to confirm that the URL of the resource to be refreshed hits the cache, and the refresh time is later than the cache time of the resource to be refreshed, and the sending module is used to confirm in the judgment module that the URL of the resource to be refreshed hits the cache refresh time later than the cache time In the case of sending a second back-to-origin request to the source site node.
第四方面或第四方面任意一种实现方式是第二方面或第二方面任意一种实现方式对应的装置实现,第二方面或第二方面任意一种实现方式中的描述适用于第四方面或第四方面任意一种实现方式,在此不再赘述。The fourth aspect or any implementation manner of the fourth aspect is implemented by the device corresponding to the second aspect or any implementation manner of the second aspect, and the description in the second aspect or any implementation manner of the second aspect is applicable to the fourth aspect Or any implementation manner of the fourth aspect, which will not be repeated here.
第五方面,本发明实施例提供一种中心缓存节点,包括存储器和处理器,存储器存储有程序指令,处理器运行程序指令,以执行第一方面或第一方面任意一种实现方式中的方法。In a fifth aspect, an embodiment of the present invention provides a central cache node, including a memory and a processor, the memory stores program instructions, and the processor runs the program instructions to execute the method in the first aspect or any one of the first aspects. .
第六方面,本发明实施例提供一种边缘缓存节点,包括存储器和处理器,存储器存储有程序指令,处理器运行程序指令,以执行第二方面或第二方面任意一种实现方式中的方法。In a sixth aspect, an embodiment of the present invention provides an edge cache node, including a memory and a processor, the memory stores program instructions, and the processor runs the program instructions to execute the method in the second aspect or any one of the implementation manners of the second aspect .
第七方面,本发明实施例提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,当指令在计算机上运行时,使得计算机以执行第一方面或第一方面任意一种实现方式中的方法。In a seventh aspect, an embodiment of the present invention provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions run on a computer, the computer can execute the first aspect or any one of the first aspects. The method in the way.
第八方面,本发明实施例提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,当指令在计算机上运行时,使得计算机执行第二方面或第二方面任意一种实现方式中的方法。In an eighth aspect, an embodiment of the present invention provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are run on a computer, the computer executes the second aspect or any one of the implementation manners of the second aspect. Method in.
附图说明Description of the drawings
图1是根据本发明实施例的CDN系统的系统结构图;Figure 1 is a system structure diagram of a CDN system according to an embodiment of the present invention;
图2是根据本发明实施例的CDN的资源刷新方法的流程图;Figure 2 is a flowchart of a CDN resource refresh method according to an embodiment of the present invention;
图3是根据本发明实施例的控制平台提供的CDN控制界面的示意图;Figure 3 is a schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention;
图4是根据本发明实施例的控制平台提供的CDN控制界面的另一示意图;4 is another schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention;
图5是根据本发明实施例的控制平台提供的CDN控制界面的另一示意图;Fig. 5 is another schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention;
图6是根据本发明实施例的内容分发网络的缓存刷新方法的流程图;Fig. 6 is a flowchart of a cache refresh method of a content distribution network according to an embodiment of the present invention;
图7是根据本发明实施例的CDN中的回源方法的流程图;Fig. 7 is a flowchart of a back-to-source method in a CDN according to an embodiment of the present invention;
图8是根据本发明实施例的CDN中的回源方法的另一流程图;Fig. 8 is another flowchart of a back-to-source method in a CDN according to an embodiment of the present invention;
图9是根据本发明实施例的内容分发网络的缓存刷新方法的数据交互图;FIG. 9 is a data interaction diagram of a cache refresh method of a content distribution network according to an embodiment of the present invention;
图10是根据本发明实施例的内容分发网络的缓存刷新方法的另一数据交互图;10 is another data interaction diagram of the cache refresh method of the content distribution network according to the embodiment of the present invention;
图11是本发明实施例的边缘缓存节点的装置结构示意图;11 is a schematic diagram of the device structure of an edge cache node according to an embodiment of the present invention;
图12是本发明实施例的中心缓存节点的装置结构示意图;FIG. 12 is a schematic diagram of an apparatus structure of a central cache node according to an embodiment of the present invention;
图13是本发明实施例的边缘缓存节点的另一装置结构示意图;13 is a schematic diagram of another device structure of an edge cache node according to an embodiment of the present invention;
图14是本发明实施例的中心缓存节点的另一装置结构示意图。FIG. 14 is a schematic diagram of another device structure of a central cache node according to an embodiment of the present invention.
具体实施方式Detailed ways
首先,本发明实施例涉及的术语解释如下:First, the terms involved in the embodiments of the present invention are explained as follows:
源站节点:设置有源站的节点,作为内容分发网络的数据源,该节点可例如为提供网页浏览服务的服务器,内容分发网络的缓存节点所缓存的数据来源自源站节点,其中这些数据包括网页、视频、音频、动画等资源,源站节点设置有域名,用户可根据域名访问源站节点或缓存有源站的资源的缓存节点,举例而言,源站节点设置的域名为appdl.hicloud.com,客户端通过访问appdl.hicloud.com来访问源站。Source station node: Set the node of the source station as the data source of the content distribution network. This node can be, for example, a server that provides web browsing services. The data cached by the cache node of the content distribution network comes from the source station node. Including resources such as webpages, videos, audios, animations, the origin site node is set with a domain name, and users can access the origin site node or cache node that caches the resources of the origin site according to the domain name. For example, the domain name set for the origin site node is appdl. hicloud.com, the client accesses the origin site by visiting appdl.hicloud.com.
统一资源定位符URL:在万维网(World Wide Web,WWW)上,每一信息资源都有统一的且在网上唯一的地址,该地址就叫URL,URL由三部分组成:资源类型、存放资源的主机域名、资源文件名,URL与源站的资源具有一一对应关系。Uniform Resource Locator URL: On the World Wide Web (WWW), each information resource has a unified and unique address on the Internet. This address is called URL. The URL consists of three parts: resource type and resource storage The host domain name, resource file name, and URL have a one-to-one correspondence with the source site's resources.
URL的一般语法格式为:The general syntax format of URL is:
(带方括号[]的为可选项):(The ones with square brackets [] are optional):
protocol://hostname[:port]/pathprotocol://hostname[:port]/path
格式说明:Format description:
protocol为协议,用于指定使用的传输协议,例如为HTTP协议,格式为HTTP://,或HTTPS://,ftp协议,格式为FTP://,MMS协议,格式为MMS://,ed2k协议,格式为ed2k://,最常用的是HTTP协议,HTTP协议也是目前WWW中应用最广的协议,URL没有显示protocol,表示为HTTP协议。protocol is the protocol, used to specify the transmission protocol used, for example, HTTP protocol, format is HTTP://, or HTTPS://, ftp protocol, format is FTP://, MMS protocol, format is MMS://, ed2k protocol, the format is ed2k://, the most commonly used is the HTTP protocol, which is also the most widely used protocol in the WWW at present, the URL does not display the protocol, which means it is the HTTP protocol.
Hostname为主机名,是指存放资源的服务器的主机名、IP地址或域名,例如为域名:appdl.hicloud.com。Hostname is the host name, which refers to the host name, IP address, or domain name of the server that stores the resource, for example, the domain name: appdl.hicloud.com.
port为端口号,为整数,可选,省略时使用方案的默认端口,各种传输协议都有默认的端口号,如http的默认端口为80。如果输入时省略,则使用默认端口号。有时候出于安全或其他考虑,可以在服务器上对端口进行重定义,即采用非标准端口号,此时,URL中就不能省略端口号这一项。port is a port number, an integer, and optional. When omitted, the default port of the scheme is used. Various transmission protocols have default port numbers. For example, the default port of http is 80. If omitted, the default port number will be used. Sometimes for security or other considerations, you can redefine the port on the server, that is, use a non-standard port number. In this case, the port number cannot be omitted from the URL.
path为路径,由零或多个“/”符号隔开的字符串,一般用来表示主机上的一个目录或文件地址。例如为TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt,表示主机的目录TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/下的文件1.txt。path is a path, a string separated by zero or more "/" symbols, generally used to represent a directory or file address on the host. For example, TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt, which means the file 1.txt under the directory TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/.
举例而言,一个完整的URL可表示如下:For example, a complete URL can be expressed as follows:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txtappdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt
表示域名为appdl.hicloud.com的主机中目录TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/下的文件1.txt。Indicates the file 1.txt in the directory TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/ in the host with the domain name appdl.hicloud.com.
可选地,URL也可以为TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/Optionally, the URL can also be TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/
表示域名为appdl.hicloud.com的主机中目录TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/Indicates the directory TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/ in the host with the domain name appdl.hicloud.com
客户端:用户访问源站或CDN所使用的终端设备,例如个人电脑、平板电脑、手机等。Client: The terminal device used by the user to access the origin site or CDN, such as personal computer, tablet computer, mobile phone, etc.
内容分发网络:包括多个缓存节点,缓存节点缓存有源站的部分或全部资源,多个缓存节点具体为边缘缓存节点和至少一个中心缓存节点,多个边缘缓存节点分布在不同的地域,多个边缘缓存节点的上级节点是一个中心缓存节点,中心缓存节点的上级节点是源站节点。Content distribution network: includes multiple cache nodes, which cache some or all of the resources of the active station. The multiple cache nodes are specifically edge cache nodes and at least one central cache node. Multiple edge cache nodes are distributed in different regions. The superior node of an edge cache node is a central cache node, and the superior node of the central cache node is the origin node.
域名系统(Domain Name System,DNS)服务器:客户端仅知道源站节点的域名,但为了使得客户端可以就近访问源站的资源,当客户端发出针对源站节点的域名的访问请求时,DNS服务器可将源站节点的域名转换为与客户端距离最近的边缘缓存节点的IP地址,并将该IP地址返回给客户端,客户端可根据该IP地址直接访问距离最近边缘缓存节点,从边缘缓存节点上获得要访问的域名对应的资源,值得注意的是,客户端发出的访问请求具体可携带有URL,该URL包括源站节点的域名和要访问的资源在源站节点的路径。Domain Name System (DNS) server: The client only knows the domain name of the origin site node, but in order to enable the client to access the resources of the origin site nearby, when the client sends an access request for the origin site node’s domain name, DNS The server can convert the domain name of the origin site node to the IP address of the edge cache node closest to the client, and return the IP address to the client. The client can directly access the closest edge cache node based on the IP address. The cache node obtains the resource corresponding to the domain name to be accessed. It is worth noting that the access request sent by the client may specifically carry a URL, which includes the domain name of the source site node and the path of the resource to be accessed on the source site node.
回源:如上所述,当边缘缓存节点没有缓存有URL对应的资源或确认缓存的资源是旧的资源,需向上级的中心缓存节点回源,具体地,边缘缓存节点向中心缓存节点发送回 源请求,中心缓存节点响应于回源请求,中心缓存节点在缓存有URL对应的资源的情况下,向边缘缓存节点发送回源应答信息,回源应答信息携带有URL对应的资源,边缘缓存节点缓存该资源,并返回该资源至客户端。Back to the source: As mentioned above, when the edge cache node does not cache the resource corresponding to the URL or confirms that the cached resource is an old resource, it needs to return to the source to the superior central cache node. Specifically, the edge cache node sends back to the central cache node Source request, the central cache node responds to the back-to-origin request, and the central cache node sends back the source response information to the edge cache node when the resource corresponding to the URL is cached. The back-to-origin response information carries the resource corresponding to the URL, and the edge cache node Cache the resource and return it to the client.
进一步,当中心缓存节点没有缓存有URL对应的资源或确认缓存的资源是旧的资源,也需向上级的源站节点进行回源,具体地,中心缓存节点向上级的源站节点发送另一回源请求,上级的源站节点响应于该回源请求在本地缓存有URL对应的资源的情况下,向中心缓存节点发送另一回源应答信息,该回源应答信息携带有URL对应的资源,中心缓存节点缓存该资源,并返回该资源至边缘缓存节点,Further, when the central cache node does not cache the resource corresponding to the URL or confirms that the cached resource is an old resource, it also needs to return to the source node of the superior. Specifically, the central cache node sends another source to the superior source node. For a back-to-origin request, in response to the back-to-origin request, the higher-level source site node sends another back-to-origin response message to the central cache node when the resource corresponding to the URL is cached locally. , The central cache node caches the resource, and returns the resource to the edge cache node,
控制平台:用于管理CDN,控制平台分别与各缓存节点建立有数据连接,提供CDN控制界面,用户可在更新源站节点上的资源之后,登陆控制平台的CDN控制界面,提交刷新任务至控制平台,使得控制平台向CDN的所有缓存节点发送针对特定URL的缓存刷新请求,缓存刷新请求用于指示CDN的所有缓存节点记录该URL对应资源已经被更新。控制平台可设置为独立的服务器上,或设置在任一缓存节点,或设置在虚拟机上,本发明实施例不作限定。Control platform: used to manage the CDN, the control platform has established data connections with each cache node, and provides a CDN control interface. After updating the resources on the source site node, the user can log in to the CDN control interface of the control platform and submit the refresh task to the control The platform enables the control platform to send a cache refresh request for a specific URL to all cache nodes of the CDN. The cache refresh request is used to instruct all cache nodes of the CDN to record that the resource corresponding to the URL has been updated. The control platform can be set on an independent server, or on any cache node, or on a virtual machine, which is not limited in the embodiment of the present invention.
在一种可能的实现方式中,控制平台可例如为内容管理系统(Content Management System,CMS),CMS用于信息管理、信息发布和网站维护而开发的基于web交互模式的内容管理和发布应用系统。CMS包括了信息采集、整理、分类、审核、发布和管理的全过程,具备完善的信息管理和发布管理功能,用户可以随时方便地提交需要发布的信息而无须掌握复杂的技术。In a possible implementation, the control platform may be, for example, a content management system (Content Management System, CMS). The CMS is used for information management, information publishing, and website maintenance, and is a web interactive content management and publishing application system developed . CMS includes the entire process of information collection, sorting, classification, review, release and management. It has complete information management and release management functions. Users can easily submit the information that needs to be released at any time without having to master complicated technologies.
缓存:在本发明实施例中,缓存是指将源站的全部或部分资源存储到边缘缓存节点和中心缓存节点的本地存储器中。Caching: In the embodiment of the present invention, caching refers to storing all or part of the source station's resources in the local memory of the edge cache node and the central cache node.
缓存表:缓存表记录了已经缓存到本地存储器的资源的URL、缓存时间以及URL对应的资源在本地存储器的存储地址,其中缓存时间是缓存节点将资源缓存到本地存储器的时间点。Cache table: The cache table records the URL, cache time, and the storage address of the resource corresponding to the URL in the local memory of the resource that has been cached in the local storage. The cache time is the time point when the cache node caches the resource in the local storage.
命中缓存:是指在缓存表中查询到URL的情况,命中缓存说明URL对应的资源存储在本地存储器,当没有命中缓存时,说明URL对应的资源没有存储在本地存储器。Hit cache: refers to the situation where the URL is queried in the cache table. A hit cache indicates that the resource corresponding to the URL is stored in the local storage. When the cache is not hit, it indicates that the resource corresponding to the URL is not stored in the local storage.
刷新表:刷新表包括待刷新资源的URL和待刷新资源的刷新时间。Refresh table: The refresh table includes the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
资源:包括网页、视频、音频、动画等数据。Resources: including web pages, videos, audios, animations and other data.
以下请参见图1,图1是根据本发明实施例的CDN系统的系统结构图,如图1所示,CDN系统包括源站节点10、控制平台20、内容分发网络CDN、客户端101-105。Please refer to Figure 1 below. Figure 1 is a system structure diagram of a CDN system according to an embodiment of the present invention. As shown in Figure 1, the CDN system includes an origin node 10, a control platform 20, a content distribution network CDN, and clients 101-105. .
内容分发网络CDN包括中心缓存节点60-61以及边缘缓存节点70-74,值得注意的是,在其他实施例中,中心缓存节点的数量不仅限于2个,可以是其他正整数,边缘缓存缓存节点的数量也不限于5个,可以是其他正整数。The content delivery network CDN includes central cache nodes 60-61 and edge cache nodes 70-74. It is worth noting that in other embodiments, the number of central cache nodes is not limited to two, and can be other positive integers. Edge cache cache nodes The number of is not limited to 5, it can be other positive integers.
边缘缓存节点设置在不同的地域,举例而言,边缘缓存节点70可设置在华南地区,边缘缓存节点71设置在华中地区,边缘缓存节点72设置在华西地区,边缘缓存节点73设置在华北地区,边缘缓存节点74设置在华东地区,边缘缓存节点70-72的上级节点是中心缓存节点60,边缘缓存节点73-74的上级节点是中心缓存节点61,中心缓存节点60-61的上级节点是源站节点10。Edge cache nodes are located in different regions. For example, edge cache nodes 70 can be located in South China, edge cache nodes 71 are located in Central China, edge cache nodes 72 are located in West China, and edge cache nodes 73 are located in North China. The edge cache node 74 is located in East China. The upper node of the edge cache node 70-72 is the central cache node 60, the upper node of the edge cache node 73-74 is the central cache node 61, and the upper node of the central cache node 60-61 is the source Station node 10.
举例而言,客户端101位于华南地区,因此客户端101与边缘缓存节点70的距离最近,客户端102位于华中地区,因此客户端102与边缘缓存节点71在同一区域,客户端103位于华西地区,因此客户端103与边缘缓存节点72在同一区域,客户端104位于华北地区,因此客户端104与边缘缓存节点73在同一区域,客户端105位于华东地区,因此客户端105与边缘缓存节点74在同一区域。For example, client 101 is located in South China, so the distance between client 101 and edge cache node 70 is the closest, client 102 is located in Central China, so client 102 and edge cache node 71 are in the same area, and client 103 is located in West China. Therefore, the client 103 and the edge cache node 72 are in the same area, and the client 104 is located in North China. Therefore, the client 104 and the edge cache node 73 are in the same area. The client 105 is located in East China. Therefore, the client 105 and the edge cache node 74 are located in the same area. In the same area.
值得注意的是,CDN系统还包括DNS节点(图未示),DNS节点记录有客户端的IP地址与与客户端距离最近的边缘缓存节点的IP地址的对应关系。举例而言,客户端101发出针对源站URL的DNS请求,DNS节点根据DNS请求携带的源IP地址(即客户端101的IP地址)从上述对应关系中获取边缘缓存节点70的IP地址,并向客户端101返回该IP地址,客户端101可向边缘缓存节点70发送携带有待访问资源的URL的资源访问请求,当边缘缓存节点70缓存有待访问资源时,边缘缓存节点70向客户端101返回缓存的待访问资源,从而实现客户端就近访问待访问资源。It is worth noting that the CDN system also includes a DNS node (not shown in the figure). The DNS node records the correspondence between the client's IP address and the IP address of the edge cache node closest to the client. For example, the client 101 sends a DNS request for the URL of the source site, and the DNS node obtains the IP address of the edge cache node 70 from the above correspondence according to the source IP address carried in the DNS request (that is, the IP address of the client 101), and Return the IP address to the client 101, and the client 101 can send a resource access request carrying the URL of the resource to be accessed to the edge cache node 70. When the edge cache node 70 caches the resource to be accessed, the edge cache node 70 returns to the client 101 Cache the resources to be accessed, so that the client can access the resources to be accessed nearby.
承接上例,若边缘缓存节点70没有缓存有待访问资源时,向上级的中心缓存节点60发送回源请求,若中心缓存节点60缓存有源站URL对应的资源时,向边缘缓存节点70返回该资源,若中心缓存节点60也没有缓存有源站URL对应的资源,则中心缓存节点60向源站发送另一回源请求。Continuing the above example, if the edge cache node 70 does not cache the resource to be accessed, the central cache node 60 at the higher level sends back the source request. If the central cache node 60 caches the resource corresponding to the URL of the source site, it returns the request to the edge cache node 70 Resources. If the central cache node 60 does not cache the resource corresponding to the URL of the source site, the central cache node 60 sends another source request to the source site.
基于图1所示的CDN系统,用户在源站节点10对源站的特定URL对应的资源进行更新时,例如更新特定网页的图片,在源站更新特定URL的资源之后,若CDN的缓存节点没有对应更新该特定URL对应的资源,则客户端有可能从边缘缓存节点接收到更新之前的旧资源。Based on the CDN system shown in Figure 1, when the user updates the resource corresponding to the specific URL of the origin site at the origin site node 10, for example, updates the picture of a specific webpage, after the origin site updates the resources of the specific URL, if the CDN cache node If the resource corresponding to the specific URL is not updated, the client may receive the old resource before the update from the edge cache node.
为解决上述技术问题,在一种可能的实现方式中,用户在源站节点10对源站的特定URL对应的资源进行更新之后,用户登录控制平台20提供的CDN控制界面输入该URL并发出针对该URL的刷新命令,该URL为待刷新资源的URL。In order to solve the above technical problems, in a possible implementation manner, after the user updates the resource corresponding to the specific URL of the origin site at the origin site node 10, the user logs in to the CDN control interface provided by the control platform 20, enters the URL and sends out the target The refresh command of the URL, the URL is the URL of the resource to be refreshed.
控制控制平台20首先向中心缓存节点60-61发送缓存刷新请求,其中该缓存刷新请求携带有待刷新资源的URL,待刷新资源的URL是上述更新资源对应的源站的特定URL,中心缓存节点60-61分别接收到缓存刷新请求之后,记录待刷新资源已经在源站节点被刷新,并向控制平台20返回缓存更新成功信息。The control and control platform 20 first sends a cache refresh request to the central cache node 60-61, where the cache refresh request carries the URL of the resource to be refreshed. The URL of the resource to be refreshed is the specific URL of the source station corresponding to the above-mentioned updated resource. The central cache node 60 -61 After receiving the cache refresh request, it records that the resource to be refreshed has been refreshed at the source site node, and returns the cache update success message to the control platform 20.
控制平台20分别接收到中心缓存节点70-74发送的缓存更新成功信息之后,再向边缘缓存节点70-74发送缓存刷新请求,边缘缓存节点60-61分别接收到缓存刷新请求之后,记录待刷新资源已经在源站被刷新,向控制平台20返回缓存更新成功信息,控制平台20分别接收到边缘缓存节点70-74发送的缓存更新成功信息之后,确认所有缓存节点中待刷新资源已经被更新,向用户提示CDN中待刷新资源已经更新成功。After the control platform 20 respectively receives the cache update success information sent by the central cache nodes 70-74, it then sends a cache refresh request to the edge cache nodes 70-74. After the edge cache nodes 60-61 respectively receive the cache refresh request, the record is to be refreshed. The resource has been refreshed at the origin site, and the cache update success information is returned to the control platform 20. After the control platform 20 receives the cache update success information sent by the edge cache nodes 70-74, it confirms that the resources to be refreshed in all cache nodes have been updated. The user is prompted that the resources to be refreshed in the CDN have been successfully updated.
在该种可能的实现方式中,边缘缓存节点在记录待刷新资源已经在源站被刷新之后,在接收到客户端发送的针对待刷新资源的URL的资源访问请求时,即便自身缓存有待刷新资源,也不会向客户端发送这些资源,而是向中心缓存节点发送回源请求。In this possible implementation, after the edge cache node records that the resource to be refreshed has been refreshed at the origin site, when receiving a resource access request for the URL of the resource to be refreshed sent by the client, even if its own cache has the resource to be refreshed , It will not send these resources to the client, but send back the source request to the central cache node.
同理,中心缓存节点在记录待刷新资源已经在源站被刷新之后,在接收到边缘缓存节点发送的针对待刷新资源的URL的资源访问请求时,即便自身缓存有待刷新资源,也不会向边缘缓存节点发送待刷新资源,而是向源站节点发送另一回源请求,源站节点根据该回源请求向中心缓存节点发送用户更新后的待刷新资源,中心缓存节点缓存该待刷新资 源,并向边缘缓存节点发送待刷新资源,并且由边缘缓存节点向客户端提供待刷新资源。In the same way, after the central cache node records that the resource to be refreshed has been refreshed at the origin site, when it receives a resource access request for the URL of the resource to be refreshed sent by the edge cache node, it will not send it to the The edge cache node sends the resource to be refreshed, but sends another back-to-origin request to the origin node. The origin node sends the user's updated resource to be refreshed to the central cache node according to the back-to-origin request, and the central cache node caches the resource to be refreshed , And send the resource to be refreshed to the edge cache node, and the edge cache node provides the resource to be refreshed to the client.
由于控制平台先向中心缓存节点发送缓存刷新请求,在确保中心缓存节点记录了待刷新资源已经被更新之后,再向边缘缓存节点发送缓存刷新请求,因此可避免边缘缓存节点先接收到缓存刷新请求,中心缓存节点后接收到缓存刷新请求的情况,该情况会造成客户端从中心缓存节点拉取到旧资源的情况发生。Since the control platform first sends a cache refresh request to the central cache node, and after ensuring that the central cache node records that the resource to be refreshed has been updated, it sends a cache refresh request to the edge cache node, thus avoiding the edge cache node from receiving the cache refresh request first If the central cache node receives a cache refresh request, this situation will cause the client to pull old resources from the central cache node.
具体而言,边缘缓存节点接收到控制平台发送的缓存刷新请求,并记录待刷新资源已经在源站被刷新之后,若此时接收到客户端发送的针对待刷新资源的URL的资源访问请求,即便边缘缓存节点缓存有待刷新资源,但由于该资源是更新前的资源,因此不能返回给客户端,边缘缓存节点向上级的中心缓存节点发送针对待刷新资源的URL的回源请求,若此时上级的中心缓存节点还没接收到控制平台发送的缓存刷新请求,并在本地缓存有源站更新之前的待刷新资源,上级的中心缓存节点会针对该回源请求向边缘缓存节点返回本地缓存的待刷新资源,然而由于上级的中心缓存节点并没有接收到控制平台发送的缓存刷新请求,因此本地缓存的待刷新资源是源站更新之前的旧的资源,边缘缓存节点会向客户端返回旧的待刷新资源,从而使得客户端所接收到的资源不是源站更新之后的最新资源。Specifically, the edge cache node receives the cache refresh request sent by the control platform and records that after the resource to be refreshed has been refreshed at the origin site, if it receives a resource access request for the URL of the resource to be refreshed from the client at this time, Even if the edge cache node caches a resource to be refreshed, it cannot be returned to the client because the resource is a resource before the update. The edge cache node sends a return request for the URL of the resource to be refreshed to the upper-level central cache node. The upper-level central cache node has not yet received the cache refresh request sent by the control platform, and locally caches the resources to be refreshed before the source station is updated. The upper-level central cache node will return the local cache to the edge cache node for the return request. Resources to be refreshed. However, because the higher-level central cache node has not received the cache refresh request sent by the control platform, the locally cached resources to be refreshed are the old resources before the source site is updated, and the edge cache nodes will return the old ones to the client The resource to be refreshed, so that the resource received by the client is not the latest resource after the source station is updated.
因此,控制平台先向中心缓存节点发送缓存刷新请求,在确保中心缓存节点记录了待刷新资源已经被更新之后,再向边缘缓存节点发送缓存刷新请求,可确保客户端从中心缓存节点拉取到旧资源的情况不会发生。但是,由于控制平台需要等待所有的中心缓存节点返回缓存更新成功信息之后,才能发送缓存刷新请求至边缘缓存节点,且要等待所有的边缘缓存节点返回缓存更新成功信息之后,才能确认CDN更新成功,所花费的时间较多,用户体验不佳。Therefore, the control platform first sends a cache refresh request to the central cache node, and after ensuring that the central cache node records that the resource to be refreshed has been updated, it sends a cache refresh request to the edge cache node to ensure that the client pulls from the central cache node. The situation with old resources will not happen. However, since the control platform needs to wait for all central cache nodes to return cache update success information before sending cache refresh requests to edge cache nodes, and wait for all edge cache nodes to return cache update success information before confirming the success of the CDN update, It takes more time and the user experience is not good.
以下将基于图1所示的CDN系统,介绍本发明实施例的另一种可能的实现方式,在该种实现方式中,控制平台无论何时发送缓存刷新请求至CDN中所有的中心缓存节点和边缘缓存节点,均可确保客户端从中心缓存节点拉取到旧资源的情况不会发生。Hereinafter, based on the CDN system shown in FIG. 1, another possible implementation manner of the embodiment of the present invention will be introduced. In this implementation manner, the control platform sends a cache refresh request to all central cache nodes in the CDN and Edge cache nodes can ensure that the client pulls old resources from the central cache node will not happen.
首先请参见图2,图2是根据本发明实施例的CDN的资源刷新方法的流程图,该方法的执行主体是控制平台20,如图2所示,该方法包括以下步骤:First, please refer to FIG. 2. FIG. 2 is a flowchart of a CDN resource refresh method according to an embodiment of the present invention. The execution body of the method is the control platform 20. As shown in FIG. 2, the method includes the following steps:
步骤111:控制平台20获取待刷新资源的URL。Step 111: The control platform 20 obtains the URL of the resource to be refreshed.
举例而言,请参见图3,图3是根据本发明实施例的控制平台提供的CDN控制界面的示意图,如图3所示,该CDN控制界面提供刷新选项,用户可输入待刷新资源的URL,例如为appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/,并点击“点击刷新”选项,控制平台20即可从CDN控制界面获取用户输入的待刷新资源的URL。For example, please refer to Figure 3. Figure 3 is a schematic diagram of a CDN control interface provided by a control platform according to an embodiment of the present invention. As shown in Figure 3, the CDN control interface provides refresh options, and the user can enter the URL of the resource to be refreshed. , For example, appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/, and click the "click to refresh" option, the control platform 20 can obtain the user input to be refreshed resources from the CDN control interface URL.
其中,among them,
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt表示源站appdl.hicloud.com的目录TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/中的1.txt,需刷新该目录中的所有子目录和文件。appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt represents the directory of the origin site appdl.hicloud.com TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node 1.txt in /, you need to refresh all subdirectories and files in this directory.
值得注意的是,CDN控制界面还可提供回源报文设置选项,用户可选择设置回源报 文头,此时示出图4所示的界面,图4是根据本发明实施例的控制平台提供的CDN控制界面的另一示意图,如图4所示,在该界面可设置超文本传输协议报文头(HyperText Transfer Protocol,HTTP header),用户可选择在边缘缓存节点向中心缓存节点发送的回源请求的报文头添加刷新时间,该刷新时间是边缘缓存节点接收到第一缓存刷新请求(下文将会具体说明)的时间点。It is worth noting that the CDN control interface can also provide back-to-source message setting options. The user can choose to set the back-to-source message header. At this time, the interface shown in Figure 4 is shown, which is a control platform according to an embodiment of the present invention. Another schematic diagram of the provided CDN control interface is shown in Figure 4. In this interface, you can set the HyperText Transfer Protocol (HTTP header), and the user can choose to send from the edge cache node to the central cache node. A refresh time is added to the header of the back-to-origin request, and the refresh time is the time point when the edge cache node receives the first cache refresh request (which will be described in detail below).
步骤112:在用户点击“点击刷新”选项之后,控制平台20可在同一时间点发送携带有待刷新资源的URL的第一缓存刷新请求至边缘缓存节点70-75,发送携带有待刷新资源的URL的第二缓存刷新请求至中心缓存节点60-61。Step 112: After the user clicks the "click to refresh" option, the control platform 20 may send the first cache refresh request carrying the URL of the resource to be refreshed to the edge cache nodes 70-75 at the same time, and send the URL of the resource to be refreshed The second cache refresh request to the central cache node 60-61.
步骤113:控制平台20在接收到边缘缓存节点70-75根据第一缓存刷新请求返回的第一缓存刷新成功消息,且接收到中心缓存节点60-61根据第二缓存刷新请求返回的第二缓存刷新成功信息的情况下,提示待刷新资源刷新成功。Step 113: The control platform 20 receives the first cache refresh success message returned by the edge cache nodes 70-75 according to the first cache refresh request, and receives the second cache returned by the central cache node 60-61 according to the second cache refresh request In the case of successful refresh information, it prompts that the resource to be refreshed has been successfully refreshed.
举例而言,可参见图5,图5是根据本发明实施例的控制平台提供的CDN控制界面的另一示意图,图5示出待刷新资源的URL:For example, refer to FIG. 5, which is another schematic diagram of the CDN control interface provided by the control platform according to an embodiment of the present invention. FIG. 5 shows the URL of the resource to be refreshed:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/在CDN刷新成功。appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/ refreshed successfully in CDN.
在其他示例中,也可以将回源报文设置的功能默认设置于边缘缓存节点70-75中,用户无需在CDN控制界面上进行回源报文头设置,边缘缓存节点70-75默认在发送到上级中心会员节点的回源请求设置刷新时间。In other examples, the function of setting back-to-origin packets can also be set in edge cache nodes 70-75 by default. Users do not need to set back-to-origin packet headers on the CDN control interface, and edge cache nodes 70-75 are sending by default Set the refresh time for the return request to the member node of the superior center.
控制平台20发送携带有待刷新资源的URL的第一缓存刷新请求至边缘缓存节点70-75,发送携带有待刷新资源的URL的第二缓存刷新请求至中心缓存节点60-61时,无需等待边缘缓存节点的缓存刷新成功消息,因此可以提高CDN的URL刷新速度,从而提升用户体验。When the control platform 20 sends the first cache refresh request carrying the URL of the resource to be refreshed to the edge cache nodes 70-75, and sends the second cache refresh request carrying the URL of the resource to be refreshed to the central cache node 60-61, there is no need to wait for the edge cache The cache refresh success message of the node can improve the URL refresh speed of the CDN, thereby improving the user experience.
而以上的URL刷新方式,是通过在边缘缓存节点向中心缓存节点发送的回源请求的报文头添加刷新时间来保证边缘缓存节点不会从上级的中心缓存节点获取到旧的资源的,下文将详细介绍其原理。The above URL refresh method is to add refresh time to the header of the back-to-origin request sent by the edge cache node to the central cache node to ensure that the edge cache node will not obtain the old resources from the superior central cache node. The principle will be described in detail.
请参见图6,图6是根据本发明实施例的内容分发网络的缓存刷新方法的流程图,为清楚说明,该方法的执行主体为图1所示的CDN系统中的边缘缓存节点70,值得注意的是,图1所示的CDN系统中的其他边缘缓存节点也可执行该方法。Please refer to FIG. 6. FIG. 6 is a flowchart of a method for refreshing a cache of a content distribution network according to an embodiment of the present invention. For clarity, the method is executed by the edge cache node 70 in the CDN system shown in FIG. It is noted that other edge cache nodes in the CDN system shown in FIG. 1 can also perform this method.
该方法包括以下步骤:The method includes the following steps:
步骤201:边缘缓存节点70接收控制平台20发送的第一缓存刷新请求,第一缓存刷新请求携带有待刷新资源的URL。Step 201: The edge cache node 70 receives a first cache refresh request sent by the control platform 20, where the first cache refresh request carries the URL of the resource to be refreshed.
承上例,待刷新资源的URL可例如为:Following the above example, the URL of the resource to be refreshed can be, for example:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/。appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/.
其中,appdl.hicloud.com为源站节点的域名,Among them, appdl.hicloud.com is the domain name of the origin node,
TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/为源站节点的一个目录。TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/ is a directory of the origin node.
步骤202:边缘缓存节点70记录第一缓存刷新请求携带的待刷新资源的URL和该待 刷新资源的URL的刷新时间,并向控制平台20发送第一缓存刷新成功消息。Step 202: The edge cache node 70 records the URL of the resource to be refreshed carried in the first cache refresh request and the refresh time of the URL of the resource to be refreshed, and sends a first cache refresh success message to the control platform 20.
举例而言,该待刷新资源的URL的刷新时间是边缘缓存节点70接收到第一缓存刷新请求的时间点。For example, the refresh time of the URL of the resource to be refreshed is the point in time when the edge cache node 70 receives the first cache refresh request.
具体而言,边缘缓存节点70将待刷新资源的URL和刷新时间记录到本地的刷新表中。Specifically, the edge cache node 70 records the URL and refresh time of the resource to be refreshed in a local refresh table.
其中,边缘缓存节点70设置有刷新表,边缘缓存节点70接收控制平台20发送的第一缓存刷新请求之后,边缘缓存节点70在刷新表记录待刷新资源的URL和所述刷新时间,具体而言,记录待刷新资源的URL和所述刷新时间可作为一个条目记录在刷新表中。Wherein, the edge cache node 70 is provided with a refresh table. After the edge cache node 70 receives the first cache refresh request sent by the control platform 20, the edge cache node 70 records the URL of the resource to be refreshed and the refresh time in the refresh table, specifically , Record the URL of the resource to be refreshed and the refresh time can be recorded as an entry in the refresh table.
在本发明实施例中,边缘缓存节点70可在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间,举例而言,在待刷新资源为目录的情况下,可在一个月后删除记录有待刷新资源的URL和刷新时间的条目,在待刷新资源是文件的情况下,可在10秒后在刷新表删除待刷新资源的URL和刷新时间,由于刷新表会占用存储空间和内存,该定时删除机制可节约边缘缓存节点70的存储空间和内存资源。In the embodiment of the present invention, the edge cache node 70 may delete the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time. For example, when the resource to be refreshed is a directory, it may be one month later. Delete the entry that records the URL and refresh time of the resource to be refreshed. When the resource to be refreshed is a file, you can delete the URL and refresh time of the resource to be refreshed in the refresh table after 10 seconds, because refreshing the table will occupy storage space and memory The timing deletion mechanism can save the storage space and memory resources of the edge cache node 70.
进一步地,在待刷新资源是文件的情况下,边缘缓存节点70在刷新表记录待刷新资源的URL和刷新时间之后,若待刷新资源的URL命中缓存,边缘缓存节点70会在本地存储器删除待刷新资源,并删除缓存表中待刷新资源的URL所在的条目。Further, when the resource to be refreshed is a file, after the edge cache node 70 refreshes the table and records the URL and refresh time of the resource to be refreshed, if the URL of the resource to be refreshed hits the cache, the edge cache node 70 will delete the pending resource in the local storage. Refresh the resource and delete the entry in the cache table where the URL of the resource to be refreshed is located.
在待刷新资源是目录的情况下,边缘缓存节点70在刷新表记录待刷新资源的URL和刷新时间之后,若待刷新资源的URL命中缓存,由于目录下可能包括多个文件,边缘缓存节点70不会在本地存储器删除待刷新资源,不会删除缓存表中待刷新资源的URL所在的条目。In the case that the resource to be refreshed is a directory, after the edge cache node 70 records the URL and refresh time of the resource to be refreshed in the refresh table, if the URL of the resource to be refreshed hits the cache, since the directory may include multiple files, the edge cache node 70 The resource to be refreshed will not be deleted in the local storage, and the entry where the URL of the resource to be refreshed in the cache table is located will not be deleted.
步骤203:边缘缓存节点70接收客户端101发送的资源访问请求,资源访问请求携带有待访问资源的URL,该资源访问请求用于请求待访问资源。Step 203: The edge cache node 70 receives the resource access request sent by the client 101, the resource access request carries the URL of the resource to be accessed, and the resource access request is used to request the resource to be accessed.
待访问资源的URL可例如为:The URL of the resource to be accessed can be, for example:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txtappdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt
即,待访问资源为域名为appdl.hicloud.com的源站节点的目录路径为/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/中的文件1.txt。That is, the resource to be accessed is the file 1.txt in the source site node whose domain name is appdl.hicloud.com is /TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/.
步骤204:边缘缓存节点判断待访问资源的URL与待刷新资源的URL是否匹配,如果是,执行步骤205,如果否,执行步骤210。Step 204: The edge cache node judges whether the URL of the resource to be accessed matches the URL of the resource to be refreshed, if yes, execute step 205, if not, execute step 210.
具体地,边缘缓存节点70在确定待访问资源的URL与待刷新资源的URL相同,或在确定待刷新资源的URL是待访问资源的URL的前缀的情况下,确定待访问资源的URL与待刷新资源的URL匹配。Specifically, the edge cache node 70 determines that the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, or when it is determined that the URL of the resource to be refreshed is the prefix of the URL of the resource to be accessed, determines the URL of the resource to be accessed and the URL of the resource to be refreshed. The URL of the refresh resource matches.
承上例,待访问资源的URL为:Following the example above, the URL of the resource to be accessed is:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txtappdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/1.txt
待刷新资源的URL为:The URL of the resource to be refreshed is:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/
待刷新资源的URL是待访问资源的URL的前缀,此时待访问资源的URL与待刷新资源的URL匹配。The URL of the resource to be refreshed is the prefix of the URL of the resource to be accessed. At this time, the URL of the resource to be accessed matches the URL of the resource to be refreshed.
在另外一些示例中,若待访问资源的URL为:In some other examples, if the URL of the resource to be accessed is:
appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/appdl.hicloud.com/TIPSMNG_domestic/EMUI3.14159/C00B050MNG/zh-cn/content/00_node/
此时,待访问资源的URL与待刷新资源的URL相同,此时待访问资源的URL与待刷新资源的URL匹配。At this time, the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, and at this time the URL of the resource to be accessed matches the URL of the resource to be refreshed.
步骤205:边缘缓存节点70判断待访问资源的URL是否命中缓存,如果是,执行步骤206,如果否,执行步骤207。Step 205: The edge cache node 70 determines whether the URL of the resource to be accessed hits the cache, if yes, execute step 206, if not, execute step 207.
举例而言,边缘缓存节点70判断待访问资源的URL与本地的缓存表中记录的URL是否相同,如果相同,则命中缓存,如果不相同,则没有命中缓存。For example, the edge cache node 70 determines whether the URL of the resource to be accessed is the same as the URL recorded in the local cache table, if they are the same, the cache is hit, and if they are not the same, the cache is not hit.
步骤206:边缘缓存节点70判断第一刷新时间是否晚于最近缓存时间,如果是,执行步骤207,如果否,执行步骤212。Step 206: The edge cache node 70 determines whether the first refresh time is later than the latest cache time, if yes, execute step 207, if not, execute step 212.
其中,边缘缓存节点70在针对同一URL经过多次缓存之后,缓存表中对应于同一URL有记录有多个缓存时间,因此步骤206中在缓存表中选择对应于同一URL的多个缓存时间中离当前时间最近的缓存时间作为缓存时间。Wherein, after the edge cache node 70 has repeatedly cached the same URL, multiple cache times corresponding to the same URL are recorded in the cache table. Therefore, in step 206, select among the multiple cache times corresponding to the same URL in the cache table. The cache time closest to the current time is used as the cache time.
在本实施例中,刷新时间是边缘缓存节点70接收到第一缓存刷新请求的时间点,而缓存时间是边缘缓存节点70将待访问资源缓存到本地存储器的时间点,若刷新时间晚于最近缓存时间,则说明缓存到边缘缓存节点70的待访问资源是源站进行更新之前的旧资源,此时需执行步骤207以向上级中心缓存节点60回源,若第一刷新时间不晚于最近缓存时间,则说明缓存到边缘缓存节点70的待访问资源是源站进行更新之后的新资源,该资源是源站进行刷新之后的资源,此时执行步骤212以向客户端101返回该资源。In this embodiment, the refresh time is the time point when the edge cache node 70 receives the first cache refresh request, and the cache time is the time point when the edge cache node 70 caches the resource to be accessed in the local memory. If the refresh time is later than the latest The cache time indicates that the resource to be accessed cached to the edge cache node 70 is the old resource before the source station is updated. At this time, step 207 needs to be performed to return to the source to the upper-level central cache node 60. If the first refresh time is not later than the latest The cache time indicates that the resource to be accessed cached to the edge cache node 70 is a new resource after the source station is updated, and the resource is a resource after the source station is refreshed. At this time, step 212 is executed to return the resource to the client 101.
举例而言,边缘缓存节点70可通过查询本地的刷新表获取刷新时间,通过查询本地的缓存表获取缓存时间。For example, the edge cache node 70 may obtain the refresh time by querying a local refresh table, and obtain the cache time by querying a local cache table.
步骤207:边缘缓存节点70发送第一回源请求至上级中心缓存节点60,第一回源请求携带有刷新时间和待刷新资源的URL。Step 207: The edge cache node 70 sends a first back-to-origin request to the upper-level central cache node 60. The first back-to-origin request carries the refresh time and the URL of the resource to be refreshed.
举例而言,第一回源请求为HTTP报文,该HTTP报文的报文头自定义设置有刷新时间类型,刷新时间可以UNIX时间戳的方式体现,例如为:1562280282,UNIX时间戳为1970年1月1日开始所经过的秒数。For example, the first back-to-origin request is an HTTP message, and the header of the HTTP message is customized with a refresh time type. The refresh time can be reflected in UNIX timestamp, for example: 1562280282, and UNIX timestamp is 1970 The number of seconds that have passed since January 1 of the year.
刷新时间类型例如为x-refresh-sendtime,HTTP报文头携带有以下信息:The refresh time type is, for example, x-refresh-sendtime, and the HTTP packet header carries the following information:
x-refresh-sendtime:1562280282。x-refresh-sendtime: 1562280282.
步骤208:边缘缓存节点70接收中心缓存节点60发送的回源请求应答信息,回源应答信息携带有待刷新资源的URL和待刷新资源。Step 208: The edge cache node 70 receives the back-to-origin request response information sent by the central cache node 60, and the back-to-origin response information carries the URL of the resource to be refreshed and the resource to be refreshed.
其中,中心缓存节点60根据第一回源请求产生回源请求应答信息。The central cache node 60 generates back-to-origin request response information according to the first back-to-origin request.
步骤209:边缘缓存节点70将待刷新资源的URL和待刷新资源进行缓存,并记录缓存时间。Step 209: The edge cache node 70 caches the URL of the resource to be refreshed and the resource to be refreshed, and records the cache time.
具体地,边缘缓存节点70将待刷新资源的URL、缓存时间以及待刷新资源在本地存储器的存储地址作为一个条目记录到缓存表中,值得注意的是,缓存表中可能对应于同一URL记录有多个缓存时间,因此步骤206中选择离当前时间最近的缓存时间作为缓存时间。Specifically, the edge cache node 70 records the URL of the resource to be refreshed, the cache time, and the storage address of the resource to be refreshed in the local memory as an entry in the cache table. It is worth noting that the cache table may record data corresponding to the same URL. There are multiple cache times, so in step 206, the cache time closest to the current time is selected as the cache time.
在本发明实施例中,边缘缓存节点70定期删除缓存表中的条目。In the embodiment of the present invention, the edge cache node 70 periodically deletes entries in the cache table.
步骤210:边缘缓存节点70判断到待访问资源的URL与待刷新资源的URL不匹配的情况下,说明待访问资源还没有刷新过,此时边缘缓存节点70执行步骤210,判断待访问资源的URL是否命中缓存,如果是,执行步骤212,直接向客户端101返回待访问资源,由于该资源没有被刷新,因此是新的资源,如果否,执行步骤211,向中心缓存节点60回源。Step 210: When the edge cache node 70 determines that the URL of the resource to be accessed does not match the URL of the resource to be refreshed, it means that the resource to be accessed has not been refreshed. At this time, the edge cache node 70 executes step 210 to determine the resource to be accessed. Whether the URL hits the cache, if yes, go to step 212 to directly return the resource to be accessed to the client 101. Since the resource is not refreshed, it is a new resource. If not, go to step 211 to return the source to the central cache node 60.
步骤211:边缘缓存节点70发送第二回源请求至中心缓存节点60,第二回源请求携带有待刷新资源的URL。Step 211: The edge cache node 70 sends a second back-to-origin request to the central cache node 60, and the second back-to-origin request carries the URL of the resource to be refreshed.
在本步骤中,由于待访问资源的URL与待刷新资源的URL不匹配,说明边缘缓存节点70没有接收到针对待访问资源的URL的资源的缓存刷新请求,因此第二回源请求无需携带刷新时间。In this step, because the URL of the resource to be accessed does not match the URL of the resource to be refreshed, it means that the edge cache node 70 has not received the resource cache refresh request for the URL of the resource to be accessed, so the second source request does not need to carry refresh time.
步骤212:边缘缓存节点70发送资源访问请求应答信息至客户端101,资源访问请求应答信息携带有待访问资源的URL和待访问资源。Step 212: The edge cache node 70 sends resource access request response information to the client 101, and the resource access request response information carries the URL of the resource to be accessed and the resource to be accessed.
在本发明实施例中,边缘缓存节点70响应于资源访问请求向中心缓存节点60发送第一回源请求,第一回源请求携带有刷新时间和待刷新资源的URL,且刷新时间是边缘缓存节点70接收到缓存刷新请求的时间点,中心缓存节点60接收到第一回源请求之后,在待刷新资源的URL命中缓存的情况下,根据第一刷新时间确认缓存的待刷新资源是否是旧资源,可避免中心缓存节点60在待刷新资源的URL命中缓存的情况下直接向边缘缓存节点70发送旧资源的情况发生。In the embodiment of the present invention, the edge cache node 70 sends a first back-to-origin request to the central cache node 60 in response to the resource access request. The first back-to-origin request carries the refresh time and the URL of the resource to be refreshed, and the refresh time is the edge cache. The time point when the node 70 receives the cache refresh request. After the central cache node 60 receives the first back-to-origin request, if the URL of the resource to be refreshed hits the cache, it confirms whether the cached resource to be refreshed is old according to the first refresh time. Resources can avoid the situation that the central cache node 60 directly sends old resources to the edge cache node 70 when the URL of the resource to be refreshed hits the cache.
在本发明实施例中,在步骤202中,边缘缓存节点70在预定时间后在刷新表删除待刷新资源的URL和刷新时间之后,若客户端101发送针对待刷新资源的URL的另一资源访问请求至边缘缓存节点70,此时,边缘缓存节点70在刷新表中查询不到待刷新资源的URL,此时,边缘缓存节点70在确认待刷新资源的URL命中缓存的情况下,发送回源请求应答信息至中心缓存节点60,回源请求应答信息携带有待刷新资源的URL和缓存的待刷新资源。In the embodiment of the present invention, in step 202, after the edge cache node 70 deletes the URL of the resource to be refreshed and the refresh time after refreshing the table after a predetermined time, if the client 101 sends another resource access for the URL of the resource to be refreshed The request is sent to the edge cache node 70. At this time, the edge cache node 70 cannot find the URL of the resource to be refreshed in the refresh table. At this time, the edge cache node 70 sends back to the source after confirming that the URL of the resource to be refreshed hits the cache. The request response information is sent to the central cache node 60, and the return request response information carries the URL of the resource to be refreshed and the cached resource to be refreshed.
在本发明其他实施例中,刷新时间还可由控制台20统一设置,并携带在控制台20发送至边缘缓存节点70的第一缓存刷新请求中。举例而言,刷新时间可定义为图3中用户在CDN控制界面点击“点击刷新”按键时,控制平台20记录的时间点。In other embodiments of the present invention, the refresh time may also be uniformly set by the console 20 and carried in the first cache refresh request sent by the console 20 to the edge cache node 70. For example, the refresh time can be defined as the time point recorded by the control platform 20 when the user clicks the "click to refresh" button on the CDN control interface in FIG. 3.
以下请参见图7,图7是根据本发明实施例的CDN中的回源方法的流程图,为清楚说明,该方法的执行主体为图1所示的CDN系统中的中心缓存节点60,值得注意的是,图1所示其他中心缓存节点也可执行该方法。Please refer to FIG. 7 below. FIG. 7 is a flowchart of a back-to-origin method in a CDN according to an embodiment of the present invention. For clarity, the method is executed by the central cache node 60 in the CDN system shown in FIG. Note that other central cache nodes shown in Figure 1 can also perform this method.
该方法包括以下步骤:The method includes the following steps:
步骤401:中心缓存节点60接收边缘缓存节点70发送的回源请求。Step 401: The central cache node 60 receives the back-to-origin request sent by the edge cache node 70.
承接上例,回源请求可能是图6所示步骤207中携带有第一刷新时间和待刷新资源的URL的第一回源请求,也可能是步骤211中携带有待刷新资源的URL而没有携带有第一刷新时间的第二回源请求。Continuing the above example, the back-to-origin request may be the first back-to-origin request that carries the first refresh time and the URL of the resource to be refreshed in step 207 shown in Figure 6, or it may be the URL of the resource to be refreshed in step 211 without carrying it. The second back-to-origin request with the first refresh time.
步骤402:中心缓存节点60判断该回源请求是否携带有第一刷新时间,如果是,执行步骤403,如果否,执行步骤408。Step 402: The central cache node 60 judges whether the return-to-origin request carries the first refresh time, if yes, execute step 403, if not, execute step 408.
承上例,回源请求为HTTP报文时,可检测HTTP报文的报文头是否设置有刷新时间 类型x-refresh-sendtime,如果是,则确认回源请求携带有刷新时间。Continuing the above example, when the return-to-origin request is an HTTP message, it can be detected whether the header of the HTTP message is set with the refresh time type x-refresh-sendtime. If so, confirm that the return-to-origin request carries the refresh time.
步骤403:中心缓存节点60判断是否已接收控制平台20发送的第二缓存刷新请求,如果是,执行步骤404,如果否,执行步骤409。Step 403: The central cache node 60 determines whether the second cache refresh request sent by the control platform 20 has been received, if yes, execute step 404, if not, execute step 409.
具体而言,中心缓存节点60在接收到控制平台20发送的第二缓存刷新请求时,在本地的刷新表中记录待刷新资源的URL和中心缓存节点60接收到第二缓存刷新请求的时间点,反之,若中心缓存节点60在接收到控制平台20发送的第二缓存刷新请求,则不对本地的刷新表进行设置,此时刷新表没有记录刷新URL和中心缓存节点60接收到第二缓存刷新请求的时间点。Specifically, when the central cache node 60 receives the second cache refresh request sent by the control platform 20, it records the URL of the resource to be refreshed and the time point when the central cache node 60 receives the second cache refresh request in the local refresh table. On the other hand, if the central cache node 60 receives the second cache refresh request sent by the control platform 20, the local refresh table is not set. At this time, the refresh table does not record the refresh URL and the central cache node 60 receives the second cache refresh The time of the request.
值得注意的是,在本发明实施例中,中心缓存节点60在接收到控制平台20发送的第二缓存刷新请求时,在本地的刷新表中记录待刷新资源的URL和中心缓存节点60接收到第二缓存刷新请求的时间点之后,向控制平台20发送缓存刷新成功消息,以通知控制平台20中心缓存节点60已收到第二缓存刷新请求,并将待刷新资源的URL和中心缓存节点60接收到第二缓存刷新请求的时间点记录在中心缓存节点60的刷新表中。It is worth noting that, in the embodiment of the present invention, when the central cache node 60 receives the second cache refresh request sent by the control platform 20, it records the URL of the resource to be refreshed and the central cache node 60 received in the local refresh table. After the time point of the second cache refresh request, a cache refresh success message is sent to the control platform 20 to notify the control platform 20 that the central cache node 60 has received the second cache refresh request, and the URL of the resource to be refreshed and the central cache node 60 The time point when the second cache refresh request is received is recorded in the refresh table of the central cache node 60.
在本发明实施例中,中心缓存节点60定时删除本地的刷新表中记录的待刷新资源的URL和刷新时间,举例而言,在待刷新资源为目录的情况下,可在一个月后删除待刷新资源的URL和刷新时间,在待刷新资源为文件的情况下,可在10天后删除待刷新资源的URL和刷新时间,由于刷新表会占用存储空间和内存,该定时删除机制可节约中心缓存节点60的存储空间和内存资源。In the embodiment of the present invention, the central cache node 60 periodically deletes the URL and refresh time of the resource to be refreshed recorded in the local refresh table. For example, if the resource to be refreshed is a directory, the resource to be refreshed can be deleted one month later. Refresh the URL and refresh time of the resource. When the resource to be refreshed is a file, the URL and refresh time of the resource to be refreshed can be deleted after 10 days. Since refreshing the table will occupy storage space and memory, this timing deletion mechanism can save central cache The storage space and memory resources of the node 60.
步骤404:中心缓存节点60判断回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤405,如果否,执行步骤410。Step 404: The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 405, if not, execute step 410.
由于步骤402已经确认回源请求携带有第一刷新时间,因此该回源请求是图6示的第一回源请求,其中,回源请求携带的待刷新资源的URL命中缓存的情况下,此时,在确认第一回源请求携带的待刷新资源的URL命中缓存的情况下,中心缓存节点60执行步骤405所在分支,以根据第一刷新时间确认是否向边缘缓存节点70返回已缓存的待刷新资源。Since step 402 has confirmed that the back-to-origin request carries the first refresh time, the back-to-origin request is the first back-to-origin request shown in FIG. 6, where the URL of the resource to be refreshed carried in the back-to-origin request hits the cache. When it is confirmed that the URL of the resource to be refreshed carried in the first source request hits the cache, the central cache node 60 executes the branch of step 405 to confirm whether to return the cached resource to the edge cache node 70 according to the first refresh time. Refresh resources.
在确认第一回源请求携带的待刷新资源的URL没有命中缓存的情况下,中心缓存节点60执行步骤410,直接向源站节点回源。In the case where it is confirmed that the URL of the resource to be refreshed carried in the first return-to-origin request does not hit the cache, the central cache node 60 executes step 410 to directly return to the origin node.
在本发明实施例中,中心缓存节点60可在预定时间后删除刷新表中记录的待刷新资源的URL和刷新时间,举例而言,在待刷新资源为目录的情况下,可在一个月后删除记录有待刷新资源的URL和刷新时间的条目,在待刷新资源是文件的情况下,可在10秒后在刷新表删除待刷新资源的URL和刷新时间,由于刷新表会占用存储空间和内存,该定时删除机制可节约中心缓存节点60的存储空间和内存资源。In the embodiment of the present invention, the central cache node 60 may delete the URL and refresh time of the resource to be refreshed recorded in the refresh table after a predetermined time. For example, when the resource to be refreshed is a directory, it may be one month later. Delete the entry that records the URL and refresh time of the resource to be refreshed. When the resource to be refreshed is a file, you can delete the URL and refresh time of the resource to be refreshed in the refresh table after 10 seconds, because refreshing the table will occupy storage space and memory , The timing deletion mechanism can save the storage space and memory resources of the central cache node 60.
进一步地,在待刷新资源是文件的情况下,中心缓存节点60在刷新表记录待刷新资源的URL和刷新时间之后,若待刷新资源的URL命中缓存,中心缓存节点60会在本地存储器删除待刷新资源,并删除缓存表中待刷新资源的URL所在的条目。Further, in the case that the resource to be refreshed is a file, after the central cache node 60 records the URL and refresh time of the resource to be refreshed in the refresh table, if the URL of the resource to be refreshed hits the cache, the central cache node 60 deletes the resource in the local storage. Refresh the resource and delete the entry in the cache table where the URL of the resource to be refreshed is located.
在待刷新资源是目录的情况下,中心缓存节点60在刷新表记录待刷新资源的URL和刷新时间之后,若待刷新资源的URL命中缓存,由于目录下可能包括多个文件,中心缓存节点60不会在本地存储器删除待刷新资源,不会删除缓存表中待刷新资源的URL所在的条目。In the case that the resource to be refreshed is a directory, after the central cache node 60 records the URL and refresh time of the resource to be refreshed in the refresh table, if the URL of the resource to be refreshed hits the cache, since the directory may include multiple files, the central cache node 60 The resource to be refreshed will not be deleted in the local storage, and the entry where the URL of the resource to be refreshed in the cache table is located will not be deleted.
步骤405:中心缓存节点60判断最近刷新时间是否晚于本地的缓存时间,其中最近刷新时间是第一回源请求携带的刷新时间和中心缓存节点60接收到第二缓存刷新请求的时间点中的较晚者,如果是,说明中心缓存节点60当前缓存的待刷新资源是在源站刷新资源之前的资源,即是旧的资源,此时中心缓存节点60执行步骤410,向源站节点回源,如果否,说明缓存的待刷新资源是在源站刷新资源之后的资源,即是新的资源,此时执行步骤406,直接向边缘缓存节点70返回命中缓存的待刷新资源。Step 405: The central cache node 60 judges whether the latest refresh time is later than the local cache time, where the latest refresh time is the refresh time carried in the first back-to-origin request and the time point when the central cache node 60 receives the second cache refresh request If it is later, it means that the resource to be refreshed currently cached by the central cache node 60 is the resource before the source site refreshes the resource, that is, the old resource. At this time, the central cache node 60 performs step 410 to return to the source site node. If not, it means that the cached resource to be refreshed is the resource after the source station refreshes the resource, that is, it is a new resource. At this time, step 406 is executed to directly return the cached resource to be refreshed to the edge cache node 70.
步骤406:中心缓存节点60发送第一回源请求应答信息至边缘缓存节点70,第一回源请求应答信息携带有待刷新资源的URL和待刷新资源。Step 406: The central cache node 60 sends the first back-to-origin request response information to the edge cache node 70, and the first back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed.
步骤407:中心缓存节点60在没有接收到控制平台20发送的第二缓存刷新请求的情况下,执行步骤407,在步骤407中,中心缓存节点60判断第一回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤409,如果否,执行步骤410。Step 407: When the central cache node 60 does not receive the second cache refresh request sent by the control platform 20, step 407 is executed. In step 407, the central cache node 60 determines the status of the resource to be refreshed carried in the first back-to-source request. Whether the URL hits the cache, if yes, execute step 409, if not, execute step 410.
在本步骤中,回源请求为图6所示的第一回源请求,中心缓存节点60判断到第一回源请求携带的待刷新资源的URL命中缓存时,执行步骤409,仅根据第一回源请求携带的刷新时间判断是否要将缓存的待刷新资源发送给边缘缓存节点70。In this step, the back-to-origin request is the first back-to-origin request shown in FIG. 6. When the central cache node 60 determines that the URL of the resource to be refreshed carried in the first back-to-origin request hits the cache, step 409 is executed, and only according to the first The refresh time carried in the return-to-origin request determines whether to send the cached resource to be refreshed to the edge cache node 70.
中心缓存节点60判断到第一回源请求携带的待刷新资源的URL没有命中缓存时,执行步骤410,直接向源站节点回源。When the central cache node 60 determines that the URL of the resource to be refreshed carried in the first return-to-origin request does not hit the cache, step 410 is executed to directly return to the origin node.
步骤408:中心缓存节点60判断第一回源请求携带的刷新时间是否晚于本地的缓存时间,如果是,确认所缓存的待刷新资源是源站刷新之前的旧资源,执行步骤412,直接向源站节点10回源,如果否,确认所缓存的待刷新资源是源站刷新之后的新资源,执行步骤406,向边缘缓存节点70返回本地缓存的待刷新资源。Step 408: The central cache node 60 judges whether the refresh time carried in the first source request is later than the local cache time, if so, confirms that the cached resource to be refreshed is the old resource before the source station refreshes, and executes step 412 to directly The source site node 10 returns to the source. If not, it is confirmed that the cached resource to be refreshed is a new resource after the source site is refreshed, and step 406 is executed to return the locally cached resource to be refreshed to the edge cache node 70.
步骤409:中心缓存节点60判断是否已接收控制平台20发送的第二缓存刷新请求,如果是,执行步骤411,如果否,执行步骤410。Step 409: The central cache node 60 determines whether the second cache refresh request sent by the control platform 20 has been received, if yes, execute step 411, if not, execute step 410.
值得注意的是,在本步骤中,回源请求为图6所示的第二回源请求。It is worth noting that in this step, the return-to-origin request is the second return-to-origin request shown in FIG. 6.
步骤410:中心缓存节点60判断第二回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤406,向边缘缓存节点70返回待刷新资源,如果否,执行步骤412,向源站节点20回源。Step 410: The central cache node 60 determines whether the URL of the resource to be refreshed carried in the second back-to-origin request hits the cache, if yes, execute step 406 to return the resource to be refreshed to the edge cache node 70, if not, execute step 412 to the source The station node 20 returns to the source.
步骤411:中心缓存节点60判断回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤406,如果否,执行步骤412。Step 411: The central cache node 60 judges whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 406, if not, execute step 412.
步骤412:中心缓存节点60发送另一回源请求至源站节点20,该回源请求携带待刷新资源的URL。Step 412: The central cache node 60 sends another back-to-origin request to the origin node 20, and the back-to-origin request carries the URL of the resource to be refreshed.
步骤413:中心缓存节点60接收源站节点20发送的回源请求应答信息,回源请求应答信息携带有待刷新资源的URL和待刷新资源,中心缓存节点60将待刷新资源缓存到本地存储器,并在缓存表中记录待刷新资源的URL、缓存时间以及该资源的存储地址。Step 413: The central cache node 60 receives the back-to-origin request response information sent by the source site node 20. The back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed. The central cache node 60 caches the resource to be refreshed in the local storage, and Record the URL of the resource to be refreshed, the cache time, and the storage address of the resource in the cache table.
在本发明实施例中,中心缓存节点60在接收到的回源请求携带有刷新时间的情况下,即便回源请求携带的待刷新资源的URL命中本地缓存,中心缓存节点60还会根据该刷新时间进一步确认自身缓存的待刷新资源是否是源站更新之后的资源,在确认自身缓存的待刷新资源是否是源站更新之后的资源,则向边缘缓存节点70返回该资源,如果确认自身缓存的待刷新资源是否是刷新之前的资源,则向源站节点20回源,从而确保客户端101不会从边缘缓存节点70获取到旧的资源。In the embodiment of the present invention, when the central cache node 60 receives the back-to-origin request carrying the refresh time, even if the URL of the resource to be refreshed carried in the back-to-origin request hits the local cache, the central cache node 60 will refresh according to the refresh time. Time to further confirm whether the resource to be refreshed in its own cache is the resource after the source station is updated. After confirming whether the resource to be refreshed in its own cache is the resource after the source station is updated, the resource is returned to the edge cache node 70. Whether the resource to be refreshed is the resource before the refresh, the source is returned to the origin node 20 to ensure that the client 101 will not obtain the old resource from the edge cache node 70.
值得注意的是,在本发明其他实施例中,刷新时间还可由控制台20统一设置,并携带在控制台20发送至边缘缓存节点70的第一缓存刷新请求、以及控制台20发送至中心缓存节点60的第二缓存刷新请求中。举例而言,刷新时间可定义为图3中用户在CDN控制界面点击“点击刷新”按键时,控制平台20记录的时间点。It is worth noting that in other embodiments of the present invention, the refresh time can also be uniformly set by the console 20 and carried in the first cache refresh request sent by the console 20 to the edge cache node 70 and the console 20 sent to the central cache. Node 60 is in the second cache refresh request. For example, the refresh time can be defined as the time point recorded by the control platform 20 when the user clicks the "click to refresh" button on the CDN control interface in FIG. 3.
此时,边缘缓存节点70可根据图8所示的流程进行处理,图8是根据本发明实施例的CDN中的回源方法的流程图,如图8所示,该方法包括以下步骤:At this time, the edge cache node 70 can perform processing according to the process shown in FIG. 8. FIG. 8 is a flowchart of the back-to-origin method in the CDN according to an embodiment of the present invention. As shown in FIG. 8, the method includes the following steps:
步骤1001:中心缓存节点60接收边缘缓存节点70发送的回源请求。Step 1001: The central cache node 60 receives the back-to-origin request sent by the edge cache node 70.
步骤1002:中心缓存节点60判断回源请求是否携带有刷新时间,如果是,执行步骤1003,如果否,执行步骤1006。Step 1002: The central cache node 60 determines whether the return-to-origin request carries a refresh time, if yes, execute step 1003, if not, execute step 1006.
步骤1003:中心缓存节点60判断回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤1004,如果否,执行步骤1007。Step 1003: The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 1004, if not, execute step 1007.
步骤1004:中心缓存节点60判断刷新时间是否晚于本地的缓存时间,如果是,执行步骤1007,如果否,执行步骤1005。Step 1004: The central cache node 60 determines whether the refresh time is later than the local cache time, if yes, execute step 1007, if not, execute step 1005.
步骤1005:中心缓存节点60发送第一回源请求应答信息至边缘缓存节点70,第一回源应答信息携带有待刷新资源的URL和待刷新资源。Step 1005: The central cache node 60 sends first back-to-origin request response information to the edge cache node 70, and the first back-to-origin response information carries the URL of the resource to be refreshed and the resource to be refreshed.
步骤1006:中心缓存节点60判断回源请求携带的待刷新资源的URL是否命中缓存,如果是,执行步骤1005,如果否,执行步骤1007。Step 1006: The central cache node 60 determines whether the URL of the resource to be refreshed carried in the return-to-origin request hits the cache, if yes, execute step 1005, if not, execute step 1007.
步骤1007:中心缓存节点60发送另一回源请求至源站节点20,该回源请求携带待刷新资源的URL。Step 1007: The central cache node 60 sends another back-to-origin request to the origin node 20, and the back-to-origin request carries the URL of the resource to be refreshed.
步骤1008:中心缓存节点60接收源站节点20发送的回源请求应答信息,回源请求应答信息携带有待刷新资源的URL和待刷新资源,将待刷新资源缓存到本地存储器,并在缓存表中记录待刷新资源的URL、缓存时间以及该资源的存储地址。Step 1008: The central cache node 60 receives the back-to-origin request response information sent by the source site node 20, and the back-to-origin request response information carries the URL of the resource to be refreshed and the resource to be refreshed, caches the resource to be refreshed in the local storage and in the cache table Record the URL, cache time, and storage address of the resource to be refreshed.
值得注意的是,图1所示其他中心缓存节点也可执行上述方法。It is worth noting that other central cache nodes shown in Figure 1 can also perform the above methods.
由于在图8所示的方法中,刷新时间为控制平台20统一设置的时间点,即中心缓存节点60从边缘缓存节点70接收到的刷新时间与自身从控制平台20接收到的刷新时间是一样的,因此在图8所示的方法中,中心缓存节点60无需判断之前是否接收过第二缓存刷新请求,除此之外,图8所示的步骤与图7的相关步骤所示类似,具体可参见图7对于个步骤的相关说明,于此不作赘述。Because in the method shown in FIG. 8, the refresh time is a time point uniformly set by the control platform 20, that is, the refresh time received by the central cache node 60 from the edge cache node 70 is the same as the refresh time it receives from the control platform 20. Therefore, in the method shown in FIG. 8, the central cache node 60 does not need to determine whether the second cache refresh request has been received before. In addition, the steps shown in FIG. 8 are similar to the related steps in FIG. Refer to FIG. 7 for the related description of each step, which is not repeated here.
类似地,在本发明实施例中,中心缓存节点60在接收到的回源请求携带有刷新时间的情况下,即便回源请求携带的待刷新资源的URL命中本地缓存,中心缓存节点60还会根据该刷新时间进一步确认自身缓存的待刷新资源是否是刷新之后的资源,在确认自身缓存的待刷新资源是否是刷新之后的资源,则向边缘缓存节点70返回该资源,如果确认自身缓存的待刷新资源是否是刷新之前的资源,则向源站节点20回源,从而确保客户端101不会从边缘缓存节点70获取到旧的资源。Similarly, in the embodiment of the present invention, when the central cache node 60 receives the return-to-origin request carrying refresh time, even if the URL of the resource to be refreshed carried in the return-to-origin request hits the local cache, the central cache node 60 will still According to the refresh time, it is further confirmed whether the resource to be refreshed in its own cache is the resource after refresh. After confirming whether the resource to be refreshed in its own cache is the resource after refresh, the resource is returned to the edge cache node 70. Whether the refreshed resource is the resource before refreshing, the source is returned to the source site node 20 to ensure that the client 101 will not obtain the old resource from the edge cache node 70.
为了进一步说明对图2、图6至图7所示的方法,以下请参见图9,图9是根据本发明实施例的内容分发网络的缓存刷新方法的数据交互图,图9所示的方法包括以下步骤:In order to further explain the methods shown in FIGS. 2 and 6 to 7, please refer to FIG. 9 below. FIG. 9 is a data interaction diagram of a method for refreshing a cache of a content distribution network according to an embodiment of the present invention. The method shown in FIG. 9 It includes the following steps:
步骤801:用户登录源站节点10,源站的特定URL对应的资源被用户更新。Step 801: The user logs into the origin site node 10, and the resource corresponding to the specific URL of the origin site is updated by the user.
步骤802:用户登录CDN控制界面针对特定URL输入刷新命令,控制平台20接收用户输入的刷新命令。Step 802: The user logs into the CDN control interface and inputs a refresh command for a specific URL, and the control platform 20 receives the refresh command input by the user.
步骤803:控制平台20同时发送多个缓存刷新请求至CDN中的所有缓存节点。Step 803: The control platform 20 simultaneously sends multiple cache refresh requests to all cache nodes in the CDN.
具体而言,控制平台20同时发送多个第一缓存刷新请求至CDN中的所有边缘缓存节点,发送多个第二缓存刷新请求至CDN中的所有中心缓存节点,第一缓存刷新请求和第二缓存刷新请求携带有待刷新资源的URL。Specifically, the control platform 20 simultaneously sends multiple first cache refresh requests to all edge cache nodes in the CDN, and sends multiple second cache refresh requests to all central cache nodes in the CDN, the first cache refresh request and the second cache refresh request. The cache refresh request carries the URL of the resource to be refreshed.
步骤804:边缘缓存节点70在接收到第一缓存刷新请求的情况下,记录待刷新资源的URL和第一刷新时间到本地的刷新表。Step 804: When receiving the first cache refresh request, the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table.
步骤805:中心缓存节点60接收到缓存刷新请求的情况下,记录待刷新资源的URL和第二刷新时间到本地的刷新表。Step 805: When the central cache node 60 receives the cache refresh request, it records the URL of the resource to be refreshed and the second refresh time to the local refresh table.
步骤806:边缘缓存节点70记录待刷新资源的URL和第一刷新时间到本地的刷新表之后,发送第一缓存刷新成功信息到控制平台20,其中,第一刷新时间是边缘缓存节点70接收到第一缓存刷新请求的时间点。Step 806: After the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table, it sends the first cache refresh success message to the control platform 20, where the first refresh time is received by the edge cache node 70 The time point of the first cache refresh request.
步骤807:中心缓存节点60记录待刷新资源的URL和第二刷新时间到本地的刷新表之后,发送第二缓存刷新成功信息到控制平台20,其中,第二刷新时间是中心缓存节点60接收到第二缓存刷新请求的时间点。Step 807: After the central cache node 60 records the URL of the resource to be refreshed and the second refresh time to the local refresh table, it sends the second cache refresh success information to the control platform 20, where the second refresh time is the time received by the central cache node 60 The time point of the second cache refresh request.
步骤808:控制平台20在接收到CDN中的所有缓存节点返回的缓存刷新成功信息的情况下,提示用户待刷新资源在CDN中已经刷新。Step 808: When receiving the cache refresh success information returned by all cache nodes in the CDN, the control platform 20 prompts the user that the resource to be refreshed has been refreshed in the CDN.
在本发明实施例中,控制平台20无需先向中心缓存节点发送第一缓存刷新请求,在确认所有中心缓存节点均返回缓存刷新成功信息之后再向边缘缓存节点发送第二缓存刷新请求,第一缓存刷新请求和第二缓存刷新请求可同时发出,可以极大地缩短刷新时间。In the embodiment of the present invention, the control platform 20 does not need to send the first cache refresh request to the central cache node first, and sends the second cache refresh request to the edge cache node after confirming that all central cache nodes have returned cache refresh success information. The cache refresh request and the second cache refresh request can be issued at the same time, which can greatly shorten the refresh time.
步骤809:客户端101发送携带有待访问资源的URL的资源访问请求至边缘缓存节点70。Step 809: The client 101 sends a resource access request carrying the URL of the resource to be accessed to the edge cache node 70.
步骤810:边缘缓存节点70在满足预设条件下,产生第一回源请求。Step 810: The edge cache node 70 generates a first back-to-origin request when the preset condition is met.
其中,预设条件为:Among them, the preset conditions are:
边缘缓存节点70在确定待访问资源的URL与待刷新资源的URL匹配且待访问资源的URL没有命中缓存;或边缘缓存节点70在确定待访问资源的URL与待刷新资源的URL匹配、待访问资源的URL命中缓存、且刷新时间晚于待刷新资源的缓存时间。The edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache; or the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed, and the URL of the resource to be refreshed The URL of the resource hits the cache, and the refresh time is later than the cache time of the resource to be refreshed.
步骤811:边缘缓存节点70发送第一回源请求至中心缓存节点60。Step 811: The edge cache node 70 sends the first back-to-origin request to the central cache node 60.
步骤812:中心缓存节点60在待刷新资源的URL命中缓存的情况下,选择第一刷新时间和第二刷新时间中的较晚者作为最近刷新时间,若最近刷新时间晚于待刷新资源的URL在中心缓存节点60的缓存时间,产生第二回源请求。Step 812: When the URL of the resource to be refreshed hits the cache, the central cache node 60 selects the later of the first refresh time and the second refresh time as the latest refresh time, if the latest refresh time is later than the URL of the resource to be refreshed During the cache time of the central cache node 60, a second back-to-origin request is generated.
步骤813:中心缓存节点60发送第二回源请求至源站节点10。Step 813: The central cache node 60 sends a second back-to-origin request to the source site node 10.
步骤814:源站节点10发送第一应答请求至中心缓存节点60。Step 814: The origin node 10 sends a first response request to the central cache node 60.
其中,第一应答请求携带有待刷新资源。Among them, the first response request carries resources to be refreshed.
步骤815:中心缓存节点60将待刷新资源缓存到本地存储器,更新记录缓存时间1到本地的缓存表。Step 815: The central cache node 60 caches the to-be-refreshed resource in the local storage, and updates the record cache time 1 to the local cache table.
举例而言,若缓存表之前记录的是条目1:待刷新资源的URL、缓存时间0、存储地址1,则中心缓存节点60更新该条目1中的缓存时间0,将缓存时间0修改为缓存时间1。For example, if the entry 1: the URL of the resource to be refreshed, the cache time 0, and the storage address 1 are recorded before the cache table, the central cache node 60 updates the cache time 0 in this entry 1, and modifies the cache time 0 to the cache Time 1.
可选地,中心缓存节点60也可增加条目2:待刷新资源的URL、缓存时间1、存储地址1,而保留条目1。当中心缓存节点60查找待刷新资源的URL对应的缓存时间时,根据待刷新资源的URL在缓存表中获取到条目1和条目2,比对条目1和条目2中的缓存时间,选择较晚的缓存时间2作为待刷新资源的URL的缓存时间。Optionally, the central cache node 60 may also add entry 2: URL of the resource to be refreshed, cache time 1, storage address 1, and entry 1 is reserved. When the central cache node 60 searches for the cache time corresponding to the URL of the resource to be refreshed, it obtains entry 1 and entry 2 in the cache table according to the URL of the resource to be refreshed, compares the cache time in entry 1 and entry 2, and selects the later The cache time 2 is used as the cache time of the URL of the resource to be refreshed.
步骤816:中心缓存节点60发送第二应答请求至边缘缓存节点70。Step 816: The central cache node 60 sends a second response request to the edge cache node 70.
其中,第一应答请求携带有待刷新资源。Among them, the first response request carries resources to be refreshed.
步骤817:边缘缓存节点70将接收到的待刷新资源缓存,记录缓存时间2、待刷新资源的URL以及到该资源的存储地址到本地的缓存表。Step 817: The edge cache node 70 caches the received resource to be refreshed, records the cache time 2, the URL of the resource to be refreshed, and the storage address of the resource to a local cache table.
其中,边缘缓存节点70针对本地的缓存表的操作与中心缓存节点60类似,于此不作赘述。The operation of the edge cache node 70 on the local cache table is similar to that of the central cache node 60, which will not be described in detail here.
步骤818:边缘缓存节点70发送第三应答请求至客户端101。Step 818: The edge cache node 70 sends a third response request to the client 101.
其中,第三应答请求携带有待刷新资源。Among them, the third response request carries resources to be refreshed.
综上,由于边缘缓存节点发送到中心缓存节点的回源请求携带有刷新时间,中心缓存节点即便命中缓存,还会根据该刷新时间来确定命中缓存的资源是否是新的资源,基于此,控制平台20可同时发送缓存刷新请求至CDN的所有缓存节点,无需担心中心缓存节点向边缘缓存节点返回旧的资源,因此CDN的刷新速度可明显加快,从而提升用户体验。In summary, since the back-to-origin request sent by the edge cache node to the central cache node carries a refresh time, even if the central cache node hits the cache, it will determine whether the resource that hits the cache is a new resource based on the refresh time. Based on this, control The platform 20 can send cache refresh requests to all cache nodes of the CDN at the same time, and there is no need to worry about the central cache node returning old resources to the edge cache nodes. Therefore, the refresh speed of the CDN can be significantly accelerated, thereby improving user experience.
在一些情况下,例如中心缓存节点60与控制平台20之间的网络状况不佳,中心缓存节点60会在没有接收到控制平台20发送的第二缓存刷新请求的情况下接收到边缘缓存节点70发送过来的回源请求,本发明实施例可保证中心缓存节点60在这种情况下不会向边缘缓存节点70返回旧的资源,以下结合图10进行说明,图10是根据本发明实施例的内容分发网络的缓存刷新方法的另一数据交互图,图10所示的方法包括以下步骤:In some cases, for example, the network condition between the central cache node 60 and the control platform 20 is not good, the central cache node 60 will receive the edge cache node 70 without receiving the second cache refresh request sent by the control platform 20 For the sent back-to-origin request, the embodiment of the present invention can ensure that the central cache node 60 will not return the old resources to the edge cache node 70 in this case. The following is an explanation with reference to FIG. 10, which is according to an embodiment of the present invention Another data interaction diagram of the cache refresh method of the content distribution network. The method shown in FIG. 10 includes the following steps:
步骤901:用户登录源站节点10,源站的特定URL对应的资源被用户更新。Step 901: The user logs into the origin site node 10, and the resource corresponding to the specific URL of the origin site is updated by the user.
步骤902:用户登录CDN控制界面针对特定URL输入刷新命令,控制平台20接收用户输入的刷新命令。Step 902: The user logs in to the CDN control interface and inputs a refresh command for a specific URL, and the control platform 20 receives the refresh command input by the user.
步骤903:控制平台20同时发送多个缓存刷新请求至CDN中的所有缓存节点。Step 903: The control platform 20 simultaneously sends multiple cache refresh requests to all cache nodes in the CDN.
具体而言,控制平台20同时发送多个第一缓存刷新请求至CDN中的所有边缘缓存节点,发送多个第二缓存刷新请求至CDN中的所有中心缓存节点,第一缓存刷新请求和第二缓存刷新请求携带有待刷新资源的URL。Specifically, the control platform 20 simultaneously sends multiple first cache refresh requests to all edge cache nodes in the CDN, and sends multiple second cache refresh requests to all central cache nodes in the CDN, the first cache refresh request and the second cache refresh request. The cache refresh request carries the URL of the resource to be refreshed.
步骤904:边缘缓存节点70在接收到第一缓存刷新请求的情况下,记录待刷新资源的URL和第一刷新时间到本地的刷新表。Step 904: When receiving the first cache refresh request, the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table.
步骤905:边缘缓存节点70记录待刷新资源的URL和第一刷新时间到本地的刷新表之后,发送第一缓存刷新成功信息到控制平台20,其中,第一刷新时间是边缘缓存节点70接收到第一缓存刷新请求的时间点。Step 905: After the edge cache node 70 records the URL of the resource to be refreshed and the first refresh time to the local refresh table, it sends the first cache refresh success information to the control platform 20, where the first refresh time is the edge cache node 70 received The time point of the first cache refresh request.
步骤906:客户端101发送携带有待访问资源的URL的资源访问请求至边缘缓存节点70。Step 906: The client 101 sends a resource access request carrying the URL of the resource to be accessed to the edge cache node 70.
步骤907:边缘缓存节点70在满足预设条件下,产生第一回源请求。Step 907: The edge cache node 70 generates a first back-to-origin request when the preset condition is met.
其中,预设条件为:Among them, the preset conditions are:
边缘缓存节点70在确定待访问资源的URL与待刷新资源的URL匹配且待访问资源 的URL没有命中缓存;或边缘缓存节点70在确定待访问资源的URL与待刷新资源的URL匹配、待访问资源的URL命中缓存、且刷新时间晚于待刷新资源的缓存时间。The edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache; or the edge cache node 70 is determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed, and the URL of the resource to be refreshed The URL of the resource hits the cache, and the refresh time is later than the cache time of the resource to be refreshed.
步骤908:边缘缓存节点70发送第一回源请求至中心缓存节点60。Step 908: The edge cache node 70 sends the first back-to-origin request to the central cache node 60.
步骤909:中心缓存节点60在待刷新资源的URL命中缓存的情况下,若确认第一刷新时间晚于待刷新资源的URL在中心缓存节点60的缓存时间,产生第二回源请求。Step 909: If the central cache node 60 confirms that the first refresh time is later than the cache time of the URL of the resource to be refreshed in the central cache node 60 when the URL of the resource to be refreshed hits the cache, a second return request is generated.
步骤910:中心缓存节点60发送第二回源请求至源站节点10。Step 910: The central cache node 60 sends a second back-to-origin request to the origin site node 10.
步骤911:源站节点10发送第一应答请求至中心缓存节点60。Step 911: The source site node 10 sends a first response request to the central cache node 60.
其中,第一应答请求携带有待刷新资源。Among them, the first response request carries resources to be refreshed.
步骤912:中心缓存节点60将待刷新资源缓存到本地存储器,更新记录缓存时间1到本地的缓存表。Step 912: The central cache node 60 caches the resources to be refreshed in the local storage, and updates the cache table that records the cache time 1 to the local.
举例而言,若缓存表之前记录的是条目1:待刷新资源的URL、缓存时间0、存储地址1,则中心缓存节点60更新该条目1中的缓存时间0,将缓存时间0修改为缓存时间1。For example, if the entry 1: the URL of the resource to be refreshed, the cache time 0, and the storage address 1 are recorded before the cache table, the central cache node 60 updates the cache time 0 in this entry 1, and modifies the cache time 0 to the cache Time 1.
可选地,中心缓存节点60也可增加条目2:待刷新资源的URL、缓存时间1、存储地址1,而保留条目1。当中心缓存节点60查找待刷新资源的URL对应的缓存时间时,根据待刷新资源的URL在缓存表中获取到条目1和条目2,比对条目1和条目2中的缓存时间,选择较晚的缓存时间2作为待刷新资源的URL的缓存时间。Optionally, the central cache node 60 may also add entry 2: URL of the resource to be refreshed, cache time 1, storage address 1, and entry 1 is reserved. When the central cache node 60 searches for the cache time corresponding to the URL of the resource to be refreshed, it obtains entry 1 and entry 2 in the cache table according to the URL of the resource to be refreshed, compares the cache time in entry 1 and entry 2, and selects the later The cache time 2 is used as the cache time of the URL of the resource to be refreshed.
步骤913:中心缓存节点60发送第二应答请求至边缘缓存节点70。Step 913: The central cache node 60 sends a second response request to the edge cache node 70.
其中,第二应答请求携带有待刷新资源。Wherein, the second response request carries resources to be refreshed.
步骤914:边缘缓存节点70将接收到的待刷新资源缓存,记录缓存时间2、待刷新资源的URL以及到该资源的存储地址到本地的缓存表。Step 914: The edge cache node 70 caches the received resource to be refreshed, recording the cache time 2, the URL of the resource to be refreshed, and the storage address of the resource to a local cache table.
其中,边缘缓存节点70针对本地的缓存表的操作与中心缓存节点60类似,于此不作赘述。The operation of the edge cache node 70 on the local cache table is similar to that of the central cache node 60, which will not be described in detail here.
步骤915:边缘缓存节点70发送第三应答请求至客户端101。Step 915: The edge cache node 70 sends a third response request to the client 101.
其中,第三应答请求携带有待刷新资源。Among them, the third response request carries resources to be refreshed.
步骤916:中心缓存节点60接收到缓存刷新请求的情况下,记录待刷新资源的URL和第二刷新时间到本地的刷新表。Step 916: When the central cache node 60 receives the cache refresh request, it records the URL of the resource to be refreshed and the second refresh time to the local refresh table.
步骤917:中心缓存节点60记录待刷新资源的URL和第二刷新时间到本地的刷新表之后,发送第二缓存刷新成功信息到控制平台20,其中,第二刷新时间是中心缓存节点60接收到第二缓存刷新请求的时间点。Step 917: After the central cache node 60 records the URL of the resource to be refreshed and the second refresh time to the local refresh table, it sends a second cache refresh success message to the control platform 20, where the second refresh time is received by the central cache node 60 The time point of the second cache refresh request.
步骤918:控制平台20在接收到CDN中的所有缓存节点返回的缓存刷新成功信息的情况下,提示用户待刷新资源在CDN中已经刷新。Step 918: When receiving the cache refresh success information returned by all cache nodes in the CDN, the control platform 20 prompts the user that the resource to be refreshed has been refreshed in the CDN.
在本发明实施例中,控制平台20无需先向中心缓存节点发送第一缓存刷新请求,在确认所有中心缓存节点均返回缓存刷新成功信息之后再向边缘缓存节点发送第二缓存刷新请求,第一缓存刷新请求和第二缓存刷新请求可同时发出,可以极大地缩短刷新时间。In the embodiment of the present invention, the control platform 20 does not need to send the first cache refresh request to the central cache node first, and sends the second cache refresh request to the edge cache node after confirming that all central cache nodes have returned cache refresh success information. The cache refresh request and the second cache refresh request can be issued at the same time, which can greatly shorten the refresh time.
综上,由于边缘缓存节点发送到中心缓存节点的回源请求携带有刷新时间,中心缓存节点即便命中缓存且还没有接收到控制平台发送的第二缓存刷新请求,还会根据该刷新时间来确定命中缓存的资源是否是新的资源,基于此,控制平台20可同时发送缓存刷新请求至CDN的所有缓存节点,无需担心中心缓存节点向边缘缓存节点返回旧的资源。In summary, since the back-to-origin request sent by the edge cache node to the central cache node carries a refresh time, even if the central cache node hits the cache and has not received the second cache refresh request sent by the control platform, it will determine it based on the refresh time. Whether the resource that hits the cache is a new resource, based on this, the control platform 20 can send a cache refresh request to all cache nodes of the CDN at the same time, without worrying about the central cache node returning old resources to the edge cache node.
请参见图11,本发明实施例进一步提供一种边缘缓存节点70,包括接收模块701、发送模块702、判断模块703、记录模块704以及定时删除模块704,该些模块用于执行图6所示实施例中的相关操作。Referring to FIG. 11, an embodiment of the present invention further provides an edge cache node 70, which includes a receiving module 701, a sending module 702, a judgment module 703, a recording module 704, and a timing deletion module 704. These modules are used to perform the operations shown in FIG. Related operations in the embodiment.
请参见图12,本发明实施例进一步提供一种中心缓存节点60,包括接收模块601、发送模块602、判断模块603、记录模块604以及定时删除模块604,该些模块用于执行图7或图8所示实施例中的相关操作。Referring to FIG. 12, an embodiment of the present invention further provides a central cache node 60, including a receiving module 601, a sending module 602, a judgment module 603, a recording module 604, and a timing deletion module 604. These modules are used to execute FIG. 7 or FIG. 8 shows the related operations in the embodiment.
图13是本申请实施例提供的边缘缓存节点70的结构性示意性图。边缘缓存节点70包括处理单元7000和通信接口7103,处理单元7000用于执行各种软件程序所定义的功能,例如,用于实现边缘缓存节点70的功能。通信接口7103用于与其他计算节点进行通信交互,其他设备可以是其它物理服务器,具体地,通信接口7103可以是网络适配卡。FIG. 13 is a schematic structural diagram of an edge cache node 70 provided by an embodiment of the present application. The edge cache node 70 includes a processing unit 7000 and a communication interface 7103. The processing unit 7000 is configured to execute functions defined by various software programs, for example, to implement the functions of the edge cache node 70. The communication interface 7103 is used to communicate and interact with other computing nodes, and other devices may be other physical servers. Specifically, the communication interface 7103 may be a network adapter card.
可选地,该边缘缓存节点70还可以包括输入/输出接口7101,输入/输出接口7101连接有输入/输出设备,用于接收输入的信息,输出操作结果。输入/输出接口7101可以为鼠标、键盘、显示器、或者光驱等。可选地,该边缘缓存节点70还可以包括辅助存储器7102,一般也称为外存,辅助存储器7102的存储介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如光盘)、或者半导体介质(例如固态硬盘)等。Optionally, the edge cache node 70 may further include an input/output interface 7101, and the input/output interface 7101 is connected to an input/output device for receiving input information and outputting operation results. The input/output interface 7101 may be a mouse, a keyboard, a display, or an optical drive. Optionally, the edge cache node 70 may also include auxiliary storage 7102, which is generally also called external storage. The storage medium of the auxiliary storage 7102 may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, an optical disk), Or semiconductor media (such as solid state drives) and so on.
可选的,边缘缓存节点70还可以包括总线7104。其中,处理单元7000、通信接口7103、输入/输出接口7101、辅助存储器7102可以通过总线7104连接。总线7104可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线7104可以分为地址总线、数据总线、控制总线等。为便于表示,图13中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。Optionally, the edge cache node 70 may further include a bus 7104. Among them, the processing unit 7000, the communication interface 7103, the input/output interface 7101, and the auxiliary memory 7102 may be connected through the bus 7104. The bus 7104 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 7104 can be divided into an address bus, a data bus, and a control bus. For ease of representation, only one line is used in FIG. 13, but it does not mean that there is only one bus or one type of bus.
处理单元7000可以有多种具体实现形式,例如处理单元7000可以包括处理器7002和存储器7001,处理器7002根据存储器7001中存储的程序指令执行图6所示的实施例的相关操作。处理器7002可以为中央处理单元(central processing unit,CPU)。该处理器还可以是其它通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。或者该处理器7002采用一个或多个集成电路,用于执行相关程序,以实现本申请实施例所提供的技术方案。The processing unit 7000 may have a variety of specific implementation forms. For example, the processing unit 7000 may include a processor 7002 and a memory 7001, and the processor 7002 performs related operations of the embodiment shown in FIG. 6 according to program instructions stored in the memory 7001. The processor 7002 may be a central processing unit (central processing unit, CPU). The processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (ASICs), ready-made programmable gate arrays (field programmable gate arrays, FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. Or, the processor 7002 adopts one or more integrated circuits to execute related programs to implement the technical solutions provided in the embodiments of the present application.
边缘缓存节点70中的各个单元的上述和其它操作和/或功能分别为了实现图6、图9及图10中的方法的相应流程,为了简洁,在此不再赘述。The above-mentioned and other operations and/or functions of each unit in the edge cache node 70 are used to implement the corresponding procedures of the methods in FIG. 6, FIG. 9 and FIG. 10, and are not repeated here for brevity.
图14是本申请实施例提供的中心缓存节点60的结构性示意性图。中心缓存节点60包括处理单元6000和通信接口6103,处理单元6000用于执行各种软件程序所定义的功能,例如,用于实现中心缓存节点60的功能。通信接口6103用于与其他计算节点进行通信交互,其他设备可以是其它物理服务器,具体地,通信接口6103可以是网络适配卡。FIG. 14 is a schematic structural diagram of a central cache node 60 provided by an embodiment of the present application. The central cache node 60 includes a processing unit 6000 and a communication interface 6103. The processing unit 6000 is used to execute functions defined by various software programs, for example, to implement the functions of the central cache node 60. The communication interface 6103 is used to communicate and interact with other computing nodes, and other devices may be other physical servers. Specifically, the communication interface 6103 may be a network adapter card.
可选地,该中心缓存节点60还可以包括输入/输出接口6101,输入/输出接口6101连接有输入/输出设备,用于接收输入的信息,输出操作结果。输入/输出接口6101可以为鼠标、键盘、显示器、或者光驱等。可选地,该中心缓存节点60还可以包括辅助存储器6102, 一般也称为外存,辅助存储器6102的存储介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如光盘)、或者半导体介质(例如固态硬盘)等。Optionally, the central cache node 60 may further include an input/output interface 6101, and the input/output interface 6101 is connected to an input/output device for receiving input information and outputting operation results. The input/output interface 6101 may be a mouse, a keyboard, a display, or an optical drive. Optionally, the central cache node 60 may also include auxiliary storage 6102, which is generally also called external storage. The storage medium of the auxiliary storage 6102 may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, an optical disk), Or semiconductor media (such as solid state drives) and so on.
可选的,中心缓存节点60还可以包括总线6104。其中,处理单元6000、通信接口6103、输入/输出接口6101、辅助存储器6102可以通过总线6104连接。总线6104可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线6104可以分为地址总线、数据总线、控制总线等。为便于表示,图14中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。Optionally, the central cache node 60 may further include a bus 6104. Among them, the processing unit 6000, the communication interface 6103, the input/output interface 6101, and the auxiliary memory 6102 may be connected through the bus 6104. The bus 6104 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 6104 can be divided into an address bus, a data bus, and a control bus. For ease of representation, only one line is used for representation in FIG. 14, but it does not mean that there is only one bus or one type of bus.
处理单元6000可以有多种具体实现形式,例如处理单元6000可以包括处理器6002和存储器6001,处理器6002根据存储器6001中存储的程序指令执行图7或图8所示的实施例的相关操作。处理器6002可以为中央处理单元(central processing unit,CPU)。该处理器还可以是其它通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。或者该处理器6002采用一个或多个集成电路,用于执行相关程序,以实现本申请实施例所提供的技术方案。The processing unit 6000 may have a variety of specific implementation forms. For example, the processing unit 6000 may include a processor 6002 and a memory 6001, and the processor 6002 performs related operations of the embodiment shown in FIG. 7 or FIG. 8 according to program instructions stored in the memory 6001. The processor 6002 may be a central processing unit (central processing unit, CPU). The processor can also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (ASICs), ready-made programmable gate arrays (field programmable gate arrays, FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. Or the processor 6002 adopts one or more integrated circuits to execute related programs to implement the technical solutions provided in the embodiments of the present application.
中心缓存节点60中的各个单元的上述和其它操作和/或功能分别为了实现图7至图10中的方法的相应流程,为了简洁,在此不再赘述。The above-mentioned and other operations and/or functions of each unit in the central cache node 60 are used to implement the corresponding procedures of the methods in FIGS. 7 to 10, and are not repeated here for brevity.
需要说明的是,本申请实施例中的存储器可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以包括非易失性存储器(英文:non-volatile memory),例如只读存储器(英文:read-only memory,缩写:ROM),快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD);存储器还可以包括上述种类的存储器的组合。It should be noted that the memory in the embodiment of the present application may include a volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviation: RAM); the memory may also include non-volatile memory. Non-volatile memory (English: non-volatile memory), such as read-only memory (English: read-only memory, abbreviation: ROM), flash memory (English: flash memory), hard disk (English: hard disk drive, abbreviation: HDD) Or a solid-state drive (English: solid-state drive, abbreviation: SSD); the memory may also include a combination of the foregoing types of memory.
基于相同的发明构思,本申请提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述实施例中任意可能的实现方式中所述的方法。Based on the same inventive concept, the present application provides a computer-readable storage medium that stores instructions in the computer-readable storage medium, and when it runs on a computer, the computer executes any possible implementation in the above-mentioned embodiments. The method described.
基于相同的发明构思,本申请提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任意可能的实现方式中所述的方法。Based on the same inventive concept, the present application provides a computer program product containing instructions, which when run on a computer, enables the computer to execute the method described in any possible implementation manner in the foregoing embodiments.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储信道(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage channels (including but not limited to disk storage, optical storage, etc.) containing computer-usable program codes.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指 令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器指令,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This application is described with reference to flowcharts and/or block diagrams of methods, equipment (systems), and computer program products according to the embodiments of this application. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing equipment to generate a machine instruction, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated A device used to implement the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application also intends to include these modifications and variations.

Claims (38)

  1. 一种内容分发网络中的回源方法,其特征在于,包括:A back-to-source method in a content distribution network, characterized in that it includes:
    边缘缓存节点接收控制平台发送的缓存刷新请求,所述缓存刷新请求携带有待刷新资源的统一资源定位符URL;The edge cache node receives a cache refresh request sent by the control platform, where the cache refresh request carries the uniform resource locator URL of the resource to be refreshed;
    所述边缘缓存节点向中心缓存节点发送回源请求,所述回源请求携带有所述待刷新资源的URL和所述待刷新资源的刷新时间。The edge cache node sends a back-to-origin request to the central cache node, where the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
  2. 根据权利要求1所述的方法,其特征在于,所述刷新时间是所述边缘缓存节点接收到所述缓存刷新请求的时间点。The method according to claim 1, wherein the refresh time is a point in time when the edge cache node receives the cache refresh request.
  3. 根据权利要求1所述的方法,其特征在于,所述刷新时间携带在所述缓存刷新请求中,且所述刷新时间由所述控制平台设置。The method according to claim 1, wherein the refresh time is carried in the cache refresh request, and the refresh time is set by the control platform.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,The method according to any one of claims 1 to 3, characterized in that:
    所述边缘缓存节点向中心缓存节点发送回源请求之前,所述方法还包括:Before the edge cache node sends back the source request to the central cache node, the method further includes:
    所述边缘缓存节点接收客户端发送的第一资源访问请求;The edge cache node receives the first resource access request sent by the client;
    所述边缘缓存节点向中心缓存节点发送回源请求,具体包括:The edge cache node sends back the source request to the central cache node, which specifically includes:
    所述边缘缓存节点响应于所述第一资源访问请求向所述中心缓存节点发送所述回源请求。The edge cache node sends the back-to-origin request to the central cache node in response to the first resource access request.
  5. 根据权利要求4所述的方法,其特征在于,所述第一资源访问请求携带有待访问资源的URL,所述边缘缓存节点响应于所述资源访问请求向所述中心缓存节点发送所述回源请求,具体包括:The method according to claim 4, wherein the first resource access request carries the URL of the resource to be accessed, and the edge cache node sends the back-to-origin to the central cache node in response to the resource access request The request includes:
    所述边缘缓存节点在确定所述待访问资源的URL与所述待刷新资源的URL匹配且所述待访问资源的URL没有命中缓存的情况下,向所述中心缓存节点发送所述回源请求。When determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache, the edge cache node sends the return request to the central cache node .
  6. 根据权利要求4所述的方法,其特征在于,所述资源访问请求携带有待访问资源的URL,所述边缘缓存节点响应于所述资源访问请求向所述中心缓存节点发送所述回源请求,还包括:The method according to claim 4, wherein the resource access request carries the URL of the resource to be accessed, and the edge cache node sends the back-to-origin request to the central cache node in response to the resource access request, Also includes:
    所述边缘缓存节点在确定所述待访问资源的URL与所述待刷新资源的URL匹配、所述待访问资源的URL命中缓存、且所述刷新时间晚于缓存时间的情况下,向所述中心缓存节点发送所述回源请求,其中所述缓存时间是所述边缘缓存节点缓存所述待访问资源的时间点。When determining that the URL of the resource to be accessed matches the URL of the resource to be refreshed, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time, the edge cache node sends a notification to the The central cache node sends the back-to-origin request, where the cache time is a time point at which the edge cache node caches the resource to be accessed.
  7. 根据权利要求1至6任一项所述的方法,其特征在于,所述边缘缓存节点设置有刷新表,所述边缘缓存节点接收控制平台发送的缓存刷新请求之后,所述方法还包括:The method according to any one of claims 1 to 6, wherein the edge cache node is provided with a refresh table, and after the edge cache node receives the cache refresh request sent by the control platform, the method further comprises:
    所述边缘缓存节点在所述刷新表记录所述待刷新资源的URL和所述刷新时间。The edge cache node records the URL of the resource to be refreshed and the refresh time in the refresh table.
  8. 根据权利要求7所述的方法,其特征在于,所述边缘缓存节点在所述刷新表记录所述待刷新资源的URL和所述刷新时间之后,所述方法还包括:The method according to claim 7, wherein after the edge cache node records the URL of the resource to be refreshed and the refresh time in the refresh table, the method further comprises:
    所述边缘缓存节点在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间。The edge cache node deletes the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time.
  9. 根据权利要求7所述的方法,其特征在于,所述边缘缓存节点在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间之后,所述方法还包括:The method according to claim 7, wherein after the edge cache node deletes the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time, the method further comprises:
    所述边缘缓存节点接收所述客户端发送的第二资源访问请求,所述第二资源访问请求 携带有所述待访问资源的URL;The edge cache node receives a second resource access request sent by the client, where the second resource access request carries the URL of the resource to be accessed;
    所述边缘缓存节点在确定所述待访问资源的URL不在所述刷新表且所述待访问资源的URL命中缓存的情况下,所述边缘缓存节点发送资源访问请求应答信息至所述客户端,所述资源访问请求应答信息携带有所述待访问资源。When the edge cache node determines that the URL of the resource to be accessed is not in the refresh table and the URL of the resource to be accessed hits the cache, the edge cache node sends resource access request response information to the client, The resource access request response information carries the resource to be accessed.
  10. 根据权利要求5至9任一项所述的方法,其特征在于,所述边缘缓存节点在确定所述待访问资源的URL与所述待刷新资源的URL相同,或在确定所述待刷新资源的URL是所述待访问资源的URL的前缀的情况下,确定所述待访问资源的URL与所述待刷新资源的URL匹配。The method according to any one of claims 5 to 9, wherein the edge cache node determines that the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, or determines that the resource to be refreshed If the URL is the prefix of the URL of the resource to be accessed, it is determined that the URL of the resource to be accessed matches the URL of the resource to be refreshed.
  11. 一种内容分发网络中的回源方法,其特征在于,包括:A back-to-source method in a content distribution network, characterized in that it includes:
    中心缓存节点接收边缘缓存节点发送的第一回源请求,所述第一回源请求携带有待刷新资源的URL和所述待刷新资源的刷新时间;The central cache node receives the first back-to-origin request sent by the edge cache node, where the first back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed;
    所述中心缓存节点在所述待刷新资源的URL命中缓存的情况下,将所述刷新时间与所述待刷新资源的缓存时间进行比对,在确定所述刷新时间晚于所述缓存时间的情况下,向所述源站节点发送所述第二回源请求。When the URL of the resource to be refreshed hits the cache, the central cache node compares the refresh time with the cache time of the resource to be refreshed, and determines that the refresh time is later than the cache time. In this case, the second back-to-origin request is sent to the source site node.
  12. 根据权利要求11所述的方法,其特征在于,所述刷新时间是所述边缘缓存节点接收到控制平台发送的第一缓存刷新请求的时间点。The method according to claim 11, wherein the refresh time is a point in time when the edge cache node receives the first cache refresh request sent by the control platform.
  13. 根据权利要求11所述的方法,其特征在于,所述刷新时间携带在所述边缘缓存节点从控制平台接收到的缓存刷新请求中,且所述刷新时间由所述控制平台设置。The method according to claim 11, wherein the refresh time is carried in a cache refresh request received by the edge cache node from a control platform, and the refresh time is set by the control platform.
  14. 根据权利要求11所述的方法,其特征在于,所述中心缓存节点向所述源站节点发送所述第二回源请求之前,所述方法还包括:The method according to claim 11, wherein before the central cache node sends the second back-to-origin request to the source site node, the method further comprises:
    所述中心缓存节点接收所述控制平台发送的第二缓存刷新请求,所述第二缓存刷新请求携带有所述待刷新资源的URL;The central cache node receives a second cache refresh request sent by the control platform, where the second cache refresh request carries the URL of the resource to be refreshed;
    所述中心缓存节点判断接收到所述第二缓存刷新请求的时间点晚于所述缓存时间。The central cache node determines that the time point when the second cache refresh request is received is later than the cache time.
  15. 根据权利要求11至14任一项所述的方法,其特征在于,所述中心缓存节点设置有刷新表,中心缓存节点接收边缘缓存节点发送的第一回源请求之后,所述方法还包括:The method according to any one of claims 11 to 14, wherein the central cache node is provided with a refresh table, and after the central cache node receives the first back-to-origin request sent by the edge cache node, the method further comprises:
    所述中心缓存节点在所述刷新表记录所述待刷新资源的URL和所述刷新时间。The central cache node records the URL of the resource to be refreshed and the refresh time in the refresh table.
  16. 根据权利要求15所述的方法,其特征在于,所述中心缓存节点在所述刷新表记录所述待刷新资源的URL和所述刷新时间之后,所述方法还包括:The method according to claim 15, wherein after the central cache node records the URL of the resource to be refreshed and the refresh time in the refresh table, the method further comprises:
    所述中心缓存节点在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间。The central cache node deletes the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time.
  17. 根据权利要求16所述的方法,其特征在于,所述中心缓存节点在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间之后,所述方法还包括:The method according to claim 16, wherein after the central cache node deletes the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time, the method further comprises:
    所述中心缓存节点接收所述边缘缓存节点发送的第三回源请求,所述第三回源请求携带有所述待刷新资源的URL;The central cache node receives a third back-to-origin request sent by the edge cache node, where the third back-to-origin request carries the URL of the resource to be refreshed;
    所述中心缓存节点在确定所述待刷新资源的URL不在所述刷新表且所述待刷新资源的URL命中缓存的情况下,发送资源访问请求应答信息至所述边缘缓存节点,所述资源访问请求应答信息携带有所述待刷新资源。When the central cache node determines that the URL of the resource to be refreshed is not in the refresh table and the URL of the resource to be refreshed hits the cache, the central cache node sends resource access request response information to the edge cache node, and the resource access The request response information carries the resource to be refreshed.
  18. 一种边缘缓存节点,其特征在于,包括:An edge cache node is characterized by comprising:
    接收模块,用于接收控制平台发送的缓存刷新请求,所述缓存刷新请求携带有待刷新资源的统一资源定位符URL;The receiving module is configured to receive a cache refresh request sent by the control platform, where the cache refresh request carries the uniform resource locator URL of the resource to be refreshed;
    发送模块,用于向中心缓存节点发送回源请求,所述回源请求携带有所述待刷新资源的URL和所述待刷新资源的刷新时间。The sending module is configured to send a back-to-origin request to the central cache node, where the back-to-origin request carries the URL of the resource to be refreshed and the refresh time of the resource to be refreshed.
  19. 根据权利要求18所述的边缘缓存节点,其特征在于,所述刷新时间是所述边缘缓存节点接收到所述缓存刷新请求的时间点。The edge cache node according to claim 18, wherein the refresh time is a point in time when the edge cache node receives the cache refresh request.
  20. 根据权利要求18所述的边缘缓存节点,其特征在于,所述刷新时间携带在所述缓存刷新请求中,且所述刷新时间由所述控制平台设置。The edge cache node according to claim 18, wherein the refresh time is carried in the cache refresh request, and the refresh time is set by the control platform.
  21. 根据权利要求18至20任一项所述的边缘缓存节点,其特征在于,The edge cache node according to any one of claims 18 to 20, wherein:
    所述接收模块,还用于接收客户端发送的第一资源访问请求;The receiving module is further configured to receive the first resource access request sent by the client;
    所述发送模块,还用于响应于所述第一资源访问请求向所述中心缓存节点发送所述回源请求。The sending module is further configured to send the back-to-origin request to the central cache node in response to the first resource access request.
  22. 根据权利要求21所述的边缘缓存节点,其特征在于,所述第一资源访问请求携带有待访问资源的URL,所述边缘缓存节点还包括判断模块,The edge cache node according to claim 21, wherein the first resource access request carries the URL of the resource to be accessed, and the edge cache node further comprises a judgment module,
    所述判断模块,用于确定所述待访问资源的URL与所述待刷新资源的URL匹配且所述待访问资源的URL没有命中缓存;The judgment module is configured to determine that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache;
    所述发送模块,用于在所述判断模块确定所述待访问资源的URL与所述待刷新资源的URL匹配且所述待访问资源的URL没有命中缓存的情况下,向所述中心缓存节点发送所述回源请求。The sending module is configured to send to the central cache node when the judgment module determines that the URL of the resource to be accessed matches the URL of the resource to be refreshed and the URL of the resource to be accessed does not hit the cache Send the return request.
  23. 根据权利要求21所述的边缘缓存节点,其特征在于,所述资源访问请求携带有待访问资源的URL,所述边缘缓存节点还包括判断模块,The edge cache node according to claim 21, wherein the resource access request carries a URL of the resource to be accessed, and the edge cache node further comprises a judgment module,
    所述判断模块,用于确定所述待访问资源的URL与所述待刷新资源的URL匹配、所述待访问资源的URL命中缓存、且所述刷新时间晚于缓存时间;The judgment module is configured to determine that the URL of the resource to be accessed matches the URL of the resource to be refreshed, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time;
    所述发送模块,用于在所述判断模块确定所述待访问资源的URL与所述待刷新资源的URL匹配、所述待访问资源的URL命中缓存、且所述刷新时间晚于缓存时间的情况下,向所述中心缓存节点发送所述回源请求,其中所述缓存时间是所述边缘缓存节点缓存所述待访问资源的时间点。The sending module is configured to determine in the judgment module that the URL of the resource to be accessed matches the URL of the resource to be refreshed, the URL of the resource to be accessed hits the cache, and the refresh time is later than the cache time In a case, the back-to-origin request is sent to the central cache node, where the cache time is a time point at which the edge cache node caches the resource to be accessed.
  24. 根据权利要求18至23任一项所述的边缘缓存节点,其特征在于,所述边缘缓存节点设置有刷新表,所述边缘缓存节点还包括记录模块,所述记录模块用于在所述接收模块接收控制平台发送的缓存刷新请求之后,在所述刷新表记录所述待刷新资源的URL和所述刷新时间。The edge cache node according to any one of claims 18 to 23, wherein the edge cache node is provided with a refresh table, the edge cache node further comprises a recording module, and the recording module is used for receiving After the module receives the cache refresh request sent by the control platform, it records the URL of the resource to be refreshed and the refresh time in the refresh table.
  25. 根据权利要求24所述的边缘缓存节点,其特征在于,所述边缘缓存节点还包括定时删除模块,所述定时删除模块,用于在所述记录模块所述刷新表记录所述待刷新资源的URL和所述刷新时间之后,在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间。The edge cache node according to claim 24, wherein the edge cache node further comprises a timing deletion module, and the timing deletion module is configured to record information of the resource to be refreshed in the refresh table of the recording module. After the URL and the refresh time, delete the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time.
  26. 根据权利要求24所述的边缘缓存节点,其特征在于,The edge cache node of claim 24, wherein:
    所述接收模块,用于接收所述客户端发送的第二资源访问请求,所述第二资源访问请求携带有所述待访问资源的URL;The receiving module is configured to receive a second resource access request sent by the client, where the second resource access request carries the URL of the resource to be accessed;
    所述判断模块,用于确定所述待访问资源的URL不在所述刷新表且所述待访问资源 的URL命中缓存;The judgment module is configured to determine that the URL of the resource to be accessed is not in the refresh table and the URL of the resource to be accessed hits the cache;
    所述发送模块,用于在所述判断模块确定所述待访问资源的URL不在所述刷新表且所述待访问资源的URL命中缓存的情况下,发送资源访问请求应答信息至所述客户端,所述资源访问请求应答信息携带有所述待访问资源。The sending module is configured to send resource access request response information to the client when the judgment module determines that the URL of the resource to be accessed is not in the refresh table and the URL of the resource to be accessed hits the cache , The resource access request response information carries the resource to be accessed.
  27. 根据权利要求22至26任一项所述的边缘缓存节点,其特征在于,所述判断模块在确定所述待访问资源的URL与所述待刷新资源的URL相同,或在确定所述待刷新资源的URL是所述待访问资源的URL的前缀的情况下,确定所述待访问资源的URL与所述待刷新资源的URL匹配。The edge cache node according to any one of claims 22 to 26, wherein the judgment module determines that the URL of the resource to be accessed is the same as the URL of the resource to be refreshed, or determines that the URL of the resource to be refreshed In the case where the URL of the resource is a prefix of the URL of the resource to be accessed, it is determined that the URL of the resource to be accessed matches the URL of the resource to be refreshed.
  28. 一种中心缓存节点,其特征在于,包括:A central cache node is characterized by comprising:
    接收模块,用于接收边缘缓存节点发送的第一回源请求,所述第一回源请求携带有待刷新资源的URL和所述待刷新资源的刷新时间;A receiving module, configured to receive a first back-to-origin request sent by an edge cache node, the first back-to-origin request carrying the URL of the resource to be refreshed and the refresh time of the resource to be refreshed;
    判断模块,用于确认所述待刷新资源的URL命中缓存,所述刷新时间晚于所述待刷新资源的缓存时间;A judging module, configured to confirm that the URL of the resource to be refreshed hits the cache, and the refresh time is later than the cache time of the resource to be refreshed;
    发送模块,用于在所述判断模块确认所述待刷新资源的URL命中缓存所述刷新时间晚于所述缓存时间的情况下,向所述源站节点发送所述第二回源请求。The sending module is configured to send the second back-to-origin request to the source site node when the judgment module confirms that the URL of the resource to be refreshed hits the cache and the refresh time is later than the cache time.
  29. 根据权利要求28所述的中心缓存节点,其特征在于,所述刷新时间是所述边缘缓存节点接收到控制平台发送的第一缓存刷新请求的时间点。The central cache node according to claim 28, wherein the refresh time is a point in time when the edge cache node receives the first cache refresh request sent by the control platform.
  30. 根据权利要求28所述的中心缓存节点,其特征在于,所述刷新时间携带在所述边缘缓存节点从控制平台接收到的缓存刷新请求中,且所述刷新时间由所述控制平台设置。The central cache node according to claim 28, wherein the refresh time is carried in a cache refresh request received by the edge cache node from a control platform, and the refresh time is set by the control platform.
  31. 根据权利要求28所述的中心缓存节点,其特征在于,The central cache node according to claim 28, wherein:
    所述接收模块,还用于接收所述控制平台发送的第二缓存刷新请求,所述第二缓存刷新请求携带有所述待刷新资源的URL;The receiving module is further configured to receive a second cache refresh request sent by the control platform, where the second cache refresh request carries the URL of the resource to be refreshed;
    所述判断模块,还用于判断接收到所述第二缓存刷新请求的时间点晚于所述缓存时间。The judgment module is further configured to judge that the time point when the second cache refresh request is received is later than the cache time.
  32. 根据权利要求28至31任一项所述的中心缓存节点,其特征在于,所述中心缓存节点设置有刷新表,所述中心缓存节点还包括记录模块,The central cache node according to any one of claims 28 to 31, wherein the central cache node is provided with a refresh table, and the central cache node further comprises a recording module,
    所述记录模块,用于在所述刷新表记录所述待刷新资源的URL和所述刷新时间。The recording module is configured to record the URL of the resource to be refreshed and the refresh time in the refresh table.
  33. 根据权利要求32所述的中心缓存节点,其特征在于,所述中心缓存节点还包括定时删除模块,The central cache node according to claim 32, wherein the central cache node further comprises a timing deletion module,
    所述定时删除模块,用于在预定时间后删除所述刷新表中记录的所述待刷新资源的URL和所述刷新时间。The timing deletion module is configured to delete the URL of the resource to be refreshed and the refresh time recorded in the refresh table after a predetermined time.
  34. 根据权利要求32所述的中心缓存节点,其特征在于,The central cache node according to claim 32, wherein:
    所述接收模块,还用于接收所述边缘缓存节点发送的第三回源请求,所述第三回源请求携带有所述待刷新资源的URL;The receiving module is further configured to receive a third back-to-origin request sent by the edge cache node, where the third back-to-origin request carries the URL of the resource to be refreshed;
    所述判断模块,还用于确定所述待刷新资源的URL不在所述刷新表且所述待刷新资源的URL命中缓存;The judgment module is further configured to determine that the URL of the resource to be refreshed is not in the refresh table and the URL of the resource to be refreshed hits the cache;
    所述发送模块,还用于在所述判断模块确定所述待刷新资源的URL不在所述刷新表且所述待刷新资源的URL命中缓存的情况下,发送资源访问请求应答信息至所述边缘缓存 节点,所述资源访问请求应答信息携带有所述待刷新资源。The sending module is further configured to send resource access request response information to the edge when the judgment module determines that the URL of the resource to be refreshed is not in the refresh table and the URL of the resource to be refreshed hits the cache For the cache node, the resource access request response information carries the resource to be refreshed.
  35. 一种中心缓存节点,其特征在于,包括存储器和处理器,所述存储器存储有程序指令,所述处理器运行所述程序指令,以执行权利要求1至10任一项所述的方法。A central cache node is characterized by comprising a memory and a processor, the memory stores program instructions, and the processor runs the program instructions to execute the method according to any one of claims 1 to 10.
  36. 一种边缘缓存节点,其特征在于,包括存储器和处理器,所述存储器存储有程序指令,所述处理器运行所述程序指令,以执行权利要求11至17任一项的方法。An edge cache node, comprising a memory and a processor, the memory stores program instructions, and the processor runs the program instructions to execute the method of any one of claims 11 to 17.
  37. 一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得所述计算机执行权利要求1至10任一项所述的方法。A computer-readable storage medium in which instructions are stored, and when the instructions are run on a computer, the computer executes the method according to any one of claims 1 to 10.
  38. 一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得所述计算机执行权利要求11至17任一项所述的方法。A computer-readable storage medium in which instructions are stored, and when the instructions are run on a computer, the computer is caused to execute the method according to any one of claims 11 to 17.
PCT/CN2019/096028 2019-07-15 2019-07-15 Return-to-source method and related device in content delivery network WO2021007752A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/096028 WO2021007752A1 (en) 2019-07-15 2019-07-15 Return-to-source method and related device in content delivery network
CN201980008635.7A CN112513830A (en) 2019-07-15 2019-07-15 Back-source method and related device in content distribution network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/096028 WO2021007752A1 (en) 2019-07-15 2019-07-15 Return-to-source method and related device in content delivery network

Publications (1)

Publication Number Publication Date
WO2021007752A1 true WO2021007752A1 (en) 2021-01-21

Family

ID=74209687

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/096028 WO2021007752A1 (en) 2019-07-15 2019-07-15 Return-to-source method and related device in content delivery network

Country Status (2)

Country Link
CN (1) CN112513830A (en)
WO (1) WO2021007752A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113271359A (en) * 2021-05-19 2021-08-17 北京百度网讯科技有限公司 Method and device for refreshing cache data, electronic equipment and storage medium
CN114979025A (en) * 2022-04-13 2022-08-30 网宿科技股份有限公司 Resource refreshing method, device and equipment and readable storage medium
CN115883659A (en) * 2022-12-15 2023-03-31 江苏云工场信息技术有限公司 Method and device for supporting batch refreshing of CDN cache
CN117194827A (en) * 2023-11-08 2023-12-08 联通在线信息科技有限公司 CDN directory refreshing method and electronic equipment

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861031B (en) * 2019-11-27 2024-04-02 北京金山云网络技术有限公司 URL refreshing method, device and equipment in CDN and CDN node
CN113691581B (en) * 2021-07-08 2023-05-09 杭州又拍云科技有限公司 Efficient CDN refreshing and slicing method
CN114125060B (en) * 2021-09-28 2023-10-13 北京知道创宇信息技术股份有限公司 Resource caching method and device, electronic equipment and readable storage medium
CN115022177B (en) * 2022-06-08 2023-10-24 阿里巴巴(中国)有限公司 CDN system, source returning method, CDN node and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110060881A1 (en) * 2009-09-10 2011-03-10 Red Hat, Inc. Asynchronous Cache Refresh for Systems with a Heavy Load
CN106202112A (en) * 2015-05-06 2016-12-07 阿里巴巴集团控股有限公司 CACHE DIRECTORY method for refreshing and device
CN106375471A (en) * 2016-09-29 2017-02-01 北京奇艺世纪科技有限公司 Edge node determination method and device
WO2017210123A1 (en) * 2016-06-01 2017-12-07 Home Box Office, Inc., Cached data expiration and refresh
CN107465707A (en) * 2016-06-03 2017-12-12 阿里巴巴集团控股有限公司 A kind of content refresh method and device of content distributing network

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104935680B (en) * 2015-06-18 2018-11-06 中国互联网络信息中心 A kind of the recurrence Domain Name Service System and method of multi-layer shared buffer memory
CN107277561A (en) * 2016-04-08 2017-10-20 北京优朋普乐科技有限公司 Content distributing network
CN107277092A (en) * 2016-04-08 2017-10-20 北京优朋普乐科技有限公司 Content distributing network and its data download method
CN108696895B (en) * 2017-04-07 2020-10-09 华为技术有限公司 Resource acquisition method, device and system
CN109542613A (en) * 2017-09-22 2019-03-29 中兴通讯股份有限公司 Distribution method, device and the storage medium of service dispatch in a kind of CDN node
CN108416016A (en) * 2018-03-05 2018-08-17 北京云端智度科技有限公司 A kind of CDN is by prefix caching sweep-out method and system
CN109639801A (en) * 2018-12-17 2019-04-16 深圳市网心科技有限公司 Back end distribution and data capture method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110060881A1 (en) * 2009-09-10 2011-03-10 Red Hat, Inc. Asynchronous Cache Refresh for Systems with a Heavy Load
CN106202112A (en) * 2015-05-06 2016-12-07 阿里巴巴集团控股有限公司 CACHE DIRECTORY method for refreshing and device
WO2017210123A1 (en) * 2016-06-01 2017-12-07 Home Box Office, Inc., Cached data expiration and refresh
CN107465707A (en) * 2016-06-03 2017-12-12 阿里巴巴集团控股有限公司 A kind of content refresh method and device of content distributing network
CN106375471A (en) * 2016-09-29 2017-02-01 北京奇艺世纪科技有限公司 Edge node determination method and device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113271359A (en) * 2021-05-19 2021-08-17 北京百度网讯科技有限公司 Method and device for refreshing cache data, electronic equipment and storage medium
CN114979025A (en) * 2022-04-13 2022-08-30 网宿科技股份有限公司 Resource refreshing method, device and equipment and readable storage medium
CN114979025B (en) * 2022-04-13 2023-10-24 网宿科技股份有限公司 Resource refreshing method, device, equipment and readable storage medium
CN115883659A (en) * 2022-12-15 2023-03-31 江苏云工场信息技术有限公司 Method and device for supporting batch refreshing of CDN cache
CN115883659B (en) * 2022-12-15 2023-10-03 江苏云工场信息技术有限公司 Method and device for supporting batch refreshing of CDN caches
CN117194827A (en) * 2023-11-08 2023-12-08 联通在线信息科技有限公司 CDN directory refreshing method and electronic equipment
CN117194827B (en) * 2023-11-08 2024-02-27 联通在线信息科技有限公司 CDN directory refreshing method and electronic equipment

Also Published As

Publication number Publication date
CN112513830A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
WO2021007752A1 (en) Return-to-source method and related device in content delivery network
WO2019165665A1 (en) Domain name resolution method, server and system
US9292467B2 (en) Mobile resource accelerator
US20110289126A1 (en) Content delivery network
WO2017190641A1 (en) Crawler interception method and device, server terminal and computer readable medium
US7254617B2 (en) Distributed cache between servers of a network
WO2017167050A1 (en) Configuration information generation and transmission method, and resource loading method, apparatus and system
JP7056893B2 (en) Application programming interface Methods, devices, API gateways, and programs for transmitting API requests.
WO2014056356A1 (en) Data query method, system and storage medium
US9088462B2 (en) Common web accessible data store for client side page processing
CN105930528A (en) Webpage cache method and server
TW201545520A (en) Method and system for acquiring web pages
US9703705B2 (en) Performing efficient cache invalidation
CN107135242B (en) Mongodb cluster access method, device and system
WO2014089816A1 (en) Redirection method for visiting web pages by user equipment, gateway, and server
US20190081924A1 (en) Discovering address mobility events using dynamic domain name services
WO2020238567A1 (en) Method and apparatus for resource detection
WO2015192209A1 (en) Server and method for ranking data sources
US10778565B2 (en) Forwarding current request based on, at least in part, previous request(s)
WO2019196225A1 (en) Resource file feedback method and apparatus
WO2018153236A1 (en) Method and apparatus for accelerating dynamic resource access based on api request, medium, and device
WO2010031297A1 (en) Method of wireless application protocol (wap) gateway pull service and system thereof
CN104980311A (en) Method, device and system for predicting network access
WO2022237729A1 (en) Domain name parsing method and system, electronic apparatus, device, and medium
TWI223167B (en) Distributed virtual web cache implemented entirely in software

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19937671

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19937671

Country of ref document: EP

Kind code of ref document: A1