WO2024174694A1 - Cache node scheduling method and apparatus, and device and medium - Google Patents
Cache node scheduling method and apparatus, and device and medium Download PDFInfo
- Publication number
- WO2024174694A1 WO2024174694A1 PCT/CN2023/139692 CN2023139692W WO2024174694A1 WO 2024174694 A1 WO2024174694 A1 WO 2024174694A1 CN 2023139692 W CN2023139692 W CN 2023139692W WO 2024174694 A1 WO2024174694 A1 WO 2024174694A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- node
- cache node
- parent
- cache
- request
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 93
- 238000004590 computer program Methods 0.000 claims description 24
- 230000004083 survival effect Effects 0.000 claims description 14
- 230000004044 response Effects 0.000 claims description 13
- 230000002159 abnormal effect Effects 0.000 claims description 9
- 230000005540 biological transmission Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 15
- 230000008569 process Effects 0.000 description 14
- 238000012545 processing Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1001—Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
- H04L67/1004—Server selection for load balancing
- H04L67/1023—Server selection for load balancing based on a hash applied to IP addresses or costs
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/566—Grouping or aggregating service requests, e.g. for unified processing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Definitions
- the present application relates to the technical field of content distribution networks, and in particular to a cache node scheduling method, device, equipment, and medium.
- source site resources that are farther away from users can be cached in cache nodes that are closer to users. This allows users to obtain resources nearby when requesting a resource, thereby reducing source site pressure and increasing access speed.
- CDN content delivery network
- embodiments of the present application provide a cache node scheduling method, apparatus and device, medium and product to overcome the above problems or at least partially solve the above problems.
- a cache node scheduling method which is applied to an edge layer cache node, and the method includes:
- a resource request carrying information of the second parent cache node is sent to the first parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- a second aspect of an embodiment of the present application provides a cache node scheduling method, which is applied to a parent cache node after an edge cache node performs a parent node switch, and the method includes:
- a third aspect of an embodiment of the present application provides a cache node scheduling method, which is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the method includes:
- the target resource corresponding to the pre-fetch request is cached, returning the target resource to the third node, so that the third node returns the target resource to the edge layer cache node;
- an abnormal status code is returned to the third node, so that the third node returns to the source or returns to the parent.
- a cache node scheduling device which is applied to an edge layer cache node, and the device includes:
- a request receiving module used for receiving a request for a target resource
- a DNS resolution module is used to perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from a cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource;
- a node determination module used to determine a first parent cache node according to the first analysis result and a second parent cache node according to the second analysis result when the first analysis result and the second analysis result are different;
- a resource request module is used to send a resource request carrying information of the second parent cache node to the first parent cache node when the first parent cache node is different from the second parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- a cache node scheduling device which is applied to a parent cache node after an edge cache node performs parent node switching, and the device includes:
- a first receiving module is used to receive a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;
- a first generating module configured to generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
- the first transmission module is used to receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
- a cache node scheduling device which is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the device includes:
- a pre-fetch request receiving module used for receiving a pre-fetch request from a third node, where the third node is a parent layer cache node after the edge layer cache node performs parent layer node switching;
- a first response module is used to return the target resource to the third node when the target resource corresponding to the pre-fetch request is cached, so that the third node returns the target resource to the edge layer cache node;
- the second response module is used to return an abnormal status code to the third node when there is no target resource corresponding to the cache pre-fetch request, so that the third node returns to the source or returns to the parent.
- an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the cache node scheduling method of the first aspect are implemented, or the steps of the cache node scheduling method of the second aspect are implemented, or the steps of the cache node scheduling method of the third aspect are implemented.
- a computer-readable storage medium on which a computer program/instruction is stored, and when the computer program/instruction is executed by a processor, the steps of the cache node scheduling method of the first aspect are implemented. Or implement the steps of the cache node scheduling method of the second aspect or implement the steps of the cache node scheduling method of the third aspect.
- a computer program product including a computer program/instruction, which, when executed by a processor, implements the steps of the cache node scheduling method of the first aspect, or implements the steps of the cache node scheduling method of the second aspect, or implements the steps of the cache node scheduling method of the third aspect.
- the edge layer cache node can find the second parent layer cache node that may cache the target resource in a timely manner after switching the parent layer node based on the first analysis result and the second analysis result, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after switching the parent layer node, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- FIG. 1 is a flowchart of the implementation of the existing consistent hashing scheme
- FIG2 is a flowchart of an implementation method of a cache node scheduling method in an embodiment of the present application
- FIG3 is a schematic diagram of an implementation process of a cache node scheduling method according to an embodiment of the present application.
- FIG4 is a flowchart of another cache node scheduling method in an embodiment of the present application.
- FIG5 is a flowchart of another cache node scheduling method in an embodiment of the present application.
- FIG6 is a schematic diagram of the structure of a cache node scheduling device according to an embodiment of the present application.
- FIG7 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application.
- FIG8 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application.
- FIG. 9 is a schematic diagram of an electronic device in an embodiment of the present application.
- the multi-level structural design enables the edge layer cache node and its parent layer cache node to cache resources.
- users obtain resources, if they can hit the resources of the edge layer cache node or the parent layer cache node, they can directly obtain the corresponding resources. Therefore, a high cache hit rate is a requirement for the CDN system to maintain normal services. If the resource hit rate of the CDN system is low, it will cause greater pressure on the source station, affecting the normal execution of the user's business request, and in severe cases, it will cause service failures of the CDN system.
- the existing CDN system mainly adopts the consistent hashing scheme to ensure a high resource hit rate.
- the edge layer cache node can request the target resource from its parent layer cache node if it does not cache the target resource or the cache time of the target resource exceeds the survival time.
- the edge layer cache node can construct a consistent hash ring (referred to as a hash ring) containing the domain names and IP addresses of each parent layer cache node associated with the target resource according to the DNS resolution result obtained from the Domain Name System (DNS), and obtain the corresponding IP address according to the hash value of the domain name corresponding to the target resource in the consistent hash ring and go to the corresponding parent layer cache node to obtain the target resource.
- a consistent hash ring referred to as a hash ring
- DNS Domain Name System
- the DNS resolution result obtained by the edge layer cache node usually remains unchanged. Therefore, the consistent hash ring constructed through the DNS resolution result can enable the edge layer cache node to obtain specific resources from a specific parent layer cache node (that is, a specified parent layer machine), thereby improving the resource hit rate.
- edge layer cache node Each time the edge layer cache node returns to the parent layer cache node to obtain resources (such as the cache time of the resource exceeds the configured survival time), it needs to delete the temporary information corresponding to the previously established consistent hash ring and reinitialize it (such as re-obtaining the DNS resolution result and building a consistent hash ring). This allows the edge layer cache node to build a new consistent hash ring based on the new DNS resolution result when its parent layer cache node switches, thereby obtaining resources from the new parent layer cache node.
- each resource is usually cached in only one parent cache node of the edge cache node.
- the parent cache nodes of the edge cache nodes will continue to expand.
- the DNS resolution results containing the parent cache node information will also be updated.
- the edge cache node obtains resources based on the new DNS resolution results, it may obtain resources from the parent cache node that does not cache the resource, resulting in a sudden increase in back-to-source, which affects the efficiency of normal business request execution and reduces the service performance of the cache devices in the CDN system.
- the present application proposes a cache node scheduling method, which adds automated cache node scheduling on the basis of the original consistent hashing scheme, so that when the edge layer cache node obtains resources from the new parent layer cache node due to changes in the DNS resolution results, the new parent layer cache node can first pre-fetch resources from the parent layer cache node that may cache the resource, thereby reducing the number of back-to-source times of the edge layer cache node after switching the parent layer node, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- FIG. 2 is a flowchart of an implementation of a cache node scheduling method provided in an embodiment of the present application
- the method is applied to an edge layer cache node.
- the method may include the following steps:
- Step S11 Receive a request for a target resource.
- the edge layer cache node can be directly connected to the user's client.
- the request for the target resource is the business request issued by the client.
- the edge layer cache node can also be the upper cache node (i.e., the parent cache node) of other edge layer cache nodes.
- the request for the target resource can be a return-to-parent related request issued by its lower-layer cache node, or a prefetch request issued by its same-level cache node for prefetching resources.
- Step S12 Perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from the cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource.
- the first resolution result is: the DNS resolution result obtained by the edge layer cache node after receiving the request.
- DNS resolution result is: the DNS resolution result obtained by the edge layer cache node when performing DNS resolution on the target resource before receiving the request, and the DNS resolution result obtained by performing DNS resolution on the target resource before is cached in the memory by the edge layer cache node.
- the edge layer cache node after receiving a request for a target resource, the edge layer cache node will query the DNS for information about each parent layer cache node (i.e., parent layer node) for the target resource (such as the domain name and IP address of the parent layer cache node) to obtain a first resolution result, and obtain the information about each parent layer cache node previously obtained by querying the DNS for the target resource from the cache of the edge layer cache node or the cache of the DNS to obtain a second resolution result.
- parent layer node i.e., parent layer node
- the edge layer cache node will query the DNS for information about each parent layer cache node (i.e., parent layer node) for the target resource (such as the domain name and IP address of the parent layer cache node) to obtain a first resolution result, and obtain the information about each parent layer cache node previously obtained by querying the DNS for the target resource from the cache of the edge layer cache node or the cache of the DNS to obtain a second resolution result.
- Step S13 when the first parsing result and the second parsing result are different, determining the first parent cache node according to the first parsing result, and determining the second parent cache node according to the second parsing result.
- the process of the edge layer cache node determining the parent layer cache node based on the DNS resolution results mainly includes the IP screening process, that is, the edge layer cache node will screen the IP according to the obtained DNS resolution results to find the appropriate parent layer cache node IP (such as the parent layer cache node IP with a higher resource hit rate) to obtain the target resource.
- the edge layer cache node can perceive whether its own parent layer node has been switched by comparing the first analysis result and the second analysis result, so that when the first analysis result and the second analysis result are different (i.e., the parent layer node has been switched), the parent layer cache node corresponding to the target resource before the parent layer node is switched is determined in time according to the second analysis result, and the parent layer cache node corresponding to the target resource after the parent layer node is switched is determined according to the first analysis result (i.e., the first parent layer cache node or the third node described below).
- the first analysis result i.e., the first parent layer cache node or the third node described below
- Step S14 When the first parent cache node and the second parent cache node are different, a resource request carrying information of the second parent cache node is sent to the first parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- the parent layer cache node corresponding to some resources determined by the edge layer cache node based on the DNS resolution results may not have changed (i.e., the first parent layer cache node is the same as the second parent layer cache node), which means that after the parent layer node is switched, the edge layer cache node can still hit these resources, so there is no need to pre-fetch these resources.
- the edge cache node directly returns to the first parent cache node to obtain the target resource, since the first parent cache node and the parent cache node to which the first parent cache node returns to the parent may not have cached the target resource, the edge cache node eventually needs to obtain the target resource from the source station, resulting in a sudden increase in the number of returns to the source after the parent node switches.
- the edge layer cache node in the present application will first send a resource request carrying the information of the old parent layer cache node (i.e., the second parent layer cache node) corresponding to the target resource, so as to schedule the new parent layer cache node (i.e., the first parent layer cache node) corresponding to the target resource to go to the old parent layer cache node to obtain the target resource, thereby reducing the number of return to the source after the parent layer cache node switches.
- the edge layer cache node can find the second parent layer cache node that may cache the target resource in time after the parent layer node is switched according to the first parsing result and the second parsing result, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first The parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times after the edge layer cache node switches the parent layer node, avoiding the impact on the execution efficiency of normal business requests caused by a sudden increase in back-to-source, and thus improving the service performance of the cache node.
- the embodiment of the present application provides an implementation process of a cache node scheduling method, including:
- the edge layer cache node determines whether the DNS resolution results are different or whether there is a pre-fetch request already in progress.
- the DNS when the edge layer cache node switches the parent layer node, the DNS will cache the information of the relevant parent layer cache nodes after the parent layer node is switched. Whenever the edge layer cache node receives a request for a certain resource (ie, the target resource), it will request the DNS for the information of each parent layer cache node currently associated with the target resource, obtain the DNS resolution result, and thus complete the DNS resolution of the target resource.
- a certain resource ie, the target resource
- the edge layer cache node After obtaining the DNS resolution result currently corresponding to the target resource (i.e., the first resolution result), the edge layer cache node compares the first resolution result with the DNS resolution result previously obtained from the DNS request (i.e., the second resolution result). If the first resolution result and the second resolution result are different, it means that the parent layer cache node of the edge layer cache node has changed (i.e., the edge layer cache node has switched the parent layer node).
- the DNS resolution result previously obtained from the DNS request can be saved in a database associated with the edge layer cache node (such as HostDB).
- the edge layer cache node considering that the edge layer cache node may frequently switch the parent layer node in a short period of time, at this time, in order to find the parent layer cache node that is more likely to cache the target resource, the edge layer cache node needs to obtain the information of the relevant parent layer cache node before the first parent layer node switch in the time period. Therefore, the minimum switching time (i.e., the first target time) can be added to the configuration file of the edge layer cache node to limit the edge layer cache node from updating the DNS resolution result previously obtained from the DNS request.
- the minimum switching time i.e., the first target time
- the DNS will cache the information of the relevant parent layer cache nodes before and after the parent layer node switch.
- the edge layer cache node will cache the first historical resolution result corresponding to the target resource obtained from the DNS (including the information of the relevant parent layer cache node before the parent layer node switch), and obtain the configured first target time from the configuration file.
- the edge layer cache node can directly determine the first historical resolution result as the second resolution result. It is understandable that within the first target time, no matter how many times the edge layer cache node has switched the parent layer node, the information of the relevant parent layer cache node before the first parent layer node switch will be used as the second resolution result (i.e., the update of the old hash ring, etc. is restricted) to determine the old parent layer cache node that is more likely to cache the target resource.
- the second historical resolution result is determined as the second resolution result.
- the edge cache node can use the second historical analysis result to update the cache
- the first historical parsing result is convenient for the edge layer cache node to use the second historical parsing result as the second parsing result to determine the available old parent layer cache node.
- the cache time of the edge layer cache node for the historical resolution results (such as the first historical resolution results and the second historical resolution results mentioned above) obtained after each parent layer node switch may not be limited by the survival time.
- the edge layer cache node may only obtain and cache the historical resolution results once after each parent layer node switch, and use the historical resolution results from the cache at any subsequent time.
- the corresponding survival time may also be added to the configuration file of the edge layer cache node so that the edge layer cache node obtains the historical resolution results from the DNS multiple times according to the survival time.
- the edge layer cache node caches the third historical resolution result corresponding to the target resource obtained from the DNS (i.e., the information of the relevant parent layer cache node before the parent layer node switch in the current DNS cache), and determines whether the third historical resolution result is configured with a survival time according to the configuration file.
- the edge layer cache node periodically obtains the third historical resolution result corresponding to the target resource from the DNS according to the survival time, and uses each newly obtained third historical resolution result to overwrite the third historical resolution result corresponding to the target resource cached last time. Each time the second resolution result is obtained, the edge layer cache node will determine the currently cached third historical resolution result as the second resolution result.
- the edge layer cache node can be configured to: when the cache time of the third historical resolution result exceeds the survival time and a request for the target resource is received, then the third historical resolution result corresponding to the target resource will be re-acquired, or the edge layer cache node can be configured to: when the cache time of the third historical resolution result exceeds the survival time, then the third historical resolution result corresponding to the target resource will be re-acquired), the time interval between two consecutive acquisitions of the third historical resolution result by the edge layer cache node can be the same or different.
- the edge layer cache node sends a resource request carrying the information of the corresponding old parent layer cache node to the corresponding new parent layer cache node; when the DNS resolution results are the same or there is no ongoing pre-fetch request, the edge layer cache node still obtains the target resource from the corresponding old parent layer cache node.
- the edge layer cache node can normally obtain the target resource directly from the corresponding parent layer cache node (equivalent to the corresponding old parent layer after the subsequent parent layer node is switched).
- the edge layer cache node can build the first hash ring and the second hash ring according to the corresponding DNS resolution results before and after the parent layer node is switched (i.e., the first resolution result and the second resolution result), and obtain the information (such as IP and port) of the new parent layer cache node (i.e., the first parent layer cache node) and the old parent layer cache node (i.e., the second parent layer cache node) according to the hash value of the domain name corresponding to the target resource in the first hash ring and the second hash ring.
- the above-mentioned second hash ring can be saved in the cache of DNS and/or edge cache node after establishment, so that it can be accessed at any time later.
- the edge cache node sends a resource request carrying the information of the corresponding old parent cache node to the corresponding new parent cache node to schedule the new parent cache node for resource pre-fetching.
- the parent's effective time i.e., the second target time
- the parent's effective time can be added back to the configuration file of the edge layer cache node to limit the duration of the edge layer cache node scheduling the new parent layer cache node for resource prefetching through a resource request carrying a request header (i.e., the information of the second parent layer cache node) after sensing the switching of the parent layer node.
- the edge layer cache node can obtain the configured second target time, and within the second target time after the edge layer cache node switches the parent layer node, send a resource request carrying information of the second parent layer cache node to the first parent layer cache node, wherein the information of the second parent layer cache node may include the IP and port of the second parent layer cache node.
- the new parent cache node receives a resource request carrying information of the corresponding old parent cache node, generates and sends a pre-fetch request to the old parent cache node.
- the new parent layer cache node when the new parent layer cache node processes the resource request issued by the edge layer machine, it will detect whether the resource request carries a request header. If it carries a request header and the new parent layer cache node does not cache the target resource corresponding to the resource request, it will first pre-fetch resources from the cache node corresponding to the IP in the request header.
- the parent layer cache node receives a resource request from the edge layer cache node, which carries information of the first node (i.e., the old parent layer cache node); the new parent layer cache node generates and sends a prefetch request to the first node based on the configured prefetch header and information of the first node, wherein the configured prefetch header may be a "Ctr-Pre-Request: yes" field, indicating that the request is a prefetch request, and other requests of the new parent layer cache node (such as related requests back to the parent) may add a "Ctr-Pre-Request: no" field, indicating that the request is a non-prefetch request; the new parent layer cache node receives the target resource returned by the first node for the prefetch request, and returns the target resource to the edge layer cache node.
- the configured prefetch header may be a "Ctr-Pre-Request: yes" field, indicating that the request is a prefetch request, and
- the old parent layer cache node may stop serving, at this time, the new parent layer cache node will get an abnormal status code when prefetching any resource from the old parent layer cache node. If the new parent layer cache node keeps retrying the request to the old parent layer cache node, the resource request efficiency will be greatly reduced.
- the information of the first node (such as IP) is marked as unavailable information, that is, the unavailable information represents the information of the first node marked when the edge layer node failed to obtain resources from the first node before; and before each time the first node needs to prefetch resources, first determine whether the information of the first node is unavailable information. If the information of the first node is not unavailable information, generate and send a prefetch request to the first node based on the configured prefetch header and the information of the first node.
- the new parent cache node can determine whether the IP address of the old parent cache node carried in the received resource request is available. If it is not available, it will not pre-fetch resources from the old parent cache node, but will instead return to the source and the parent according to the configuration file associated with the new parent cache node.
- the old parent cache node receives the pre-fetch request and returns the target resource corresponding to the pre-fetch request to the new parent cache node.
- the new parent cache node then returns the target resource to the corresponding edge cache node.
- the old parent cache node receives the prefetch request from the third node (i.e., the new parent cache node), and queries whether it has cached the target resource corresponding to the prefetch request. If the target resource corresponding to the prefetch request is cached, the old parent cache node returns a normal status code and the target resource to the third node, so that the third node returns the target resource to the edge cache node; if the target resource corresponding to the prefetch request is not cached, the old parent cache node returns a normal status code and the target resource to the edge cache node.
- the storage node returns an abnormal status code to the third node, so that the third node returns to the source or returns to the parent.
- the third node directly obtains the target resource from its own parent cache node; returning to the source means that the parent cache node of the third node does not cache the target resource (or does not have a valid cache of the target resource), and the parent cache node of the third node needs to continue to obtain the target resource from the upper cache node (if the cache nodes at all levels of the upper layer do not have the target resource, the target resource will eventually be obtained from the source station), and then the third node obtains the target resource from the parent cache node.
- the third node After receiving the exception status code, the third node will not retry pre-fetching resources from the old parent cache node multiple times to avoid the link becoming longer due to multiple retries, and will delete the pre-fetch header and the information of the old parent cache node carried in the pre-fetch request to generate a return-to-parent related request and send it to the return-to-parent related node (i.e., the second-layer parent cache node) to avoid the return-to-parent related node performing additional resource pre-fetching due to receiving the pre-fetch header and the information of the old parent cache node.
- the return-to-parent related node i.e., the second-layer parent cache node
- the new parent cache node when the received resource request is a shard request, the new parent cache node obtains the cache uniform resource locator (URL) of the shard corresponding to the resource request, and generates and sends a prefetch request for the corresponding shard to the old parent cache node based on the configured prefetch header, cache URL, and information of the old parent cache node.
- URL uniform resource locator
- each shard request is used to request a shard of the target resource.
- the cache node will respond to any shard request corresponding to the target resource using the query result for the index shard (such as the first shard of the target resource), that is, after the new parent layer cache node generates a pre-fetch request according to any received shard request and sends the pre-fetch request to the old parent layer cache node, the old parent layer cache node will query whether it has cached the index shard of the target resource corresponding to the pre-fetch request.
- the old parent layer cache node does not cache the shard corresponding to the pre-fetch request but caches the index shard
- the old parent layer cache node will still return a normal status code to the new parent layer cache node, but at this time the new parent layer cache node cannot obtain the corresponding shard from the old parent layer cache node, nor will it return to the source or return to the parent, resulting in the new parent layer cache node and the edge layer cache node caching the wrong resource.
- the new parent cache node in the present application will add the cache url (i.e., the Ctl-Chash-Key header referred to in Figure 3) in the received shard request to the prefetch request.
- the cache url i.e., the Ctl-Chash-Key header referred to in Figure 3
- the old parent cache node can directly query whether it has cached the shard corresponding to the prefetch request based on the cache url, thereby skipping the operation of the shard plug-in (i.e., the old parent cache node will not use the query result for the index slice to respond to the prefetch request for the shard), so that the new parent cache node can know the actual caching status of the shard in the old parent cache node through the received status code, and can return to the source or parent in time, thereby avoiding the problem of cache errors.
- the present application compares the DNS resolution results before and after the parent node switch under the scheme based on the existing consistent hashing back to the parent, and realizes the scheduling of each cache node in the CDN system through the information interaction between the edge layer node, the new parent layer cache node and the old parent layer cache node.
- the cache of the old parent layer cache node before the parent layer node switch can be obtained, and it can adapt to complete requests and shard requests without adding other configurations.
- FIG. 4 another cache node scheduling method provided by an embodiment of the present application is implemented
- the flowchart is applied to the parent layer cache node after the edge layer cache node performs parent layer node switching.
- the method may include the following steps:
- Step S21 receiving a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs parent layer node switching;
- Step S22 Generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
- Step S23 receiving the target resource returned by the first node in response to the pre-fetch request, and returning the target resource to the edge layer cache node.
- the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- the unavailable information is used to represent: information of the first node marked when the edge layer node previously failed to obtain resources from the first node;
- a prefetch request is generated and sent to the first node according to the configured prefetch header and the information of the first node.
- generating and sending a prefetch request to the first node according to the configured prefetch header and information of the first node includes:
- the resource request is a shard request
- a prefetch request for the corresponding shard is generated and sent to the first node.
- FIG. 5 a flowchart of another cache node scheduling method provided in an embodiment of the present application is provided, which is applied to a parent cache node before an edge cache node switches a parent node.
- the method may include the following steps:
- Step S31 receiving a pre-fetch request from a third node, where the third node is a parent cache node after the edge cache node has undergone parent node switching;
- Step S32 if the target resource corresponding to the pre-fetch request is cached, return the target resource to the third node, so that the third node returns the target resource to the edge layer cache node;
- Step S33 when there is no target resource corresponding to the pre-fetch request in the cache, an abnormal status code is returned to the third node, so that the third node returns to the source or returns to the parent.
- the edge layer cache node can find the second parent layer cache node that may cache the target resource in time after switching the parent layer node according to the first parsing result and the second parsing result, and By sending a resource request carrying the information of the second parent cache node to the first parent cache node, the first parent cache node can pre-fetch resources from the second parent cache node, thereby reducing the number of back-to-source times of the edge cache node after the parent node switches, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thus improving the service performance of the cache node.
- FIG6 is a schematic diagram of the structure of a cache node scheduling device according to an embodiment of the present application, the device is applied to an edge layer cache node, and the device includes:
- a request receiving module used for receiving a request for a target resource
- a DNS resolution module is used to perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from a cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource;
- a node determination module used to determine a first parent cache node according to the first analysis result and a second parent cache node according to the second analysis result when the first analysis result and the second analysis result are different;
- a resource request module is used to send a resource request carrying information of the second parent cache node to the first parent cache node when the first parent cache node is different from the second parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- the device before obtaining the second parsing result from the cache, the device further includes:
- a first acquisition module is used to cache a first historical resolution result corresponding to a target resource obtained from a DNS after the edge layer cache node switches the parent layer node, and obtain a configured first target time;
- the DNS resolution module includes:
- a first parsing submodule configured to determine the first historical parsing result as the second parsing result when the cache time of the first historical parsing result does not exceed the first target time
- the second resolution submodule is used to determine the second historical resolution result as the second resolution result when the cache time of the first historical resolution result exceeds the first target time and the second historical resolution result corresponding to the target resource reacquired from the DNS is different from the first historical resolution result.
- the device before obtaining the second parsing result from the cache, the device further includes:
- a second acquisition module is used to cache a third historical resolution result corresponding to the target resource obtained from the DNS after the edge layer cache node performs a parent layer node switch;
- a third acquisition module is used to periodically update the cached third historical analysis result corresponding to the target resource according to the survival time when the third historical analysis result is configured with a survival time;
- the DNS resolution module includes:
- the third parsing submodule is used to determine the third historical parsing result currently cached by the edge layer cache node as the second parsing result.
- the resource request module includes:
- a first resource request submodule used to obtain a configured second target time
- the second resource request submodule is used to send a resource request carrying information of the second parent cache node to the first parent cache node within a second target time after the edge cache node switches the parent node.
- the node determination module includes:
- a first determination module is used to construct a first hash ring according to the first parsing result, and obtain a second hash ring corresponding to the second parsing result from the cache of the edge layer cache node;
- the second determination module is used to determine the first parent layer cache node and the second parent layer cache node respectively according to the first hash ring and the second hash ring.
- FIG. 7 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application, the device is applied to the parent layer cache node after the edge layer cache node performs parent layer node switching, the device comprising:
- a first receiving module is used to receive a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;
- a first generating module configured to generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
- the first transmission module is used to receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
- the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- the first generation module includes:
- the first generating submodule is used to determine whether the information of the first node is unavailable information, where the unavailable information is used to represent: the information of the first node marked when the edge layer node previously failed to obtain resources from the first node;
- the second generating submodule is used to generate and send a pre-fetch request to the first node according to the configured pre-fetch header and the information of the first node when the information of the first node does not belong to unavailable information.
- the first generation module includes:
- the third generation submodule is used to obtain the cache uniform resource locator URL of the slice corresponding to the resource request when the resource request is a slice request;
- the fourth generation submodule is used to generate a pre-fetch header, a cache URL, and information of the first node according to the configuration. And send a pre-fetch request for the corresponding shard to the first node.
- FIG8 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application, the device is applied to the parent layer cache node before the edge layer cache node switches the parent layer node, and the device includes:
- a pre-fetch request receiving module used for receiving a pre-fetch request from a third node, where the third node is a parent layer cache node after the edge layer cache node performs parent layer node switching;
- a first response module is used to return the target resource to the third node when the target resource corresponding to the pre-fetch request is cached, so that the third node returns the target resource to the edge layer cache node;
- the second response module is used to return an abnormal status code to the third node when there is no target resource corresponding to the cache pre-fetch request, so that the third node returns to the source or returns to the parent.
- the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
- the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
- the present application also provides an electronic device, with reference to FIG9 , which is a schematic diagram of the electronic device proposed in the present application.
- the electronic device 100 includes: a memory 110 and a processor 120 , the memory 110 and the processor 120 are connected via a bus communication, the memory 110 stores a computer program, and the computer program can be run on the processor 120 to implement the steps in the cache node scheduling method disclosed in the present application.
- the embodiment of the present application also provides a computer-readable storage medium on which a computer program/instruction is stored.
- the cache node scheduling method disclosed in the embodiment of the present application is implemented.
- the embodiment of the present application also provides a computer program product, including a computer program/instruction, which, when executed by a processor, implements the cache node scheduling method disclosed in the embodiment of the present application.
- the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
- a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- each process and/or box in the flowchart and/or block diagram, as well as the combination of the processes and/or boxes in the flowchart and/or block diagram can be implemented by computer program instructions.
- These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing one process or multiple processes in the flowchart and/or one box in the block diagram. or a device that performs the functions specified in more than one box.
- These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
- These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Provided in the present application are a cache node scheduling method and apparatus, and a device and a medium, which aim to avoid the influence of a back-to-source sudden increase on a normal service. The method comprises: receiving a request for a target resource; performing DNS resolution on the target resource to obtain a first resolution result, and acquiring a second resolution result from a cache, wherein the second resolution result is a DNS resolution result that is previously obtained by means of performing DNS resolution on the target resource; when the first resolution result is different from the second resolution result, determining a first parent-layer cache node according to the first resolution result, and determining a second parent-layer cache node according to the second resolution result; and when the first parent-layer cache node is different from the second parent-layer cache node, sending to the first parent-layer cache node a resource request which carries information of the second parent-layer cache node, such that the first parent-layer cache node acquires the target resource from the second parent-layer cache node, and returns the target resource to an edge-layer cache node.
Description
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2023年02月24日提交中国专利局,申请号为202310163245.5,申请名称为“一种缓存节点调度方法、装置及设备、介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the China Patent Office on February 24, 2023, with application number 202310163245.5 and application name “A Cache Node Scheduling Method, Apparatus, Equipment, and Medium”, all contents of which are incorporated by reference in this application.
本申请涉及内容分发网络技术领域,特别是涉及一种缓存节点调度方法、装置及设备、介质。The present application relates to the technical field of content distribution networks, and in particular to a cache node scheduling method, device, equipment, and medium.
利用内容分发网络(CDN,Content Delivery Network)中的各个不同层级的缓存节点,可以将距离用户较远的源站资源缓存到距离用户更近的缓存节点中,使得用户在请求某个资源时,可以就近获取资源,从而达到减少源站压力,提高访问速度的目的。By utilizing cache nodes at different levels in the content delivery network (CDN), source site resources that are farther away from users can be cached in cache nodes that are closer to users. This allows users to obtain resources nearby when requesting a resource, thereby reducing source site pressure and increasing access speed.
然而,当由于机器割接和资源调整等原因而使得边缘层缓存节点的父层缓存节点发生变动(即边缘层缓存节点发生父层节点切换)时,会出现回源突增的情况,影响了正常业务请求的执行效率,降低了缓存节点的服务性能。However, when the parent cache node of the edge layer cache node changes due to machine cutover and resource adjustment (that is, the parent node of the edge layer cache node switches), a sudden increase in back-to-source traffic will occur, affecting the execution efficiency of normal business requests and reducing the service performance of the cache node.
发明内容Summary of the invention
鉴于上述问题,本申请实施例提供了一种缓存节点调度方法、装置及设备、介质和产品,以便克服上述问题或者至少部分地解决上述问题。In view of the above problems, embodiments of the present application provide a cache node scheduling method, apparatus and device, medium and product to overcome the above problems or at least partially solve the above problems.
本申请实施例的第一方面,提供了一种缓存节点调度方法,应用于边缘层缓存节点,方法包括:In a first aspect of an embodiment of the present application, a cache node scheduling method is provided, which is applied to an edge layer cache node, and the method includes:
接收针对目标资源的请求;receiving a request for a target resource;
对目标资源进行域名系统DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,第二解析结果为之前对目标资源进行DNS解析所得到的DNS解析结果;Performing a DNS resolution on the target resource to obtain a first resolution result, and obtaining a second resolution result from the cache, where the second resolution result is the DNS resolution result obtained by performing a DNS resolution on the target resource previously;
在第一解析结果和第二解析结果不相同的情况下,根据第一解析结果确定第一父层缓存节点,并根据第二解析结果确定第二父层缓存节点;When the first parsing result and the second parsing result are different, determining the first parent cache node according to the first parsing result, and determining the second parent cache node according to the second parsing result;
在第一父层缓存节点与第二父层缓存节点不相同的情况下,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求,以使第一父层缓存节点从第二父层缓存节点中获取目标资源,并将目标资源返回至边缘层缓存节点。When the first parent cache node is different from the second parent cache node, a resource request carrying information of the second parent cache node is sent to the first parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
本申请实施例的第二方面,提供了一种缓存节点调度方法,应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,方法包括:A second aspect of an embodiment of the present application provides a cache node scheduling method, which is applied to a parent cache node after an edge cache node performs a parent node switch, and the method includes:
接收边缘层缓存节点的资源请求,资源请求携带第一节点的信息,第一节点为边缘层缓存节点进行父层节点切换前的父层缓存节点;Receive a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;
根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求;Generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
接收第一节点针对预取请求返回的目标资源,并将目标资源返回至边缘层缓存节点。Receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
本申请实施例的第三方面,提供了一种缓存节点调度方法,应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,方法包括:A third aspect of an embodiment of the present application provides a cache node scheduling method, which is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the method includes:
接收第三节点的预取请求,第三节点为边缘层缓存节点进行父层节点切换后的父层
缓存节点;Receive a pre-fetch request from a third node, where the third node is the parent node of the edge layer cache node after the parent node is switched. Cache nodes;
在缓存了预取请求对应的目标资源的情况下,向第三节点返回目标资源,以使第三节点将目标资源返回至边缘层缓存节点;In the case where the target resource corresponding to the pre-fetch request is cached, returning the target resource to the third node, so that the third node returns the target resource to the edge layer cache node;
在没有缓存预取请求对应的目标资源的情况下,向第三节点返回异常状态码,以使第三节点进行回源或回父。In the case where the target resource corresponding to the pre-fetch request is not cached, an abnormal status code is returned to the third node, so that the third node returns to the source or returns to the parent.
本申请实施例的第四方面,提供了一种缓存节点调度装置,应用于边缘层缓存节点,装置包括:In a fourth aspect of an embodiment of the present application, a cache node scheduling device is provided, which is applied to an edge layer cache node, and the device includes:
请求接收模块,用于接收针对目标资源的请求;A request receiving module, used for receiving a request for a target resource;
DNS解析模块,用于对目标资源进行DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,第二解析结果为之前对目标资源进行DNS解析所得到的DNS解析结果;A DNS resolution module is used to perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from a cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource;
节点确定模块,用于在第一解析结果和第二解析结果不相同的情况下,根据第一解析结果确定第一父层缓存节点,并根据第二解析结果确定第二父层缓存节点;A node determination module, used to determine a first parent cache node according to the first analysis result and a second parent cache node according to the second analysis result when the first analysis result and the second analysis result are different;
资源请求模块,用于在第一父层缓存节点与第二父层缓存节点不相同的情况下,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求,以使第一父层缓存节点从第二父层缓存节点中获取目标资源,并将目标资源返回至边缘层缓存节点。A resource request module is used to send a resource request carrying information of the second parent cache node to the first parent cache node when the first parent cache node is different from the second parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
本申请实施例的第五方面,提供了一种缓存节点调度装置,应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,装置包括:In a fifth aspect of the embodiments of the present application, a cache node scheduling device is provided, which is applied to a parent cache node after an edge cache node performs parent node switching, and the device includes:
第一接收模块,用于接收边缘层缓存节点的资源请求,资源请求携带第一节点的信息,第一节点为边缘层缓存节点进行父层节点切换前的父层缓存节点;A first receiving module is used to receive a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;
第一生成模块,用于根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求;A first generating module, configured to generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
第一传输模块,用于接收第一节点针对预取请求返回的目标资源,并将目标资源返回至边缘层缓存节点。The first transmission module is used to receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
本申请实施例的第六方面,提供了一种缓存节点调度装置,应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,装置包括:In a sixth aspect of an embodiment of the present application, a cache node scheduling device is provided, which is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the device includes:
预取请求接收模块,用于接收第三节点的预取请求,第三节点为边缘层缓存节点进行父层节点切换后的父层缓存节点;A pre-fetch request receiving module, used for receiving a pre-fetch request from a third node, where the third node is a parent layer cache node after the edge layer cache node performs parent layer node switching;
第一响应模块,用于在缓存了预取请求对应的目标资源的情况下,向第三节点返回目标资源,以使第三节点将目标资源返回至边缘层缓存节点;A first response module is used to return the target resource to the third node when the target resource corresponding to the pre-fetch request is cached, so that the third node returns the target resource to the edge layer cache node;
第二响应模块,用于在没有缓存预取请求对应的目标资源的情况下,向第三节点返回异常状态码,以使第三节点进行回源或回父。The second response module is used to return an abnormal status code to the third node when there is no target resource corresponding to the cache pre-fetch request, so that the third node returns to the source or returns to the parent.
本申请实施例的第七方面,提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时实现如第一方面的缓存节点调度方法的步骤或实现如第二方面的缓存节点调度方法的步骤或实现如第三方面的缓存节点调度方法的步骤。In the seventh aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the cache node scheduling method of the first aspect are implemented, or the steps of the cache node scheduling method of the second aspect are implemented, or the steps of the cache node scheduling method of the third aspect are implemented.
本申请实施例的第八方面,提供了一种计算机可读存储介质,其上存储有计算机程序/指令,该计算机程序/指令被处理器执行时实现如第一方面的缓存节点调度方法的步骤
或实现如第二方面的缓存节点调度方法的步骤或实现如第三方面的缓存节点调度方法的步骤。In an eighth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program/instruction is stored, and when the computer program/instruction is executed by a processor, the steps of the cache node scheduling method of the first aspect are implemented. Or implement the steps of the cache node scheduling method of the second aspect or implement the steps of the cache node scheduling method of the third aspect.
本申请实施例的第九方面,提供了一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现如第一方面的缓存节点调度方法的步骤或实现如第二方面的缓存节点调度方法的步骤或实现如第三方面的缓存节点调度方法的步骤。In a ninth aspect of an embodiment of the present application, a computer program product is provided, including a computer program/instruction, which, when executed by a processor, implements the steps of the cache node scheduling method of the first aspect, or implements the steps of the cache node scheduling method of the second aspect, or implements the steps of the cache node scheduling method of the third aspect.
本申请实施例包括以下优点:The embodiments of the present application include the following advantages:
本实施例中,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。In this embodiment, the edge layer cache node can find the second parent layer cache node that may cache the target resource in a timely manner after switching the parent layer node based on the first analysis result and the second analysis result, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after switching the parent layer node, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thereby improving the service performance of the cache node.
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
图1是现有的一致性哈希方案的实施流程图Figure 1 is a flowchart of the implementation of the existing consistent hashing scheme
图2是本申请实施例中一种缓存节点调度方法的实施流程图;FIG2 is a flowchart of an implementation method of a cache node scheduling method in an embodiment of the present application;
图3是本申请实施例的一种缓存节点调度方法的实现过程的示意图;FIG3 is a schematic diagram of an implementation process of a cache node scheduling method according to an embodiment of the present application;
图4是本申请实施例中另一种缓存节点调度方法的实施流程图;FIG4 is a flowchart of another cache node scheduling method in an embodiment of the present application;
图5是本申请实施例中再一种缓存节点调度方法的实施流程图;FIG5 is a flowchart of another cache node scheduling method in an embodiment of the present application;
图6是本申请实施例的一种缓存节点调度装置的结构示意图;FIG6 is a schematic diagram of the structure of a cache node scheduling device according to an embodiment of the present application;
图7是本申请实施例的另一种缓存节点调度装置的结构示意图;FIG7 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application;
图8是本申请实施例的再一种缓存节点调度装置的结构示意图;FIG8 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application;
图9是本申请实施例中一种电子设备的示意图。FIG. 9 is a schematic diagram of an electronic device in an embodiment of the present application.
为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
在CDN系统中,多层级的结构设计使得边缘层缓存节点和其父层缓存节点都会缓存资源。用户在获取资源时,如果能够命中边缘层缓存节点或者父层缓存节点的资源,就可以直接获取到相应的资源,故较高的缓存命中率是CDN系统维持正常服务的要求。如果CDN系统的资源命中率较低,则会对源站造成较大的压力,影响对用户的业务请求的正常执行,严重时会导致CDN系统的服务故障。In the CDN system, the multi-level structural design enables the edge layer cache node and its parent layer cache node to cache resources. When users obtain resources, if they can hit the resources of the edge layer cache node or the parent layer cache node, they can directly obtain the corresponding resources. Therefore, a high cache hit rate is a requirement for the CDN system to maintain normal services. If the resource hit rate of the CDN system is low, it will cause greater pressure on the source station, affecting the normal execution of the user's business request, and in severe cases, it will cause service failures of the CDN system.
现有的CDN系统主要采用一致性哈希方案,以保证较高的资源命中率。如图1所示,在用户的业务请求(即针对某一资源的请求)到达边缘层缓存节点时,边缘层缓存节点在未缓存该目标资源或该目标资源的缓存时间超出存活时间时,可以向其父层缓存节点请求该目标资源。如果在该边缘层缓存节点关联的配置文件中,对其父层缓存节点采用
了域名的配置方式,则边缘层缓存节点可以根据从域名系统(DNS,Domain Name System)中获取到的DNS解析结果,构造包含该目标资源所关联的各个父层缓存节点的域名和ip的一致性哈希环(可简称为哈希环),并根据该目标资源所对应域名在一致性哈希环中的哈希(Hash)值,得到对应的ip并去相应的父层缓存节点获取该目标资源。The existing CDN system mainly adopts the consistent hashing scheme to ensure a high resource hit rate. As shown in Figure 1, when the user's business request (i.e., a request for a certain resource) reaches the edge layer cache node, the edge layer cache node can request the target resource from its parent layer cache node if it does not cache the target resource or the cache time of the target resource exceeds the survival time. If the parent layer cache node is used in the configuration file associated with the edge layer cache node, If the domain name is configured, the edge layer cache node can construct a consistent hash ring (referred to as a hash ring) containing the domain names and IP addresses of each parent layer cache node associated with the target resource according to the DNS resolution result obtained from the Domain Name System (DNS), and obtain the corresponding IP address according to the hash value of the domain name corresponding to the target resource in the consistent hash ring and go to the corresponding parent layer cache node to obtain the target resource.
可以理解的是,在边缘层缓存节点的父层缓存节点未发生变动时,该边缘层缓存节点获取到的DNS解析结果通常不变,故通过DNS解析结果所构建的一致性哈希环,可以使边缘层缓存节点向某一特定父层缓存节点(即指定父层机器)获取特定资源,从而提高资源命中率。It can be understood that when the parent cache node of the edge layer cache node does not change, the DNS resolution result obtained by the edge layer cache node usually remains unchanged. Therefore, the consistent hash ring constructed through the DNS resolution result can enable the edge layer cache node to obtain specific resources from a specific parent layer cache node (that is, a specified parent layer machine), thereby improving the resource hit rate.
边缘层缓存节点在每次重新回父层缓存节点获取资源(如资源的缓存时间超出配置的存活时间)时,需要把之前建立的一致性哈希环对应的暂存信息删除,并做重新初始化(如重新获取DNS解析结果并构建一致性哈希环),使得边缘层缓存节点在其父层缓存节点发生切换时,能够根据新的DNS解析结果,构建新的一致性哈希环,从而向新的父层缓存节点获取资源。Each time the edge layer cache node returns to the parent layer cache node to obtain resources (such as the cache time of the resource exceeds the configured survival time), it needs to delete the temporary information corresponding to the previously established consistent hash ring and reinitialize it (such as re-obtaining the DNS resolution result and building a consistent hash ring). This allows the edge layer cache node to build a new consistent hash ring based on the new DNS resolution result when its parent layer cache node switches, thereby obtaining resources from the new parent layer cache node.
基于上述一致性哈希方案,每个资源通常仅会缓存在边缘层缓存节点的一个父层缓存节点中。然而,随着业务量的增加,边缘层缓存节点的父层缓存节点也会不断扩容,而当由于机器割接和资源调整等原因导致父层缓存节点变动时,包含父层缓存节点信息的DNS解析结果也会随之更新。边缘层缓存节点在根据该新的DNS解析结果获取资源时,可能会向未缓存该资源的父层缓存节点获取资源,从而发生回源突增的情况,以致影响了正常业务请求执行的效率,且降低了CDN系统中缓存设备的服务性能。Based on the above consistent hashing scheme, each resource is usually cached in only one parent cache node of the edge cache node. However, as the business volume increases, the parent cache nodes of the edge cache nodes will continue to expand. When the parent cache nodes change due to machine cutover and resource adjustment, the DNS resolution results containing the parent cache node information will also be updated. When the edge cache node obtains resources based on the new DNS resolution results, it may obtain resources from the parent cache node that does not cache the resource, resulting in a sudden increase in back-to-source, which affects the efficiency of normal business request execution and reduces the service performance of the cache devices in the CDN system.
针对上述相关技术中存在的问题,本申请提出了一种缓存节点调度方法,在原有一致性哈希方案的基础上增加了自动化的缓存节点调度,使得边缘层缓存节点因DNS解析结果发生变化而向新的父层缓存节点获取资源时,该新的父层缓存节点可以先向可能缓存有该资源的父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成影响,进而提高缓存节点的服务性能。In response to the problems existing in the above-mentioned related technologies, the present application proposes a cache node scheduling method, which adds automated cache node scheduling on the basis of the original consistent hashing scheme, so that when the edge layer cache node obtains resources from the new parent layer cache node due to changes in the DNS resolution results, the new parent layer cache node can first pre-fetch resources from the parent layer cache node that may cache the resource, thereby reducing the number of back-to-source times of the edge layer cache node after switching the parent layer node, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thereby improving the service performance of the cache node.
下面结合附图,通过一些实施例及其应用场景对本申请实施例提供的缓存节点调度方法进行详细地说明。The cache node scheduling method provided by the embodiment of the present application is described in detail below through some embodiments and their application scenarios in combination with the accompanying drawings.
第一方面,参照图2所示,为本申请实施例所提供的一种缓存节点调度方法的实施流程图,应用于边缘层缓存节点,该方法可以包括以下步骤:In the first aspect, as shown in FIG. 2 , which is a flowchart of an implementation of a cache node scheduling method provided in an embodiment of the present application, the method is applied to an edge layer cache node. The method may include the following steps:
步骤S11:接收针对目标资源的请求。Step S11: Receive a request for a target resource.
在具体实施时,该边缘层缓存节点可以与用户的客户端直接连接,此时该针对目标资源的请求即为客户端发出的业务请求,该边缘层缓存节点也可以是其它边缘层缓存节点的上层缓存节点(即父层缓存节点),此时该针对目标资源的请求可以是其下层缓存节点发出的回父相关请求、也可以是其同层级缓存节点发出的用于预取资源的预取请求。In a specific implementation, the edge layer cache node can be directly connected to the user's client. At this time, the request for the target resource is the business request issued by the client. The edge layer cache node can also be the upper cache node (i.e., the parent cache node) of other edge layer cache nodes. At this time, the request for the target resource can be a return-to-parent related request issued by its lower-layer cache node, or a prefetch request issued by its same-level cache node for prefetching resources.
步骤S12:对目标资源进行DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,第二解析结果为之前对目标资源进行DNS解析所得到的DNS解析结果。Step S12: Perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from the cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource.
可以理解的是,对于边缘层缓存节点当前接收到的针对目标资源的请求,该第一解析结果为:边缘层缓存节点在接收到该请求之后,对该目标资源进行DNS解析所得到的
DNS解析结果;该第二解析结果为:边缘层缓存节点在接收到该请求之前,对该目标资源进行DNS解析所得到的DNS解析结果,该之前对该目标资源进行DNS解析所得到的DNS解析结果被边缘层缓存节点缓存在内存中。It can be understood that, for a request for a target resource currently received by the edge layer cache node, the first resolution result is: the DNS resolution result obtained by the edge layer cache node after receiving the request. DNS resolution result; the second resolution result is: the DNS resolution result obtained by the edge layer cache node when performing DNS resolution on the target resource before receiving the request, and the DNS resolution result obtained by performing DNS resolution on the target resource before is cached in the memory by the edge layer cache node.
在具体实施时,边缘层缓存节点在接收到针对目标资源的请求之后,会针对该目标资源向DNS查询各个父层缓存节点(即父层节点)的信息(如父层缓存节点的域名和ip),得到第一解析结果,并从该边缘层缓存节点的缓存中或DNS的缓存中,获取之前针对该目标资源向DNS查询得到的各个父层缓存节点的信息,得到第二解析结果。In the specific implementation, after receiving a request for a target resource, the edge layer cache node will query the DNS for information about each parent layer cache node (i.e., parent layer node) for the target resource (such as the domain name and IP address of the parent layer cache node) to obtain a first resolution result, and obtain the information about each parent layer cache node previously obtained by querying the DNS for the target resource from the cache of the edge layer cache node or the cache of the DNS to obtain a second resolution result.
步骤S13:在第一解析结果和第二解析结果不相同的情况下,根据第一解析结果确定第一父层缓存节点,并根据第二解析结果确定第二父层缓存节点。Step S13: when the first parsing result and the second parsing result are different, determining the first parent cache node according to the first parsing result, and determining the second parent cache node according to the second parsing result.
可以理解的是,DNS解析结果(如第一解析结果和第二解析结果)可能包含多个ip,故边缘层缓存节根据DNS解析结果确定父层缓存节点的过程主要包含了对ip的筛选过程,即边缘层缓存节点会根据获取到的DNS解析结果进行ip筛选,以找到合适的父层缓存节点的ip(如资源命中率较高的父层缓存节点的ip)去获取目标资源。It is understandable that the DNS resolution results (such as the first resolution result and the second resolution result) may contain multiple IPs. Therefore, the process of the edge layer cache node determining the parent layer cache node based on the DNS resolution results mainly includes the IP screening process, that is, the edge layer cache node will screen the IP according to the obtained DNS resolution results to find the appropriate parent layer cache node IP (such as the parent layer cache node IP with a higher resource hit rate) to obtain the target resource.
在具体实施时,考虑到父层节点切换前目标资源对应的父层缓存节点(即第二父层缓存节点或下述第一节点)有较大可能缓存了该目标资源,故边缘层缓存节点通过比较第一解析结果和第二解析结果,可以感知到自身的父层节点是否进行过切换,以便在第一解析结果和第二解析结果不相同(即父层节点进行过切换)的情况下,及时根据该第二解析结果,确定出父层节点切换前该目标资源对应的父层缓存节点,并根据该第一解析结果,确定出父层节点切换后该目标资源对应的父层缓存节点(即第一父层缓存节点或下述第三节点)。In the specific implementation, considering that the parent layer cache node corresponding to the target resource before the parent layer node switches (i.e., the second parent layer cache node or the first node described below) is more likely to have cached the target resource, the edge layer cache node can perceive whether its own parent layer node has been switched by comparing the first analysis result and the second analysis result, so that when the first analysis result and the second analysis result are different (i.e., the parent layer node has been switched), the parent layer cache node corresponding to the target resource before the parent layer node is switched is determined in time according to the second analysis result, and the parent layer cache node corresponding to the target resource after the parent layer node is switched is determined according to the first analysis result (i.e., the first parent layer cache node or the third node described below).
步骤S14:在第一父层缓存节点与第二父层缓存节点不相同的情况下,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求,以使第一父层缓存节点从第二父层缓存节点中获取目标资源,并将目标资源返回至边缘层缓存节点。Step S14: When the first parent cache node and the second parent cache node are different, a resource request carrying information of the second parent cache node is sent to the first parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
可以理解的是,父层节点切换前后,边缘层缓存节点根据DNS解析结果(即第一解析结果和第二解析结果),确定出的部分资源对应的父层缓存节点可能未发生变动(即第一父层缓存节点与第二父层缓存节点相同),说明在父层节点切换后,边缘层缓存节点仍可命中该部分资源,故无需对该部分资源进行资源预取。It is understandable that before and after the parent layer node is switched, the parent layer cache node corresponding to some resources determined by the edge layer cache node based on the DNS resolution results (i.e., the first resolution result and the second resolution result) may not have changed (i.e., the first parent layer cache node is the same as the second parent layer cache node), which means that after the parent layer node is switched, the edge layer cache node can still hit these resources, so there is no need to pre-fetch these resources.
考虑到在第一父层缓存节点与第二父层缓存节点不相同的情况下,若边缘层缓存节点直接回父至该第一父层缓存节点获取目标资源,由于该第一父层缓存节点、以及该第一父层缓存节点进行回父的父层缓存节点可能均未缓存该目标资源,以致该边缘层缓存节点最终需要从源站获取该目标资源,从而造成父层节点切换后回源突增的情况。Considering that the first parent cache node and the second parent cache node are different, if the edge cache node directly returns to the first parent cache node to obtain the target resource, since the first parent cache node and the parent cache node to which the first parent cache node returns to the parent may not have cached the target resource, the edge cache node eventually needs to obtain the target resource from the source station, resulting in a sudden increase in the number of returns to the source after the parent node switches.
故本申请中的边缘层缓存节点在父层缓存节点发生切换时,会先发出携带了目标资源对应的旧父层缓存节点(即第二父层缓存节点)的信息的资源请求,以调度目标资源对应的新父层缓存节点(即第一父层缓存节点)去旧父层缓存节点获取该目标资源,从而减少父层缓存节点切换后的回源次数。Therefore, when the parent layer cache node switches, the edge layer cache node in the present application will first send a resource request carrying the information of the old parent layer cache node (i.e., the second parent layer cache node) corresponding to the target resource, so as to schedule the new parent layer cache node (i.e., the first parent layer cache node) corresponding to the target resource to go to the old parent layer cache node to obtain the target resource, thereby reducing the number of return to the source after the parent layer cache node switches.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一
父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can find the second parent layer cache node that may cache the target resource in time after the parent layer node is switched according to the first parsing result and the second parsing result, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first The parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times after the edge layer cache node switches the parent layer node, avoiding the impact on the execution efficiency of normal business requests caused by a sudden increase in back-to-source, and thus improving the service performance of the cache node.
以下结合图3,对上述技术方案作进一步说明。如图3所示,本申请实施例提供了一种缓存节点调度方法的实现过程,包括:The above technical solution is further described below in conjunction with Figure 3. As shown in Figure 3, the embodiment of the present application provides an implementation process of a cache node scheduling method, including:
(1)边缘层缓存节点判断DNS解析结果是否有不同或是否有已经在进行的预取请求。(1) The edge layer cache node determines whether the DNS resolution results are different or whether there is a pre-fetch request already in progress.
在具体实施时,边缘层缓存节点进行父层节点切换时,DNS会对应缓存父层节点切换后相关父层缓存节点的信息,每当边缘层缓存节点接收到针对某一资源(即目标资源)的请求时,会向DNS请求该目标资源当前所关联的各个父层缓存节点的信息,得到DNS解析结果,从而完成对该目标资源的DNS解析。In the specific implementation, when the edge layer cache node switches the parent layer node, the DNS will cache the information of the relevant parent layer cache nodes after the parent layer node is switched. Whenever the edge layer cache node receives a request for a certain resource (ie, the target resource), it will request the DNS for the information of each parent layer cache node currently associated with the target resource, obtain the DNS resolution result, and thus complete the DNS resolution of the target resource.
在得到该目标资源当前所对应的DNS解析结果(即第一解析结果)之后,边缘层缓存节点将第一解析结果和之前向DNS请求得到的DNS解析结果(即第二解析结果)进行比较,若第一解析结果和第二解析结果不相同,则说明边缘层缓存节点的父层缓存节点发生了变动(即边缘层缓存节点进行了父层节点切换),其中,该之前向DNS请求得到的DNS解析结果可以保存在边缘层缓存节点关联的数据库(如HostDB)中。After obtaining the DNS resolution result currently corresponding to the target resource (i.e., the first resolution result), the edge layer cache node compares the first resolution result with the DNS resolution result previously obtained from the DNS request (i.e., the second resolution result). If the first resolution result and the second resolution result are different, it means that the parent layer cache node of the edge layer cache node has changed (i.e., the edge layer cache node has switched the parent layer node). The DNS resolution result previously obtained from the DNS request can be saved in a database associated with the edge layer cache node (such as HostDB).
作为一种可能的实施方式,考虑到边缘层缓存节点可能会在短时间内频繁进行父层节点切换,此时边缘层缓存节点为找到有较大可能缓存了目标资源的父层缓存节点,需要获取到该时间段内第一次进行父层节点切换前相关父层缓存节点的信息,故可以在边缘层缓存节点的配置文件中添加最小切换时间(即第一目标时间),以限制边缘层缓存节点对之前向DNS请求得到的DNS解析结果的更新。As a possible implementation method, considering that the edge layer cache node may frequently switch the parent layer node in a short period of time, at this time, in order to find the parent layer cache node that is more likely to cache the target resource, the edge layer cache node needs to obtain the information of the relevant parent layer cache node before the first parent layer node switch in the time period. Therefore, the minimum switching time (i.e., the first target time) can be added to the configuration file of the edge layer cache node to limit the edge layer cache node from updating the DNS resolution result previously obtained from the DNS request.
示例性地,边缘层缓存节点每次进行父层节点切换时,DNS会对应缓存父层节点切换前后相关父层缓存节点的信息。在某一时间段内,边缘层缓存节点进行第一次父层节点切换之后,边缘层缓存节点将缓存从DNS中获取到的目标资源对应的第一历史解析结果(包含该次父层节点切换前相关父层缓存节点的信息),并从配置文件中获取配置的第一目标时间。Exemplarily, each time the edge layer cache node switches the parent layer node, the DNS will cache the information of the relevant parent layer cache nodes before and after the parent layer node switch. Within a certain time period, after the edge layer cache node switches the parent layer node for the first time, the edge layer cache node will cache the first historical resolution result corresponding to the target resource obtained from the DNS (including the information of the relevant parent layer cache node before the parent layer node switch), and obtain the configured first target time from the configuration file.
在该第一历史解析结果的缓存时间未超出第一目标时间的情况下,边缘层缓存节点可以将该第一历史解析结果直接确定为第二解析结果。可以理解的是,在该第一目标时间之内,无论该边缘层缓存节点进行过多少次父层节点切换,都将使用第一次父层节点切换前相关父层缓存节点的信息作为第二解析结果(即对旧哈希环等更新进行限制),以确定出更有可能缓存了目标资源的旧父层缓存节点。In the case where the cache time of the first historical resolution result does not exceed the first target time, the edge layer cache node can directly determine the first historical resolution result as the second resolution result. It is understandable that within the first target time, no matter how many times the edge layer cache node has switched the parent layer node, the information of the relevant parent layer cache node before the first parent layer node switch will be used as the second resolution result (i.e., the update of the old hash ring, etc. is restricted) to determine the old parent layer cache node that is more likely to cache the target resource.
在第一历史解析结果的缓存时间超出第一目标时间,且从DNS中重新获取到的目标资源对应的第二历史解析结果与第一历史解析结果不同的情况下,将第二历史解析结果确定为第二解析结果。When the cache time of the first historical resolution result exceeds the first target time and the second historical resolution result corresponding to the target resource reacquired from the DNS is different from the first historical resolution result, the second historical resolution result is determined as the second resolution result.
可以理解的是,为减少确定出的旧父层缓存节点为不可用的节点(如已完成机器割接并被删除的节点),在经过该第一目标时间之后,若边缘层缓存节点再次进行父层节点切换,且使得该次父层节点切换前相关父层缓存节点的信息(即第二历史解析结果)与第一历史解析结果不同时,则边缘层缓存节点可以利用该第二历史解析结果更新缓存
的第一历史解析结果,便于边缘层缓存节点使用该第二历史解析结果作为第二解析结果,以确定可用的旧父层缓存节点。It can be understood that in order to reduce the number of old parent cache nodes that are determined to be unavailable nodes (such as nodes that have completed machine cutover and have been deleted), after the first target time, if the edge cache node switches the parent node again, and the information of the relevant parent cache node before the secondary parent node switch (i.e., the second historical analysis result) is different from the first historical analysis result, the edge cache node can use the second historical analysis result to update the cache The first historical parsing result is convenient for the edge layer cache node to use the second historical parsing result as the second parsing result to determine the available old parent layer cache node.
需要说明的是,边缘层缓存节点对于每次进行父层节点切换后得到的历史解析结果(如上述第一历史解析结果和第二历史解析结果)的缓存时间可以不受存活时间的限制,如边缘层缓存节点可以在每次进行父层节点切换后仅获取并缓存一次历史解析结果,并在后续任意的时间内从缓存中取用该历史解析结果。也可以在边缘层缓存节点的配置文件中添加对应的存活时间,以使边缘层缓存节点根据该存活时间向DNS多次获取历史解析结果。It should be noted that the cache time of the edge layer cache node for the historical resolution results (such as the first historical resolution results and the second historical resolution results mentioned above) obtained after each parent layer node switch may not be limited by the survival time. For example, the edge layer cache node may only obtain and cache the historical resolution results once after each parent layer node switch, and use the historical resolution results from the cache at any subsequent time. The corresponding survival time may also be added to the configuration file of the edge layer cache node so that the edge layer cache node obtains the historical resolution results from the DNS multiple times according to the survival time.
例如,在边缘层缓存节点进行一次父层节点切换之后,边缘层缓存节点缓存从DNS中获取到的目标资源对应的第三历史解析结果(即DNS当前缓存中父层节点切换前相关父层缓存节点的信息),根据配置文件确定该第三历史解析结果是否配置了存活时间。在第三历史解析结果配置了存活时间的情况下,边缘层缓存节点根据该存活时间从DNS中周期性地获取目标资源对应的第三历史解析结果,并利用每次新获取到的第三历史解析结果覆盖上一次缓存的目标资源对应的第三历史解析结果。在每次获取第二解析结果时,边缘层缓存节点会将当前缓存的第三历史解析结果,确定为第二解析结果。For example, after the edge layer cache node performs a parent layer node switch, the edge layer cache node caches the third historical resolution result corresponding to the target resource obtained from the DNS (i.e., the information of the relevant parent layer cache node before the parent layer node switch in the current DNS cache), and determines whether the third historical resolution result is configured with a survival time according to the configuration file. In the case where the third historical resolution result is configured with a survival time, the edge layer cache node periodically obtains the third historical resolution result corresponding to the target resource from the DNS according to the survival time, and uses each newly obtained third historical resolution result to overwrite the third historical resolution result corresponding to the target resource cached last time. Each time the second resolution result is obtained, the edge layer cache node will determine the currently cached third historical resolution result as the second resolution result.
可以理解的是,根据配置的触发历史解析结果获取的条件的不同(如边缘层缓存节点可以被配置为:在第三历史解析结果的缓存时间超过存活时间,且收到了针对目标资源的请求时,才重新获取该目标资源对应的第三历史解析结果,或边缘层缓存节点可以被配置为:在第三历史解析结果的缓存时间超过存活时间时,重新获取该目标资源对应的第三历史解析结果),边缘层缓存节点相邻两次获取第三历史解析结果的相隔时间可以相同也可以不同。It can be understood that, depending on the different configured conditions for triggering the acquisition of historical resolution results (such as the edge layer cache node can be configured to: when the cache time of the third historical resolution result exceeds the survival time and a request for the target resource is received, then the third historical resolution result corresponding to the target resource will be re-acquired, or the edge layer cache node can be configured to: when the cache time of the third historical resolution result exceeds the survival time, then the third historical resolution result corresponding to the target resource will be re-acquired), the time interval between two consecutive acquisitions of the third historical resolution result by the edge layer cache node can be the same or different.
(2)在DNS解析结果有不同或有已经在进行的预取请求的情况下,边缘层缓存节点向对应的新父层缓存节点发送携带了对应的旧父层缓存节点的信息的资源请求;在DNS解析结果相同或没有已经在进行的预取请求的情况下,边缘层缓存节点仍然向对应的旧父层缓存节点获取目标资源。(2) When the DNS resolution results are different or there is an ongoing pre-fetch request, the edge layer cache node sends a resource request carrying the information of the corresponding old parent layer cache node to the corresponding new parent layer cache node; when the DNS resolution results are the same or there is no ongoing pre-fetch request, the edge layer cache node still obtains the target resource from the corresponding old parent layer cache node.
在具体实施时,DNS解析结果相同或没有已经在进行的预取请求,则说明边缘层缓存节点回父的具体节点未变化,此时边缘层缓存节点可以正常向对应的父层缓存节点(相当于后续父层节点切换后对应的旧父层)直接获取目标资源。In the specific implementation, if the DNS resolution result is the same or there is no pre-fetch request in progress, it means that the specific node of the edge layer cache node back to the parent has not changed. At this time, the edge layer cache node can normally obtain the target resource directly from the corresponding parent layer cache node (equivalent to the corresponding old parent layer after the subsequent parent layer node is switched).
在DNS解析结果有不同或有已经在进行的预取请求的情况下,边缘层缓存节点可以根据父层节点切换前后对应的DNS解析结果(即第一解析结果和第二解析结果)构建第一哈希环和第二哈希环,并根据第一哈希环和第二哈希环中目标资源对应域名的Hash值,分别得到新父层缓存节点(即第一父层缓存节点)和旧父层缓存节点(即第二父层缓存节点)的信息(如ip和端口)。其中,上述第二哈希环在建立后可以保存在DNS和/或边缘缓存节点的缓存中,以便后续随时取用。In the case where the DNS resolution results are different or there is an ongoing pre-fetch request, the edge layer cache node can build the first hash ring and the second hash ring according to the corresponding DNS resolution results before and after the parent layer node is switched (i.e., the first resolution result and the second resolution result), and obtain the information (such as IP and port) of the new parent layer cache node (i.e., the first parent layer cache node) and the old parent layer cache node (i.e., the second parent layer cache node) according to the hash value of the domain name corresponding to the target resource in the first hash ring and the second hash ring. Among them, the above-mentioned second hash ring can be saved in the cache of DNS and/or edge cache node after establishment, so that it can be accessed at any time later.
如果从第一哈希环和第二哈希环中得到的目标资源对应域名的Hash值不同,和/或新父层缓存节点和旧父层缓存节点的信息不同,则说明父层缓存节点的变动影响到了边缘层缓存节点回父的具体节点,则边缘层缓存节点向对应的新父层缓存节点发送携带了对应的旧父层缓存节点的信息的资源请求,以调度新父层缓存节点进行资源预取。
If the hash values of the domain names corresponding to the target resources obtained from the first hash ring and the second hash ring are different, and/or the information of the new parent cache node is different from that of the old parent cache node, it means that the change of the parent cache node affects the specific node of the edge cache node back to the parent. Then, the edge cache node sends a resource request carrying the information of the corresponding old parent cache node to the corresponding new parent cache node to schedule the new parent cache node for resource pre-fetching.
作为一种可能的实施方式,可以在边缘层缓存节点的配置文件中添加回父的有效时间(即第二目标时间),以限制边缘层缓存节点在感知到父层节点切换后,通过携带请求头(即第二父层缓存节点的信息)的资源请求调度新父层缓存节点进行资源预取的持续时间。As a possible implementation method, the parent's effective time (i.e., the second target time) can be added back to the configuration file of the edge layer cache node to limit the duration of the edge layer cache node scheduling the new parent layer cache node for resource prefetching through a resource request carrying a request header (i.e., the information of the second parent layer cache node) after sensing the switching of the parent layer node.
示例性地,边缘层缓存节点可以获取配置的第二目标时间,在边缘层缓存节点进行父层节点切换之后的第二目标时间内,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求,其中,该第二父层缓存节点的信息可以包括第二父层缓存节点的ip和端口。Exemplarily, the edge layer cache node can obtain the configured second target time, and within the second target time after the edge layer cache node switches the parent layer node, send a resource request carrying information of the second parent layer cache node to the first parent layer cache node, wherein the information of the second parent layer cache node may include the IP and port of the second parent layer cache node.
(3)新父层缓存节点接收携带了对应的旧父层缓存节点的信息的资源请求,生成并向该旧父层缓存节点发送预取请求。(3) The new parent cache node receives a resource request carrying information of the corresponding old parent cache node, generates and sends a pre-fetch request to the old parent cache node.
在具体实施时,新父层缓存节点在处理边缘层机器发出的资源请求时,会检测该资源请求是否携带了请求头,如果携带了请求头,且新父层缓存节点未缓存该资源请求对应的目标资源,会先向该请求头中ip对应的缓存节点进行资源预取。In the specific implementation, when the new parent layer cache node processes the resource request issued by the edge layer machine, it will detect whether the resource request carries a request header. If it carries a request header and the new parent layer cache node does not cache the target resource corresponding to the resource request, it will first pre-fetch resources from the cache node corresponding to the IP in the request header.
示例性地,边缘层缓存节点进行父层节点切换后的父层缓存节点(即新父层缓存节点)接收边缘层缓存节点的资源请求,该资源请求携带第一节点(即旧父层缓存节点)的信息;新父层缓存节点根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求,其中,该配置的预取头部可以为“Ctr-Pre-Request:yes”字段,表示该请求为预取请求,而该新父层缓存节点的其它请求(如回父的相关请求)可以添加“Ctr-Pre-Request:no”字段,表示该请求为非预取请求;新父层缓存节点接收第一节点针对预取请求返回的目标资源,并将该目标资源返回至边缘层缓存节点。Exemplarily, after the edge layer cache node performs a parent layer node switch, the parent layer cache node (i.e., the new parent layer cache node) receives a resource request from the edge layer cache node, which carries information of the first node (i.e., the old parent layer cache node); the new parent layer cache node generates and sends a prefetch request to the first node based on the configured prefetch header and information of the first node, wherein the configured prefetch header may be a "Ctr-Pre-Request: yes" field, indicating that the request is a prefetch request, and other requests of the new parent layer cache node (such as related requests back to the parent) may add a "Ctr-Pre-Request: no" field, indicating that the request is a non-prefetch request; the new parent layer cache node receives the target resource returned by the first node for the prefetch request, and returns the target resource to the edge layer cache node.
作为一种可能的实施方式,考虑到边缘层缓存节点进行父层节点切换后,旧父层缓存节点可能存在停止服务的情况,此时新父层缓存节点向旧父层缓存节点进行任意资源的预取都会得到异常状态码,若新父层缓存节点不断对该旧父层缓存节点重试请求,则会极大地降低资源请求效率。故新父层缓存节点在向第一节点获取资源失败(如收到针对任意资源的预取请求的异常状态码)的情况下,将第一节点的信息(如ip)标记为不可用信息,即该不可用信息表征了边缘层节点之前向第一节点获取资源失败时,所标记的第一节点的信息;并在每次需要向该第一节点预取资源前,先判断该第一节点的信息是否属于不可用信息,在第一节点的信息不属于不可用信息的情况下,根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求。As a possible implementation method, considering that after the edge layer cache node switches the parent layer node, the old parent layer cache node may stop serving, at this time, the new parent layer cache node will get an abnormal status code when prefetching any resource from the old parent layer cache node. If the new parent layer cache node keeps retrying the request to the old parent layer cache node, the resource request efficiency will be greatly reduced. Therefore, when the new parent layer cache node fails to obtain resources from the first node (such as receiving an abnormal status code for a prefetch request for any resource), the information of the first node (such as IP) is marked as unavailable information, that is, the unavailable information represents the information of the first node marked when the edge layer node failed to obtain resources from the first node before; and before each time the first node needs to prefetch resources, first determine whether the information of the first node is unavailable information. If the information of the first node is not unavailable information, generate and send a prefetch request to the first node based on the configured prefetch header and the information of the first node.
示例性地,新父层缓存节点可以判断接收到的资源请求所携带的旧父层缓存节点的IP是否可用,如果不可用则不会向该旧父层缓存节点进行资源预取,而是按照该新父层缓存节点关联的配置文件进行回源和回父。Exemplarily, the new parent cache node can determine whether the IP address of the old parent cache node carried in the received resource request is available. If it is not available, it will not pre-fetch resources from the old parent cache node, but will instead return to the source and the parent according to the configuration file associated with the new parent cache node.
(4)旧父层缓存节点接收预取请求,并向新父层缓存节点返回该预取请求对应的目标资源,该新父层缓存节点随后将该目标资源返回至对应的边缘层缓存节点。(4) The old parent cache node receives the pre-fetch request and returns the target resource corresponding to the pre-fetch request to the new parent cache node. The new parent cache node then returns the target resource to the corresponding edge cache node.
在具体实施时,旧父层缓存节点接收第三节点(即新父层缓存节点)的预取请求,并查询自身是否缓存该预取请求对应的目标资源。在缓存了预取请求对应的目标资源的情况下,旧父层缓存节点向第三节点返回正常状态码和目标资源,以使第三节点将目标资源返回至边缘层缓存节点;在没有缓存预取请求对应的目标资源的情况下,旧父层缓
存节点向第三节点返回异常状态码,以使第三节点进行回源或回父。其中,回父是指:第三节点从自身的父层缓存节点中直接获取到目标资源;回源是指:第三节点的父层缓存节点未缓存该目标资源(或没有该目标资源的有效缓存),需要先由该第三节点的父层缓存节点继续向上层缓存节点获取目标资源(若上层的各层级缓存节点均无该目标资源的情况下,会最终从源站获取到目标资源)之后,第三节点再从该父层缓存节点中获取到目标资源。In specific implementation, the old parent cache node receives the prefetch request from the third node (i.e., the new parent cache node), and queries whether it has cached the target resource corresponding to the prefetch request. If the target resource corresponding to the prefetch request is cached, the old parent cache node returns a normal status code and the target resource to the third node, so that the third node returns the target resource to the edge cache node; if the target resource corresponding to the prefetch request is not cached, the old parent cache node returns a normal status code and the target resource to the edge cache node. The storage node returns an abnormal status code to the third node, so that the third node returns to the source or returns to the parent. Returning to the parent means that the third node directly obtains the target resource from its own parent cache node; returning to the source means that the parent cache node of the third node does not cache the target resource (or does not have a valid cache of the target resource), and the parent cache node of the third node needs to continue to obtain the target resource from the upper cache node (if the cache nodes at all levels of the upper layer do not have the target resource, the target resource will eventually be obtained from the source station), and then the third node obtains the target resource from the parent cache node.
第三节点在收到异常状态码后,不会对该旧父层缓存节点进行多次预取资源的重试,以避免因多次重试造成的链路变长,并删除该预取请求中携带的预取头部和该旧父层缓存节点的信息,以生成回父相关请求并将其发送至回父的相关节点(即二层父缓存节点),避免该回父的相关节点由于收到预取头部和该旧父层缓存节点的信息进行额外的资源预取。After receiving the exception status code, the third node will not retry pre-fetching resources from the old parent cache node multiple times to avoid the link becoming longer due to multiple retries, and will delete the pre-fetch header and the information of the old parent cache node carried in the pre-fetch request to generate a return-to-parent related request and send it to the return-to-parent related node (i.e., the second-layer parent cache node) to avoid the return-to-parent related node performing additional resource pre-fetching due to receiving the pre-fetch header and the information of the old parent cache node.
作为一种可能的实施方式,在接收到的资源请求为分片请求的情况下,新父层缓存节点获取资源请求所对应分片的缓存统一资源定位器(url,uniform resource locator),根据配置的预取头部、缓存url、以及旧父层缓存节点的信息,生成并向旧父层缓存节点发送对应分片的预取请求。As a possible implementation method, when the received resource request is a shard request, the new parent cache node obtains the cache uniform resource locator (URL) of the shard corresponding to the resource request, and generates and sends a prefetch request for the corresponding shard to the old parent cache node based on the configured prefetch header, cache URL, and information of the old parent cache node.
可以理解的是,考虑到边缘层缓存节点可能根据接收到的针对目标资源的请求,生成多个分片请求,每个分片请求用于请求该目标资源的一个分片。而在现有的CDN系统中,缓存节点会利用针对索引片(如目标资源的第一个分片)的查询结果响应目标资源对应的任意分片请求,也即是说,新父层缓存节点根据接收到的任意分片请求生成预取请求,并将该预取请求发送至旧父层缓存节点之后,旧父层缓存节点会查询自身是否缓存了该预取请求对应的目标资源的索引片,在旧父层缓存节点未缓存该预取请求对应的分片,但缓存了该索引片的情况下,旧父层缓存节点仍会向该新父层缓存节点返回正常的状态码,但此时新父层缓存节点无法从旧父层缓存节点获取到对应的分片,也不会进行回源或回父,从而导致新父层缓存节点和边缘层缓存节点缓存了错误的资源。It is understandable that, considering that the edge layer cache node may generate multiple shard requests according to the received request for the target resource, each shard request is used to request a shard of the target resource. In the existing CDN system, the cache node will respond to any shard request corresponding to the target resource using the query result for the index shard (such as the first shard of the target resource), that is, after the new parent layer cache node generates a pre-fetch request according to any received shard request and sends the pre-fetch request to the old parent layer cache node, the old parent layer cache node will query whether it has cached the index shard of the target resource corresponding to the pre-fetch request. In the case that the old parent layer cache node does not cache the shard corresponding to the pre-fetch request but caches the index shard, the old parent layer cache node will still return a normal status code to the new parent layer cache node, but at this time the new parent layer cache node cannot obtain the corresponding shard from the old parent layer cache node, nor will it return to the source or return to the parent, resulting in the new parent layer cache node and the edge layer cache node caching the wrong resource.
为了避免出现上述缓存错误资源的情况,本申请中的新父层缓存节点会将接收到的分片请求中的缓存url(即图3中所指的Ctl-Chash-Key头部)添加到预取请求中,旧父层缓存节点根据该缓存url可以直接查询自身是否缓存了该预取请求对应的分片,从而跳过分片插件的操作(即旧父层缓存节点不会使用针对索引片的查询结果响应针对分片的预取请求),使得新父层缓存节点可以通过接收到的状态码知晓分片在旧父层缓存节点中的实际缓存情况,并能够及时进行回源或回父,从而避免出现缓存错误的问题。In order to avoid the above-mentioned situation of caching wrong resources, the new parent cache node in the present application will add the cache url (i.e., the Ctl-Chash-Key header referred to in Figure 3) in the received shard request to the prefetch request. The old parent cache node can directly query whether it has cached the shard corresponding to the prefetch request based on the cache url, thereby skipping the operation of the shard plug-in (i.e., the old parent cache node will not use the query result for the index slice to respond to the prefetch request for the shard), so that the new parent cache node can know the actual caching status of the shard in the old parent cache node through the received status code, and can return to the source or parent in time, thereby avoiding the problem of cache errors.
基于上述实施例,本申请在基于现有一致性哈希回父的方案下,将父层节点切换前后的DNS解析结果进行对比,通过边缘层节点、新父层缓存节点和旧父层缓存节点之间的信息交互,实现对CDN系统中各个缓存节点的调度,且通过同层缓存节点在组间预取资源,可以获得父层节点切换前旧父层缓存节点的缓存,并且可以适应完整请求和分片请求,无需增加其他配置,解决了原方案逻辑中在父层节点切换后会造成回源突增的问题,可以适应短时间内多次切换父层节点的情况,无需手动增加父层缓存节点平摊资源的缓存,完成了自动化的缓存节点调度。Based on the above embodiments, the present application compares the DNS resolution results before and after the parent node switch under the scheme based on the existing consistent hashing back to the parent, and realizes the scheduling of each cache node in the CDN system through the information interaction between the edge layer node, the new parent layer cache node and the old parent layer cache node. By pre-fetching resources between groups through the same-layer cache nodes, the cache of the old parent layer cache node before the parent layer node switch can be obtained, and it can adapt to complete requests and shard requests without adding other configurations. It solves the problem of a sudden increase in the source return after the parent layer node is switched in the logic of the original scheme, and can adapt to the situation of switching the parent layer node multiple times in a short period of time. There is no need to manually increase the cache of the parent layer cache node to spread the resources, and the automatic cache node scheduling is completed.
第二方面,参照图4所示,为本申请实施例所提供的另一种缓存节点调度方法的实
施流程图,应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,该方法可以包括以下步骤:In the second aspect, as shown in FIG. 4, another cache node scheduling method provided by an embodiment of the present application is implemented The flowchart is applied to the parent layer cache node after the edge layer cache node performs parent layer node switching. The method may include the following steps:
步骤S21:接收边缘层缓存节点的资源请求,资源请求携带第一节点的信息,第一节点为边缘层缓存节点进行父层节点切换前的父层缓存节点;Step S21: receiving a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs parent layer node switching;
步骤S22:根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求;Step S22: Generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
步骤S23:接收第一节点针对预取请求返回的目标资源,并将目标资源返回至边缘层缓存节点。Step S23: receiving the target resource returned by the first node in response to the pre-fetch request, and returning the target resource to the edge layer cache node.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
作为一种可能的实施方式,As a possible implementation,
根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求,包括:Generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node, including:
判断第一节点的信息是否属于不可用信息,不可用信息用于表征:边缘层节点之前向第一节点获取资源失败时所标记的第一节点的信息;Determine whether the information of the first node is unavailable information, where the unavailable information is used to represent: information of the first node marked when the edge layer node previously failed to obtain resources from the first node;
在第一节点的信息不属于不可用信息的情况下,根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求。When the information of the first node does not belong to unavailable information, a prefetch request is generated and sent to the first node according to the configured prefetch header and the information of the first node.
作为一种可能的实施方式,根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求,包括:As a possible implementation, generating and sending a prefetch request to the first node according to the configured prefetch header and information of the first node includes:
在资源请求为分片请求的情况下,获取资源请求所对应分片的缓存统一资源定位器url;When the resource request is a shard request, obtain the cache uniform resource locator URL of the shard corresponding to the resource request;
根据配置的预取头部、缓存url、以及第一节点的信息,生成并向第一节点发送对应分片的预取请求。According to the configured prefetch header, cache URL, and information of the first node, a prefetch request for the corresponding shard is generated and sent to the first node.
第三方面,参照图5所示,为本申请实施例所提供的再一种缓存节点调度方法的实施流程图,应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,该方法可以包括以下步骤:In a third aspect, as shown in FIG. 5 , a flowchart of another cache node scheduling method provided in an embodiment of the present application is provided, which is applied to a parent cache node before an edge cache node switches a parent node. The method may include the following steps:
步骤S31:接收第三节点的预取请求,第三节点为边缘层缓存节点进行父层节点切换后的父层缓存节点;Step S31: receiving a pre-fetch request from a third node, where the third node is a parent cache node after the edge cache node has undergone parent node switching;
步骤S32:在缓存了预取请求对应的目标资源的情况下,向第三节点返回目标资源,以使第三节点将目标资源返回至边缘层缓存节点;Step S32: if the target resource corresponding to the pre-fetch request is cached, return the target resource to the third node, so that the third node returns the target resource to the edge layer cache node;
步骤S33:在没有缓存预取请求对应的目标资源的情况下,向第三节点返回异常状态码,以使第三节点进行回源或回父。Step S33: when there is no target resource corresponding to the pre-fetch request in the cache, an abnormal status code is returned to the third node, so that the third node returns to the source or returns to the parent.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并
通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can find the second parent layer cache node that may cache the target resource in time after switching the parent layer node according to the first parsing result and the second parsing result, and By sending a resource request carrying the information of the second parent cache node to the first parent cache node, the first parent cache node can pre-fetch resources from the second parent cache node, thereby reducing the number of back-to-source times of the edge cache node after the parent node switches, avoiding the impact on the execution efficiency of normal business requests due to a sudden increase in back-to-source, and thus improving the service performance of the cache node.
对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于本申请中部分实施例,所涉及的动作并不一定是本申请实施例所必须的。For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all partial embodiments of the present application, and the actions involved are not necessarily required by the embodiments of the present application.
第四方面,图6是本申请实施例的一种缓存节点调度装置的结构示意图,装置应用于边缘层缓存节点,该装置包括:In a fourth aspect, FIG6 is a schematic diagram of the structure of a cache node scheduling device according to an embodiment of the present application, the device is applied to an edge layer cache node, and the device includes:
请求接收模块,用于接收针对目标资源的请求;A request receiving module, used for receiving a request for a target resource;
DNS解析模块,用于对目标资源进行DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,第二解析结果为之前对目标资源进行DNS解析所得到的DNS解析结果;A DNS resolution module is used to perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from a cache, where the second resolution result is the DNS resolution result obtained by previously performing DNS resolution on the target resource;
节点确定模块,用于在第一解析结果和第二解析结果不相同的情况下,根据第一解析结果确定第一父层缓存节点,并根据第二解析结果确定第二父层缓存节点;A node determination module, used to determine a first parent cache node according to the first analysis result and a second parent cache node according to the second analysis result when the first analysis result and the second analysis result are different;
资源请求模块,用于在第一父层缓存节点与第二父层缓存节点不相同的情况下,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求,以使第一父层缓存节点从第二父层缓存节点中获取目标资源,并将目标资源返回至边缘层缓存节点。A resource request module is used to send a resource request carrying information of the second parent cache node to the first parent cache node when the first parent cache node is different from the second parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
在本申请一些实施例中,从缓存中获取第二解析结果之前,装置还包括:In some embodiments of the present application, before obtaining the second parsing result from the cache, the device further includes:
第一获取模块,用于在边缘层缓存节点进行父层节点切换之后,缓存从DNS中获取到的目标资源对应的第一历史解析结果,并获取配置的第一目标时间;A first acquisition module is used to cache a first historical resolution result corresponding to a target resource obtained from a DNS after the edge layer cache node switches the parent layer node, and obtain a configured first target time;
DNS解析模块包括:The DNS resolution module includes:
第一解析子模块,用于在第一历史解析结果的缓存时间未超出第一目标时间的情况下,将第一历史解析结果确定为第二解析结果;A first parsing submodule, configured to determine the first historical parsing result as the second parsing result when the cache time of the first historical parsing result does not exceed the first target time;
第二解析子模块,用于在第一历史解析结果的缓存时间超出第一目标时间,且从DNS中重新获取到的目标资源对应的第二历史解析结果与第一历史解析结果不同的情况下,将第二历史解析结果确定为第二解析结果。The second resolution submodule is used to determine the second historical resolution result as the second resolution result when the cache time of the first historical resolution result exceeds the first target time and the second historical resolution result corresponding to the target resource reacquired from the DNS is different from the first historical resolution result.
在本申请一些实施例中,从缓存中获取第二解析结果之前,装置还包括:In some embodiments of the present application, before obtaining the second parsing result from the cache, the device further includes:
第二获取模块,用于在边缘层缓存节点进行父层节点切换之后,缓存从DNS中获取到的目标资源对应的第三历史解析结果;
A second acquisition module is used to cache a third historical resolution result corresponding to the target resource obtained from the DNS after the edge layer cache node performs a parent layer node switch;
第三获取模块,用于在第三历史解析结果配置了存活时间的情况下,根据存活时间周期性地更新缓存的目标资源对应的第三历史解析结果;A third acquisition module is used to periodically update the cached third historical analysis result corresponding to the target resource according to the survival time when the third historical analysis result is configured with a survival time;
DNS解析模块包括:The DNS resolution module includes:
第三解析子模块,用于将边缘层缓存节点当前缓存的第三历史解析结果,确定为第二解析结果。The third parsing submodule is used to determine the third historical parsing result currently cached by the edge layer cache node as the second parsing result.
在本申请一些实施例中,资源请求模块包括:In some embodiments of the present application, the resource request module includes:
第一资源请求子模块,用于获取配置的第二目标时间;A first resource request submodule, used to obtain a configured second target time;
第二资源请求子模块,用于在边缘层缓存节点进行父层节点切换之后的第二目标时间内,向第一父层缓存节点发送携带了第二父层缓存节点的信息的资源请求。The second resource request submodule is used to send a resource request carrying information of the second parent cache node to the first parent cache node within a second target time after the edge cache node switches the parent node.
在本申请一些实施例中,节点确定模块包括:In some embodiments of the present application, the node determination module includes:
第一确定模块,用于根据第一解析结果构建第一哈希环,并从边缘层缓存节点的缓存中获取第二解析结果对应的第二哈希环;A first determination module is used to construct a first hash ring according to the first parsing result, and obtain a second hash ring corresponding to the second parsing result from the cache of the edge layer cache node;
第二确定模块,用于根据第一哈希环和第二哈希环,分别确定第一父层缓存节点和第二父层缓存节点。The second determination module is used to determine the first parent layer cache node and the second parent layer cache node respectively according to the first hash ring and the second hash ring.
第五方面,图7是本申请实施例的另一种缓存节点调度装置的结构示意图,装置应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,该装置包括:In a fifth aspect, FIG. 7 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application, the device is applied to the parent layer cache node after the edge layer cache node performs parent layer node switching, the device comprising:
第一接收模块,用于接收边缘层缓存节点的资源请求,资源请求携带第一节点的信息,第一节点为边缘层缓存节点进行父层节点切换前的父层缓存节点;A first receiving module is used to receive a resource request from an edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;
第一生成模块,用于根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求;A first generating module, configured to generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;
第一传输模块,用于接收第一节点针对预取请求返回的目标资源,并将目标资源返回至边缘层缓存节点。The first transmission module is used to receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
在本申请一些实施例中,In some embodiments of the present application,
第一生成模块包括:The first generation module includes:
第一生成子模块,用于判断第一节点的信息是否属于不可用信息,不可用信息用于表征:边缘层节点之前向第一节点获取资源失败时所标记的第一节点的信息;The first generating submodule is used to determine whether the information of the first node is unavailable information, where the unavailable information is used to represent: the information of the first node marked when the edge layer node previously failed to obtain resources from the first node;
第二生成子模块,用于在第一节点的信息不属于不可用信息的情况下,根据配置的预取头部、以及第一节点的信息,生成并向第一节点发送预取请求。The second generating submodule is used to generate and send a pre-fetch request to the first node according to the configured pre-fetch header and the information of the first node when the information of the first node does not belong to unavailable information.
在本申请一些实施例中,第一生成模块包括:In some embodiments of the present application, the first generation module includes:
第三生成子模块,用于在资源请求为分片请求的情况下,获取资源请求所对应分片的缓存统一资源定位器url;The third generation submodule is used to obtain the cache uniform resource locator URL of the slice corresponding to the resource request when the resource request is a slice request;
第四生成子模块,用于根据配置的预取头部、缓存url、以及第一节点的信息,生成
并向第一节点发送对应分片的预取请求。The fourth generation submodule is used to generate a pre-fetch header, a cache URL, and information of the first node according to the configuration. And send a pre-fetch request for the corresponding shard to the first node.
第六方面,图8是本申请实施例的再一种缓存节点调度装置的结构示意图,装置应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,该装置包括:In a sixth aspect, FIG8 is a schematic diagram of the structure of another cache node scheduling device according to an embodiment of the present application, the device is applied to the parent layer cache node before the edge layer cache node switches the parent layer node, and the device includes:
预取请求接收模块,用于接收第三节点的预取请求,第三节点为边缘层缓存节点进行父层节点切换后的父层缓存节点;A pre-fetch request receiving module, used for receiving a pre-fetch request from a third node, where the third node is a parent layer cache node after the edge layer cache node performs parent layer node switching;
第一响应模块,用于在缓存了预取请求对应的目标资源的情况下,向第三节点返回目标资源,以使第三节点将目标资源返回至边缘层缓存节点;A first response module is used to return the target resource to the third node when the target resource corresponding to the pre-fetch request is cached, so that the third node returns the target resource to the edge layer cache node;
第二响应模块,用于在没有缓存预取请求对应的目标资源的情况下,向第三节点返回异常状态码,以使第三节点进行回源或回父。The second response module is used to return an abnormal status code to the third node when there is no target resource corresponding to the cache pre-fetch request, so that the third node returns to the source or returns to the parent.
采用本申请实施例的技术方案,边缘层缓存节点根据第一解析结果和第二解析结果,可以在进行父层节点切换之后,及时找到可能缓存有目标资源的第二父层缓存节点,并通过向第一父层缓存节点发送携带有该第二父层缓存节点的信息的资源请求,使得第一父层缓存节点能够向该第二父层缓存节点进行资源预取,从而减少边缘层缓存节点进行父层节点切换之后的回源次数,避免因回源突增而对正常业务请求的执行效率造成的影响,进而提高缓存节点的服务性能。By adopting the technical solution of the embodiment of the present application, the edge layer cache node can, based on the first parsing result and the second parsing result, promptly find the second parent layer cache node that may cache the target resource after the parent layer node is switched, and send a resource request carrying the information of the second parent layer cache node to the first parent layer cache node, so that the first parent layer cache node can pre-fetch resources from the second parent layer cache node, thereby reducing the number of back-to-source times of the edge layer cache node after the parent layer node is switched, avoiding the impact on the execution efficiency of normal business requests due to the sudden increase in back-to-source, and thereby improving the service performance of the cache node.
需要说明的是,装置实施例与方法实施例相近,故描述的较为简单,相关之处参见方法实施例即可。It should be noted that the device embodiment is similar to the method embodiment, so the description is relatively simple, and the relevant parts can be referred to the method embodiment.
本申请实施例还提供了一种电子设备,参照图9,图9是本申请实施例提出的电子设备的示意图。如图9所示,电子设备100包括:存储器110和处理器120,存储器110与处理器120之间通过总线通信连接,存储器110中存储有计算机程序,该计算机程序可在处理器120上运行,进而实现本申请实施例公开的缓存节点调度方法中的步骤。The present application also provides an electronic device, with reference to FIG9 , which is a schematic diagram of the electronic device proposed in the present application. As shown in FIG9 , the electronic device 100 includes: a memory 110 and a processor 120 , the memory 110 and the processor 120 are connected via a bus communication, the memory 110 stores a computer program, and the computer program can be run on the processor 120 to implement the steps in the cache node scheduling method disclosed in the present application.
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序/指令,该计算机程序/指令被处理器执行时实现如本申请实施例公开的缓存节点调度方法。The embodiment of the present application also provides a computer-readable storage medium on which a computer program/instruction is stored. When the computer program/instruction is executed by a processor, the cache node scheduling method disclosed in the embodiment of the present application is implemented.
本申请实施例还提供了一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现如本申请实施例公开的缓存节点调度方法。The embodiment of the present application also provides a computer program product, including a computer program/instruction, which, when executed by a processor, implements the cache node scheduling method disclosed in the embodiment of the present application.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本申请实施例是参照根据本申请实施例的方法、系统、设备、存储介质及程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框
或多个方框中指定的功能的装置。The embodiments of the present application are described with reference to the flowcharts and/or block diagrams of the methods, systems, devices, storage media, and program products according to the embodiments of the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the processes and/or boxes in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing one process or multiple processes in the flowchart and/or one box in the block diagram. or a device that performs the functions specified in more than one box.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
尽管已描述了本申请实施例的一些实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。Although some embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the present application.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
以上对本申请所提供的一种缓存节点调度方法、装置及设备、介质和产品,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。
The above is a detailed introduction to a cache node scheduling method, device and equipment, medium and product provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims (15)
- 一种缓存节点调度方法,其特征在于,应用于边缘层缓存节点,所述方法包括:A cache node scheduling method, characterized in that it is applied to edge layer cache nodes, the method comprising:接收针对目标资源的请求;receiving a request for a target resource;对所述目标资源进行域名系统DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,所述第二解析结果为之前对所述目标资源进行DNS解析所得到的DNS解析结果;Performing a domain name system DNS resolution on the target resource to obtain a first resolution result, and acquiring a second resolution result from a cache, where the second resolution result is a DNS resolution result obtained by previously performing a DNS resolution on the target resource;在所述第一解析结果和所述第二解析结果不相同的情况下,根据所述第一解析结果确定第一父层缓存节点,并根据所述第二解析结果确定第二父层缓存节点;When the first parsing result and the second parsing result are different, determining a first parent cache node according to the first parsing result, and determining a second parent cache node according to the second parsing result;在所述第一父层缓存节点与所述第二父层缓存节点不相同的情况下,向所述第一父层缓存节点发送携带了所述第二父层缓存节点的信息的资源请求,以使所述第一父层缓存节点从所述第二父层缓存节点中获取所述目标资源,并将所述目标资源返回至所述边缘层缓存节点。In the case that the first parent cache node is different from the second parent cache node, a resource request carrying information of the second parent cache node is sent to the first parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- 根据权利要求1所述的方法,其特征在于,所述从缓存中获取第二解析结果之前,所述方法还包括:The method according to claim 1, characterized in that before obtaining the second parsing result from the cache, the method further comprises:在所述边缘层缓存节点进行父层节点切换之后,缓存从DNS中获取到的所述目标资源对应的第一历史解析结果,并获取配置的第一目标时间;After the edge layer cache node performs parent layer node switching, caches the first historical resolution result corresponding to the target resource obtained from the DNS, and obtains the configured first target time;所述从缓存中获取第二解析结果,包括:The obtaining the second parsing result from the cache includes:在所述第一历史解析结果的缓存时间未超出所述第一目标时间的情况下,将所述第一历史解析结果确定为所述第二解析结果;If the cache time of the first historical analysis result does not exceed the first target time, determining the first historical analysis result as the second analysis result;在所述第一历史解析结果的缓存时间超出所述第一目标时间,且从所述DNS中重新获取到的所述目标资源对应的第二历史解析结果与所述第一历史解析结果不同的情况下,将所述第二历史解析结果确定为所述第二解析结果。When the cache time of the first historical resolution result exceeds the first target time and the second historical resolution result corresponding to the target resource reacquired from the DNS is different from the first historical resolution result, the second historical resolution result is determined as the second resolution result.
- 根据权利要求1所述的方法,其特征在于,所述从缓存中获取第二解析结果之前,所述方法还包括:The method according to claim 1, characterized in that before obtaining the second parsing result from the cache, the method further comprises:在所述边缘层缓存节点进行父层节点切换之后,缓存从DNS中获取到的所述目标资源对应的第三历史解析结果;After the edge layer cache node performs parent layer node switching, caches the third historical resolution result corresponding to the target resource obtained from the DNS;在所述第三历史解析结果配置了存活时间的情况下,根据所述存活时间周期性地更新缓存的所述目标资源对应的第三历史解析结果;In the case where the third historical analysis result is configured with a survival time, periodically updating the cached third historical analysis result corresponding to the target resource according to the survival time;所述从缓存中获取第二解析结果,包括:The obtaining the second parsing result from the cache includes:将所述边缘层缓存节点当前缓存的所述第三历史解析结果,确定为所述第二解析结果。The third historical parsing result currently cached by the edge layer cache node is determined as the second parsing result.
- 根据权利要求1-3任一所述的方法,其特征在于,所述向所述第一父层缓存节点发送携带了所述第二父层缓存节点的信息的资源请求,包括:The method according to any one of claims 1 to 3, characterized in that the sending of the resource request carrying the information of the second parent cache node to the first parent cache node comprises:获取配置的第二目标时间;Get the configured second target time;在所述边缘层缓存节点进行父层节点切换之后的所述第二目标时间内,向所述第一父层缓存节点发送携带了所述第二父层缓存节点的信息的资源请求。Within the second target time after the edge layer cache node performs parent layer node switching, a resource request carrying information of the second parent layer cache node is sent to the first parent layer cache node.
- 根据权利要求1-3任一所述的方法,其特征在于,所述在所述第一解析结果和所述第二解析结果不相同的情况下,根据所述第一解析结果确定第一父层缓存节点,并根据所述第二解析结果确定第二父层缓存节点,包括: The method according to any one of claims 1 to 3, characterized in that, when the first parsing result and the second parsing result are different, determining a first parent cache node according to the first parsing result, and determining a second parent cache node according to the second parsing result, comprises:根据所述第一解析结果构建第一哈希环,并从所述边缘层缓存节点的缓存中获取所述第二解析结果对应的第二哈希环;Constructing a first hash ring according to the first parsing result, and obtaining a second hash ring corresponding to the second parsing result from the cache of the edge layer cache node;根据所述第一哈希环和所述第二哈希环,分别确定所述第一父层缓存节点和所述第二父层缓存节点。The first parent cache node and the second parent cache node are determined respectively according to the first hash ring and the second hash ring.
- 一种缓存节点调度方法,其特征在于,应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,所述方法包括:A cache node scheduling method, characterized in that it is applied to a parent cache node after an edge layer cache node performs a parent layer node switch, and the method comprises:接收所述边缘层缓存节点的资源请求,所述资源请求携带第一节点的信息,所述第一节点为所述边缘层缓存节点进行父层节点切换前的父层缓存节点;Receive a resource request from the edge layer cache node, where the resource request carries information of a first node, where the first node is a parent layer cache node before the edge layer cache node performs a parent layer node switch;根据配置的预取头部、以及所述第一节点的信息,生成并向所述第一节点发送预取请求;Generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;接收所述第一节点针对所述预取请求返回的目标资源,并将所述目标资源返回至所述边缘层缓存节点。Receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
- 根据权利要求6所述的方法,其特征在于,The method according to claim 6, characterized in that所述根据配置的预取头部、以及所述第一节点的信息,生成并向所述第一节点发送预取请求,包括:The generating and sending a prefetch request to the first node according to the configured prefetch header and the information of the first node comprises:判断所述第一节点的信息是否属于不可用信息,所述不可用信息用于表征:所述边缘层节点之前向所述第一节点获取资源失败时所标记的所述第一节点的信息;Determine whether the information of the first node is unavailable information, where the unavailable information is used to represent: information of the first node marked when the edge layer node previously failed to obtain resources from the first node;在所述第一节点的信息不属于不可用信息的情况下,根据配置的预取头部、以及所述第一节点的信息,生成并向所述第一节点发送预取请求。When the information of the first node does not belong to unavailable information, a prefetch request is generated and sent to the first node according to the configured prefetch header and the information of the first node.
- 根据权利要求6或7所述的方法,其特征在于,所述根据配置的预取头部、以及所述第一节点的信息,生成并向所述第一节点发送预取请求,包括:The method according to claim 6 or 7, characterized in that the generating and sending a prefetch request to the first node according to the configured prefetch header and the information of the first node comprises:在所述资源请求为分片请求的情况下,获取所述资源请求所对应分片的缓存统一资源定位器url;In the case where the resource request is a slice request, obtaining a cache uniform resource locator URL of the slice corresponding to the resource request;根据配置的预取头部、所述缓存url、以及所述第一节点的信息,生成并向所述第一节点发送所述对应分片的预取请求。According to the configured prefetch header, the cache URL, and the information of the first node, a prefetch request for the corresponding segment is generated and sent to the first node.
- 一种缓存节点调度方法,其特征在于,应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,所述方法包括:A cache node scheduling method, characterized in that it is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the method comprises:接收第三节点的预取请求,所述第三节点为所述边缘层缓存节点进行父层节点切换后的父层缓存节点;receiving a pre-fetch request from a third node, where the third node is a parent cache node after the edge layer cache node performs parent layer node switching;在缓存了所述预取请求对应的目标资源的情况下,向所述第三节点返回所述目标资源,以使所述第三节点将所述目标资源返回至所述边缘层缓存节点;In the case where the target resource corresponding to the pre-fetch request is cached, returning the target resource to the third node, so that the third node returns the target resource to the edge layer cache node;在没有缓存所述预取请求对应的目标资源的情况下,向所述第三节点返回异常状态码,以使所述第三节点进行回源或回父。In the case where the target resource corresponding to the pre-fetch request is not cached, an abnormal status code is returned to the third node, so that the third node returns to the source or returns to the parent.
- 一种缓存节点调度装置,其特征在于,应用于边缘层缓存节点,所述装置包括:A cache node scheduling device, characterized in that it is applied to an edge layer cache node, and the device comprises:请求接收模块,用于接收针对目标资源的请求;A request receiving module, used for receiving a request for a target resource;DNS解析模块,用于对所述目标资源进行DNS解析,得到第一解析结果,并从缓存中获取第二解析结果,所述第二解析结果为之前对所述目标资源进行DNS解析所得到的DNS解析结果; A DNS resolution module is used to perform DNS resolution on the target resource to obtain a first resolution result, and obtain a second resolution result from a cache, where the second resolution result is a DNS resolution result obtained by previously performing DNS resolution on the target resource;节点确定模块,用于在所述第一解析结果和所述第二解析结果不相同的情况下,根据所述第一解析结果确定第一父层缓存节点,并根据所述第二解析结果确定第二父层缓存节点;a node determination module, configured to determine a first parent cache node according to the first analysis result and a second parent cache node according to the second analysis result when the first analysis result and the second analysis result are different;资源请求模块,用于在所述第一父层缓存节点与所述第二父层缓存节点不相同的情况下,向所述第一父层缓存节点发送携带了所述第二父层缓存节点的信息的资源请求,以使所述第一父层缓存节点从所述第二父层缓存节点中获取所述目标资源,并将所述目标资源返回至所述边缘层缓存节点。A resource request module is used to send a resource request carrying information of the second parent cache node to the first parent cache node when the first parent cache node is different from the second parent cache node, so that the first parent cache node obtains the target resource from the second parent cache node and returns the target resource to the edge cache node.
- 一种缓存节点调度装置,其特征在于,应用于边缘层缓存节点进行父层节点切换后的父层缓存节点,所述装置包括:A cache node scheduling device, characterized in that it is applied to a parent cache node after an edge layer cache node performs a parent layer node switch, and the device comprises:第一接收模块,用于接收所述边缘层缓存节点的资源请求,所述资源请求携带第一节点的信息,所述第一节点为所述边缘层缓存节点进行父层节点切换前的父层缓存节点;A first receiving module is used to receive a resource request of the edge layer cache node, wherein the resource request carries information of a first node, where the first node is a parent layer cache node of the edge layer cache node before the parent layer node is switched;第一生成模块,用于根据配置的预取头部、以及所述第一节点的信息,生成并向所述第一节点发送预取请求;A first generating module, configured to generate and send a prefetch request to the first node according to the configured prefetch header and information of the first node;第一传输模块,用于接收所述第一节点针对所述预取请求返回的目标资源,并将所述目标资源返回至所述边缘层缓存节点。The first transmission module is configured to receive the target resource returned by the first node in response to the pre-fetch request, and return the target resource to the edge layer cache node.
- 一种缓存节点调度装置,其特征在于,应用于边缘层缓存节点进行父层节点切换前的父层缓存节点,所述装置包括:A cache node scheduling device, characterized in that it is applied to a parent layer cache node before an edge layer cache node switches a parent layer node, and the device comprises:预取请求接收模块,用于接收第三节点的预取请求,所述第三节点为所述边缘层缓存节点进行父层节点切换后的父层缓存节点;A pre-fetch request receiving module, used for receiving a pre-fetch request from a third node, wherein the third node is a parent layer cache node after the edge layer cache node performs parent layer node switching;第一响应模块,用于在缓存了所述预取请求对应的目标资源的情况下,向所述第三节点返回所述目标资源,以使所述第三节点将所述目标资源返回至所述边缘层缓存节点;A first response module, configured to return the target resource to the third node if the target resource corresponding to the pre-fetch request is cached, so that the third node returns the target resource to the edge layer cache node;第二响应模块,用于在没有缓存所述预取请求对应的目标资源的情况下,向所述第三节点返回异常状态码,以使所述第三节点进行回源或回父。The second response module is used to return an abnormal status code to the third node when the target resource corresponding to the pre-fetch request is not cached, so that the third node returns to the source or returns to the parent.
- 一种电子设备,包括存储器、处理器及存储在所述存储器上的计算机程序,其特征在于,所述处理器执行所述计算机程序以实现如权利要求1至5中任一项所述的缓存节点调度方法或实现如权利要求6至8中任一项所述的缓存节点调度方法或实现如权利要求9所述的缓存节点调度方法。An electronic device comprises a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to implement the cache node scheduling method as described in any one of claims 1 to 5 or the cache node scheduling method as described in any one of claims 6 to 8 or the cache node scheduling method as described in claim 9.
- 一种计算机可读存储介质,其上存储有计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时实现如权利要求1至5中任一项所述的缓存节点调度方法或实现如权利要求6至8中任一项所述的缓存节点调度方法或实现如权利要求9所述的缓存节点调度方法。A computer-readable storage medium having a computer program/instruction stored thereon, characterized in that when the computer program/instruction is executed by a processor, the cache node scheduling method as described in any one of claims 1 to 5 is implemented, or the cache node scheduling method as described in any one of claims 6 to 8 is implemented, or the cache node scheduling method as described in claim 9 is implemented.
- 一种计算机程序产品,包括计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时实现如权利要求1至5中任一项所述的缓存节点调度方法或实现如权利要求6至8中任一项所述的缓存节点调度方法或实现如权利要求9所述的缓存节点调度方法。 A computer program product, comprising a computer program/instruction, characterized in that when the computer program/instruction is executed by a processor, it implements the cache node scheduling method as described in any one of claims 1 to 5, or implements the cache node scheduling method as described in any one of claims 6 to 8, or implements the cache node scheduling method as described in claim 9.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310163245.5A CN115842863B (en) | 2023-02-24 | 2023-02-24 | Cache node scheduling method, device and medium |
CN202310163245.5 | 2023-02-24 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024174694A1 true WO2024174694A1 (en) | 2024-08-29 |
Family
ID=85580175
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/139692 WO2024174694A1 (en) | 2023-02-24 | 2023-12-19 | Cache node scheduling method and apparatus, and device and medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115842863B (en) |
WO (1) | WO2024174694A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115842863B (en) * | 2023-02-24 | 2023-06-23 | 天翼云科技有限公司 | Cache node scheduling method, device and medium |
CN118474197B (en) * | 2024-07-09 | 2024-09-03 | 天翼云科技有限公司 | Scheduling method and device for content distribution network |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108173952A (en) * | 2017-12-29 | 2018-06-15 | 北京奇虎科技有限公司 | A kind of data access method and device of content distributing network CDN |
CN109413163A (en) * | 2018-10-09 | 2019-03-01 | 网宿科技股份有限公司 | A kind of method and device of service access |
US20190273808A1 (en) * | 2018-03-03 | 2019-09-05 | Akamai Technologies, Inc. | Leveraging Time-Windows Generated by Web Browser Pre-Connections |
CN113472852A (en) * | 2021-06-02 | 2021-10-01 | 乐视云计算有限公司 | CDN node back-source method, device and equipment |
CN115208955A (en) * | 2021-03-29 | 2022-10-18 | 贵州白山云科技股份有限公司 | Resource request processing method and device, computer equipment and medium |
CN115842863A (en) * | 2023-02-24 | 2023-03-24 | 天翼云科技有限公司 | Cache node scheduling method, device and equipment, and medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108737405B (en) * | 2018-05-10 | 2020-02-18 | 网宿科技股份有限公司 | Method, CCL server and system for guiding direct broadcasting video stream |
CN112261418B (en) * | 2020-09-18 | 2022-09-30 | 网宿科技股份有限公司 | Method for transmitting live video data and live broadcast acceleration system |
CN113542058B (en) * | 2021-06-25 | 2022-12-09 | 网宿科技股份有限公司 | Data source returning method, server and storage medium |
CN115567602A (en) * | 2022-08-15 | 2023-01-03 | 乐视云计算有限公司 | CDN node back-to-source method, device and computer readable storage medium |
-
2023
- 2023-02-24 CN CN202310163245.5A patent/CN115842863B/en active Active
- 2023-12-19 WO PCT/CN2023/139692 patent/WO2024174694A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108173952A (en) * | 2017-12-29 | 2018-06-15 | 北京奇虎科技有限公司 | A kind of data access method and device of content distributing network CDN |
US20190273808A1 (en) * | 2018-03-03 | 2019-09-05 | Akamai Technologies, Inc. | Leveraging Time-Windows Generated by Web Browser Pre-Connections |
CN109413163A (en) * | 2018-10-09 | 2019-03-01 | 网宿科技股份有限公司 | A kind of method and device of service access |
CN115208955A (en) * | 2021-03-29 | 2022-10-18 | 贵州白山云科技股份有限公司 | Resource request processing method and device, computer equipment and medium |
CN113472852A (en) * | 2021-06-02 | 2021-10-01 | 乐视云计算有限公司 | CDN node back-source method, device and equipment |
CN115842863A (en) * | 2023-02-24 | 2023-03-24 | 天翼云科技有限公司 | Cache node scheduling method, device and equipment, and medium |
Also Published As
Publication number | Publication date |
---|---|
CN115842863B (en) | 2023-06-23 |
CN115842863A (en) | 2023-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11909639B2 (en) | Request routing based on class | |
WO2024174694A1 (en) | Cache node scheduling method and apparatus, and device and medium | |
US11194719B2 (en) | Cache optimization | |
US20180205697A1 (en) | Managing content delivery network service providers by a content broker | |
CN109067930B (en) | Domain name access method, domain name resolution method, server, terminal and storage medium | |
US9465819B2 (en) | Distributed database | |
US20130007284A1 (en) | Service provider registration by a content broker | |
JP2001524778A (en) | Enhanced domain name service | |
CN114338604A (en) | DNS configuration updating method and system | |
CN115080272A (en) | Business data processing method, electronic device and storage medium | |
JP2002525749A (en) | Internet caching system, method and system configuration | |
US11606415B2 (en) | Method, apparatus and system for processing an access request in a content delivery system | |
CN115150469B (en) | Domain name resolution result storage method and device, electronic equipment and storage medium | |
CN112968980B (en) | Probability determination method and device, storage medium and server | |
CN116248632B (en) | File acquisition method, device, system and equipment, medium and product | |
CN117971896A (en) | Data processing method, device, computer equipment and storage medium | |
CN116233248A (en) | Resource response method, device and readable storage medium | |
CN115567591A (en) | Content resource distribution method, content distribution network, cluster and medium | |
CN114936216A (en) | Data updating method and device, electronic equipment and storage medium | |
KR20100053372A (en) | System and method for contents delivery based on content delivery network provider, and replication server thereof |
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: 23923857 Country of ref document: EP Kind code of ref document: A1 |