WO2022206529A1 - Resource request processing method and apparatus, computer device, and medium - Google Patents

Resource request processing method and apparatus, computer device, and medium Download PDF

Info

Publication number
WO2022206529A1
WO2022206529A1 PCT/CN2022/082667 CN2022082667W WO2022206529A1 WO 2022206529 A1 WO2022206529 A1 WO 2022206529A1 CN 2022082667 W CN2022082667 W CN 2022082667W WO 2022206529 A1 WO2022206529 A1 WO 2022206529A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
edge node
client
resource request
request
Prior art date
Application number
PCT/CN2022/082667
Other languages
French (fr)
Chinese (zh)
Inventor
刘竞超
徐贵荣
Original Assignee
贵州白山云科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202110332154.0A external-priority patent/CN115208955B/en
Application filed by 贵州白山云科技股份有限公司 filed Critical 贵州白山云科技股份有限公司
Publication of WO2022206529A1 publication Critical patent/WO2022206529A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Definitions

  • the embodiments of the present disclosure relate to, but are not limited to, a method, an apparatus, a computer device, and a medium for processing a resource request.
  • CDN Content Delivery Network
  • CDN is an intelligent virtual network built on the basis of the existing network, relying on edge servers deployed in various places, through the load balancing, content distribution, scheduling and other functional modules of the central platform, so that users can obtain the desired content nearby and reduce network congestion.
  • the CDN hit rate refers to the probability of hitting the cache when a user accesses it.
  • the architecture of CDN is a multi-layer cache aggregation structure. The first layer is the edge node, the middle layer is composed of one or more layers of parent nodes, and the last layer is the origin site.
  • the client randomly accesses the CDN edge node through DNS resolution.
  • the edge node forwards the request to the upper-level parent node, which increases the cost of returning to the parent, resulting in high CDN return rate, internal bandwidth consumption, and network performance. Problems such as poor performance and large delay directly affect the overall performance of the CDN, resulting in poor user experience.
  • the present disclosure provides a method, apparatus, computer equipment and medium for processing a resource request.
  • a method for processing a resource request, applied to a first edge node of a content distribution network comprising:
  • the first edge node receives the resource request from the client
  • the first edge node judges whether the resource requested by the resource request exists in the first edge node
  • the first edge node judges the type of the resource
  • the first edge node determines a second edge node, the first edge node returns a first response message for the resource request to the client, the first edge node The response message is used to instruct the client to send the adjusted resource request to the second edge node, wherein the first response message returned by the first edge node to the client for the resource request includes the first response message. address information of the second edge node;
  • the first edge node acquires the resource from an upper node or an origin station and returns it to the client.
  • the first edge node determines the type of the resource, including:
  • the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
  • the number of times of accessing the resource within the preset time includes:
  • the access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time are the access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
  • the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the location of the client in the area where the client is located. On the edge node group, the historical access situation of the address information included in the resource request is set.
  • the first edge node determines the second edge node, including:
  • the first edge node performs consistent hash calculation on the resource identifier to generate a hash value of the resource, where the resource identifier includes a uniform resource locator or a domain name;
  • the first edge node calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash value of each edge node on the consistent hash ring;
  • the first edge node determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
  • the method further includes:
  • the first edge node records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the first edge node returns the information to the client.
  • the first response message of the resource request includes the recorded address information of the second edge node.
  • the first edge node determines the second edge node, further comprising:
  • the second edge node is determined according to the load situation of each edge node in the edge node group where the first edge node is located.
  • the method before the first edge node determines the type of the resource, the method further includes:
  • the first edge node determines whether its own load is greater than or equal to a second preset threshold
  • the first edge node judges the resource type of the resource.
  • the method further includes:
  • the first edge node determines a third edge node, and the first edge node returns a second response message for the resource request to the client;
  • the second response message is used to instruct the client to send the adjusted resource request to the third edge node.
  • the method further includes:
  • the resource is directly returned to the client.
  • the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node returns to the client
  • the adjusted resource requests the requested resource, where the resource is a resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
  • an apparatus for processing a resource request which is applied to a first edge node of a content distribution network, the apparatus comprising:
  • the receiving module is set to receive the resource request of the client
  • a judgment module configured to judge whether the resource requested by the resource request exists in the first edge node; when the resource does not exist, the judgment module judges the type of the resource;
  • a determining module configured to determine the second edge node by the determining module when the determining module determines that the resource is the first type of resource
  • a response module configured to return a first response message of the resource request to the client when the determination module determines that the resource is a first type resource, where the first response message is used to indicate
  • the client sends the adjusted resource request to the second edge node, wherein the first response message that the response module returns to the client for the resource request includes address information of the second edge node;
  • the response module is further configured to, when the judgment module judges that the resource is a resource of the second type, the response module obtains the resource from the upper-layer node or the source station and returns it to the client.
  • the judging module is specifically set as:
  • the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
  • the number of times of accessing the resource within the preset time includes:
  • the access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time are the access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
  • the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the location of the client in the area where the client is located. On the edge node group, the historical access situation of the address information included in the resource request is set.
  • the determining module is further configured to:
  • the determining module determines a resource identifier according to the resource request
  • the determining module performs consistent hash calculation on the resource identifier to generate a hash value of the resource, wherein the resource identifier includes a uniform resource locator or a domain name;
  • the determining module calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash value of each edge node on the consistent hash ring;
  • the determining module determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
  • the response module is further configured to:
  • the response module records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the response module returns the resource request to the client.
  • the first response message includes the recorded address information of the second edge node.
  • the determining module is further configured to:
  • the determining module determines the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located.
  • the judging module is further configured to:
  • the judgment module judges whether the load of the first edge node is greater than or equal to a second preset threshold
  • the judgment module judges the resource type of the resource.
  • the determining module is further configured to determine a third edge node
  • the response module is further configured to, when the judgment module judges yes, the response module returns a second response message of the resource request to the client; the second response message is used to indicate the client
  • the terminal sends the adjusted resource request to the third edge node.
  • the response module is configured to:
  • the response module directly returns the resource to the client.
  • the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node returns to the client
  • the adjusted resource requests the requested resource, where the resource is a resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
  • a computer device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions in the memory to achieve The method of any one of the first aspects.
  • a non-transitory computer-readable storage medium having executable instructions stored thereon, the executable instructions implementing the method of the first aspect when executed by a processor.
  • the technical solutions provided by the present disclosure may include the following beneficial effects: by using the resource request processing method of the present disclosure, the hit rate of resource requests at edge nodes can be improved, the cost of returning to the parent can be effectively reduced, the internal consumption bandwidth can be reduced, and the CDN edge node can be improved. utilization efficiency.
  • FIG. 1 is a schematic flowchart of a method for processing a resource request according to an exemplary embodiment
  • FIG. 2 is a block diagram of an apparatus for processing a resource request according to an exemplary embodiment
  • Fig. 3 is a block diagram of a computer device according to an exemplary embodiment.
  • FIG. 1 is a schematic flowchart of a method for processing a resource request provided by an exemplary embodiment of the present application.
  • the method for processing a resource request according to the present disclosure is applicable to a first edge node of a content distribution network, including:
  • Step 101 the first edge node receives the resource request sent by the client
  • the client may be a terminal device such as a desktop computer, a notebook computer, a smart phone, or an IOT device, or a server device such as a conventional server, a cloud server, or a server array. programs running on the machine.
  • the scheduling center node in the content distribution network will schedule the request to the first edge node in the content distribution network.
  • the edge node that receives the resource request from the client will be defined. is the first edge node.
  • the resource request received by the first edge node includes at least a resource identifier and a client identifier.
  • the resource identifier may be a uniform resource locator, a domain name, a resource name, etc., and the resource requested by the client can be determined according to the resource identifier.
  • the client identifier may be client address information, client type, client ID, and the like.
  • Step 102 the first edge node judges whether the resource requested by the resource request exists in the first edge node
  • the first edge node when receiving a resource request from a user, the first edge node obtains the resource identifier in the resource request, and the first edge node queries whether the resource requested by the client exists locally, and if it exists (hit), The first edge node directly returns resources to the client.
  • Step 103 when the resource does not exist, the first edge node judges the type of the resource
  • the first edge node determines the type of the resource.
  • the types of resources can be distinguished according to the resource format, the protocol type of the resource request, the size of the resource file, the channel to which the resource belongs, the popularity of resource access, etc.; It can meet different customer needs. For example, customers can divide resources into popular channel resources and general channel resources according to the needs of content operation. Through this distinction, CDN manufacturers can more accurately grasp the processing methods of different content.
  • a resource type matching table may be deployed on an edge node in advance, and/or a preset threshold may be preset for judging the resource type.
  • resource types can be distinguished by resource access heat, a preset first preset threshold used to determine resource access heat, and the number of resource accesses is compared with the first preset threshold. Threshold comparison to judge the resource type.
  • the resource when the number of accesses to the resource within the preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the first type; If the number of accesses is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type.
  • the address information included in the resource request may be information such as domain name, IP, and URL associated with the resource carried in the resource request, and the first preset threshold includes at least the following two setting methods:
  • Method 1 Perform manual estimation settings according to the business characteristics of the domain name
  • Mode 2 Set according to the historical access status of the domain name carried in the resource request on the first edge node, and/or, according to the historical access status of the domain name carried in the resource request on the edge node group in the area where the client is located. set up;
  • the resource type By counting the number of visits of edge nodes to different domain names in historical time, and calculating the first preset thresholds for different domain names based on the experience of those skilled in the art and any well-known algorithm or through machine learning, the resource type The classification is more accurate, and more fine-grained bandwidth control is achieved at the edge nodes.
  • the first predictions for different domain names are obtained by calculating the total number of visits to different areas by the edge node group in the area where the client is located in historical time, and based on the experience of those skilled in the art and any well-known algorithm or by machine learning. Setting a threshold can control the number of resources in the area where the client is located to return to the upper-layer node or source station, so that a certain type of resources can be aggregated or dispersed based on the characteristics of a certain area, reducing the overall bandwidth consumption.
  • the corresponding preset thresholds are respectively set, the two preset thresholds are compared, and the smaller preset threshold is selected as the first preset threshold, so as to simultaneously take into account more fine-grained bandwidth control and control resources on the client.
  • the period of the historical time may be manually set according to the actual situation, and may specifically be the past month, the past half year, the past one year, or the past entire time period, which is not limited in this embodiment.
  • Step 104 when judging that the resource is the first type of resource, the first edge node determines the second edge node, and the first edge node returns a first response message for the resource request to the client, where the first response message is used to instruct the client to send the The second edge node sends the adjusted resource request, wherein the first response message that the first edge node returns to the client for the resource request includes address information of the second edge node.
  • the first edge node determines the second edge node, including: the first edge node obtains the resource corresponding to the area to which the client belongs.
  • the edge node group and the resource identifier in the resource request the first edge node determines the second edge node in the edge node group based on the resource identifier, and the first edge node sends a response message to the client for the resource request, wherein the first edge node
  • the response message that returns the resource request to the client includes the address information of the second edge node and/or the identification information of the second edge node, so that the client can send the adjusted resource request to the second edge node, and then start from the second edge node.
  • the second edge node obtains the resources requested by the client.
  • Step 105 when the resource is the second type of resource, the first edge node obtains the resource from the upper node or the source station and returns it to the client.
  • the first edge node determines that the resource is the second type of resource, that is, in this embodiment, when the resource requested by the client is a resource with high access popularity, the first edge node obtains the resource from the upper-layer node by , when the upper-layer node does not have the resource, or there is no upper-layer node, the first edge node obtains the resource to the client through back-to-source.
  • the method further includes: the first edge node determines whether its own load is greater than or equal to a second preset threshold; if the determination is yes , the first edge node determines that there is a third edge node of the resource requested by the resource request in its area according to the resource identifier of the resource request, and returns the second response message of the resource request to the client, so that the client sends the third edge node to the third edge node.
  • the first edge node determines that there is a third edge node of the resource requested by the resource request in its area according to the resource identifier of the resource request, and sends a second response message containing the address information of the third edge node to the client, so that the client The adjusted resource request may be sent to the third edge node according to the second response information.
  • the load of the first edge node itself is less than the second preset threshold, it indicates that the load of the first edge service itself is small and can quickly respond to the user's resource request, and then the first edge node continues to judge the resource type of the resource.
  • the first edge node determines the type of the resource by counting the number of accesses to the resource within a preset time, wherein the number of accesses to the resource within the preset time includes: : the number of times the resource is accessed on the first edge node within the preset time, and/or the total number of times the resource is accessed on the edge node group in the area where the client is located within the preset time, as follows:
  • Manner 1 Obtain the resource identifier in the resource request; according to the resource identifier, determine the total number of accesses to the resource on the first edge node within a preset time;
  • Method 2 Determine the region to which the client belongs and the resource identifier in the resource request, and obtain the edge node group corresponding to the region to which the client belongs based on the region to which the client belongs; and obtain the total amount of resources on the edge node group within a preset time according to the resource identifier.
  • the number of visits, where the total number of visits is the sum of the times of visits to resources on each edge node in the edge node group within a preset time.
  • the edge node can determine the resource requested by the user according to the resource identifier in the resource request, and then can obtain all resource requests for the resource. It should be noted that each edge node in each area can be locally The access times of the resource are counted according to a preset collection period (for example, 1 minute), and further, the respective access times are uploaded to the scheduling center node, or the scheduling center node obtains from each edge node regularly.
  • a preset collection period for example, 1 minute
  • the first edge node when it receives the resource request from the user, it can locally count the total number of accesses to the resource within a preset time, for example, it can count the total number of accesses to the resource by the first edge node within 5 minutes.
  • the preset time can be the first 5 minutes, the first 10 minutes, etc., ending at the current moment when the user resource request is received.
  • the collection period and the duration of the preset time are not specifically limited here.
  • the first edge node obtains the client identifier of the resource request, determines the area to which the client belongs by using the client identifier, and then obtains the edge node group corresponding to the area to which the client belongs.
  • the first edge node can query the edge node group corresponding to the area to which the client belongs according to the client identifier or information about the area to which the client belongs.
  • the first edge node can obtain the total access times of the resource by the edge node group through statistics by itself, or directly obtain from the scheduling center node.
  • the scheduling center node obtains the number of accesses to the resource in each edge node, and the scheduling center node counts the number of accesses to the resource by all edge nodes in each area according to a preset statistical period (for example, 1 minute), and then according to The preset synchronization period (for example, 1 minute) synchronizes the access times of all edge nodes to the resource to each edge node in the corresponding area.
  • a preset statistical period for example, 1 minute
  • the preset synchronization period for example, 1 minute
  • the first edge node only needs to summarize the access times synchronized by the scheduling center node, that is, through the first An edge node locally counts the total access times of the edge node group to the resource within a preset time, for example, summing the access times of each edge node in the edge node group to the resource within 5 minutes, so that the edge node can pass its own
  • the total number of visits to the resource by the edge node group is obtained by statistics.
  • the scheduling center node obtains the number of accesses to the resource in each edge node, and can count the number of accesses to the resource by all edge nodes in each area according to a preset statistical period (for example, 1 minute), and report to the corresponding All edge nodes in the region synchronize data.
  • the edge node instead of synchronizing data to each edge node in the corresponding area, the edge node directly sends query information to obtain the total number of accesses to the resource by the edge node group to the scheduling center node, and the query information at least includes the duration of the preset time, the client The identifier (or the area to which the client belongs) and the resource identifier.
  • the dispatch center node determines the edge node group corresponding to the area to which the client belongs according to the client identifier (or the area to which the client belongs) in the query information, and counts the edge node group within a preset time. The sum of the access times of each edge node to the resource is sent to the edge node, so that the edge node can obtain the total access times of the resource by the edge node group from the scheduling center node.
  • the preset time may be the first 5 minutes, the first 10 minutes, etc., ending at the current moment when the user resource request is received, and the duration of the statistical period, the synchronization period, and the preset time is not specifically limited here.
  • the first edge node determines the second edge node, including: the first edge node determines the resource identifier according to the resource request; the first edge node matches the resource identifier The first edge node calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and assigns each edge The hash value of the node is allocated on the consistent hash ring; the first edge node determines the corresponding second edge node on the consistent hash ring according to the hash value of the resource.
  • the first edge node can obtain the resource identifier in the resource request, and the resource identifier can be a uniform resource locator URL or a domain name.
  • the hash value corresponding to the resource identifier is calculated by a consistent hash algorithm. , that is, the hash value corresponding to the resource.
  • different hash values can usually be calculated. Therefore, there can be a one-to-one correspondence between resource identifiers and hash values.
  • the hash value of the IP address of some edge nodes calculate the hash value corresponding to each edge node, that is, the hash value of each edge node, and assign the hash value of each edge node on the consistent hash ring; On the consistent hash ring, starting from the location of the hash value of the resource, search along the preset direction to find the location corresponding to the hash value of the IP address of each edge node, and use the hash value of the IP address of the first edge node to be searched.
  • the edge node represented at the location is determined to be the second edge node.
  • the resource request on the edge node can be more concentrated through the consistent hashing algorithm.
  • the client sends the adjusted resource request to the second edge node determined according to the resource identifier, and when the second edge node has resources, returns the resources to the client; when the second edge node does not have resources, sends the resource to the upper node or The origin site obtains resources.
  • the second edge node by locating the second edge node through a consistent hash algorithm, it can be ensured that the same first type resource can be accessed to the second edge node every time the resource is accessed, so that the resource is on the edge
  • the high hit rate of the node effectively reduces the back-to-source rate and makes the access of edge nodes more concentrated, which not only reduces the bandwidth for returning to the parent, but also provides a better user experience.
  • the first edge node may also record the second edge node, when a resource request for accessing the same resource is received again and the resource is the first edge node
  • the first edge node may directly return to the client a response message containing the recorded address information of the second edge node according to the recorded information.
  • the first edge node in step 104, returns a first response message of the resource request to the client, including: obtaining the resource identifier in the resource request and the address information of the second edge node ; The first edge node generates a first response message for the resource request according to the resource identifier and address information, and returns the first response message to the client.
  • the first edge node when it determines that the resource requested by the user is the first type of resource, it can construct a first response message according to the obtained uniform resource locator URL and the address information of the second edge node.
  • the first edge node Send the first response message to the client, so that the client sends the adjusted resource request to the second edge node after receiving the first response message, so that the client can obtain the resource requested by the user through the second edge node
  • the address information of the second edge node may be the IP address of the second edge node, wherein the first response message may carry the HTTP status code 30X, when the status code is 30X, it indicates that the client is instructed to resend a request, and the first response message may carry the HTTP status code 30X.
  • the edge node sends a response header Location, specifying the URL address of the new request.
  • the second edge node and the first edge node belong to the same logical area, which may be, for example, a geographic area or an operator.
  • the first edge node receives the resource request from the client, and when judging that the resource requested by the user does not exist (misses) in the first edge node, according to the resource request, determine the resource type of the resource requested by the user, when it is determined that the resource requested by the user is the first type of resource, determine the second edge node according to the resource identifier of the resource, and then send a response message to the client for the resource request, and the client sends a response message to the client according to the response message.
  • the second edge node sends the adjusted resource request, so that the client can obtain the resource requested by the user through the second edge node in the same geographical area, which can realize that when the resource requested by the user belongs to the access heat in the first edge node
  • the first type resource it instructs the client to send the adjusted resource request to other edge nodes that are most likely to have the resources requested by the user, which reduces the cost of returning to the parent and improves the hit rate of cold resources on edge nodes. It reduces the access delay caused by the internal bandwidth consumption and the performance of the parent node, and at the same time, enables the resources in the edge nodes that belong to the same area as the first edge node to be accessed, and improves the utilization rate of resources in other edge nodes in the same area. access rate.
  • the first edge node determines the second edge node, which further includes determining the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located .
  • the first edge node selects the edge node with lower load according to the load situation of each edge node in the edge node group, and determines it as the second edge node, and the first edge node sends the response information carrying the address information of the second edge node to the client , the client sends a resource request according to the address information of the second edge node, the first edge node can quickly respond to the user's resource request by screening the second edge node with lower load, improve the response speed and success rate of the user's request for resources, and improve the User experience.
  • the second edge node obtains the resource by returning to the upper-layer node or the source station, and sends it to the client.
  • the edge node can also judge the bandwidth of the machine, CPU, IO, packet loss rate and other quality data instead of the load to judge and screen the target edge node.
  • the first response message is used to instruct the client to send the adjusted resource request to the second edge node, so that the second edge node returns the resource requested by the adjusted resource request to the client. That is, after the client sends the adjusted resource request to the second edge node according to the first response message, the client receives the resource requested by the adjusted resource request returned by the second edge node, and the resource is the resource after distance adjustment The resource that requests the starting position of the key frame position that reaches the second edge node with the closest system time. In the live broadcast scenario, after the host starts the live broadcast, the host will push the live video data to the edge node in real time.
  • the second edge node When the user's resource request reaches the second edge node, in order to ensure that the user can accurately obtain the corresponding information when the request arrives Time video resources, the second edge node will push the key frame position closest to the system time when the resource request reaches the second edge node as the resource at the starting position to the client, so that the user can watch the clear live streaming content in time. Does not produce blur and freeze.
  • the method provided by the embodiments of the present disclosure is used to perform resource requests, so that the probability of the edge node being missed is low.
  • the first edge When the node is not hit, the first edge node will return to the parent or the source N times at most, effectively reducing the bandwidth of returning to the parent or the source by 15-20%.
  • the processing method of different resource type requests is determined by judging and deciding on the edge node. Reallocating and adjusting edge nodes that process requests can also greatly improve the utilization efficiency of CDN edge nodes.
  • FIG. 2 exemplarily shows a block diagram of an apparatus for resource request processing according to the present disclosure.
  • an apparatus for processing a resource request is provided, which is applied to a first edge node of a content distribution network, and the apparatus includes:
  • the receiving module 201 is configured to receive the resource request of the client
  • the judging module 202 is configured to judge whether the resource requested by the resource request exists in the first edge node; when the resource does not exist, the judging module 202 judges the type of the resource;
  • the determining module 203 is configured to determine the second edge node when the determining module 202 determines that the resource is the first type of resource;
  • the response module 204 is configured to, when the determination module 202 determines that the resource is the first type of resource, the response module 204 returns a first response message of the resource request to the client, and the first response message is set to instruct the client to send the adjustment to the second edge node
  • the response module 204 is further configured to, when the determination module 202 determines that the resource is the second type of resource, the response module 204 obtains the resource from the upper-layer node or the source station and returns it to the client.
  • the judging module 202 is specifically set as:
  • the resource is determined to be of the second type.
  • the number of accesses to the resource within the preset time period includes:
  • the first preset threshold is set according to the historical access situation of the address information included in the resource request on the first edge node, and/or according to the address included in the resource request on the edge node group in the area where the client is located Set the historical access to information.
  • the determining module 203 is also set to:
  • the determining module 203 determines the resource identifier according to the resource request
  • the determination module 203 performs consistent hash calculation on the resource identifier, and generates a hash value of the resource, wherein the resource identifier includes a uniform resource locator or a domain name;
  • the determination module 203 calculates the hash values of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash values of each edge node on the consistent hash ring;
  • the determining module 203 determines the corresponding second edge node on the consistent hash ring according to the hash value of the resource.
  • response module 204 is also set to:
  • the response module 204 records the second edge node, and when the resource request for accessing the same resource is received again and the resource is the first type of resource, the response module 204 returns the first response message of the resource request to the client including the recorded second edge node. Address information.
  • the determining module 203 is also set to:
  • the determining module 203 determines the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located.
  • the judging module 202 is also set to:
  • the judgment module 202 judges whether the load of the first edge node is greater than or equal to the second preset threshold
  • the judgment module 202 judges the resource type of the resource.
  • the determining module 203 is further configured to determine the third edge node
  • the response module 204 is further configured to, when the judgment module 202 judges as yes, the response module 204 returns a second response message of the resource request to the client; the second response message is used to instruct the client to send the adjusted resource to the third edge node ask.
  • response module 204 is set to,
  • the response module 204 directly returns the resource to the client.
  • the first response message is used to instruct the client to send the adjusted resource request to the second edge node, so that the second edge node returns the resource requested by the adjusted resource request to the client, and the resource is the resource after distance adjustment
  • the resource that requests the starting position of the key frame position that reaches the second edge node with the closest system time.
  • An embodiment of the present disclosure provides a computer device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the executable instructions in the memory to implement the above method for processing a resource request.
  • FIG. 3 is a block diagram of a computer device 300 for a method for processing a resource request according to an exemplary embodiment.
  • computer device 300 may be provided as a server.
  • the computer device 300 includes a processor 301, and the number of the processors can be set to one or more as required.
  • Computer device 300 also has memory 302 for storing instructions executable by processor 301, such as application programs. The number of memories can be set to one or more as required. It can store one or more applications.
  • the processor 301 is configured to execute instructions to perform the steps of the above-mentioned resource request processing method.
  • Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium including instructions, on which executable instructions are stored, and when the executable instructions are executed by a processor, the above-mentioned method for processing a resource request is implemented.
  • the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
  • embodiments of the present disclosure may be provided as a method, an apparatus (apparatus), or a computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied therein.
  • Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data , including but not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may be used for Any other medium that stores desired information and can be accessed by a computer, etc.
  • communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the means implements the functions specified in one or more of the flowcharts and/or one or more blocks of the block diagrams
  • the terms “comprising”, “comprising” or any other variation thereof are intended to encompass a non-exclusive inclusion such that an article or device comprising a list of elements includes not only those elements, but also elements not expressly listed. other elements, or elements inherent to the article or equipment. Without further limitation, an element defined by the phrase “comprising” does not preclude the presence of additional identical elements in the article or device comprising said element.
  • using the resource request processing method of the present disclosure can improve the hit rate of resource requests at edge nodes, effectively reduce the cost of returning to the parent, reduce the internal consumption bandwidth, and improve the utilization efficiency of CDN edge nodes.

Abstract

The present disclosure relates to a resource request processing method, and is applied to a first edge node of a content delivery network. The method comprises: receiving a resource request of a client; determining whether the resource requested by the resource request is in the first edge node; when there is no resource, determining the type of the resource; when the resource is a first type of resource, the first edge node determines a second edge node, the first edge node returns a first response message of the resource request to the client, the first response message being used to instruct the client to send an adjusted resource request to the second edge node, wherein the first edge node returning the first response message of the resource request to the client comprises address information of the second edge node; when the resource is a second type of resource, the first edge node obtains the resource from an upper-layer node or a source station and returns same to the client.

Description

一种资源请求处理的方法、装置、计算机设备及介质A method, apparatus, computer equipment and medium for processing a resource request
本公开基于2021年03月29日提交中国专利局、申请号为202110332154.0,发明名称为“一种资源请求处理的方法、装置、计算机设备及介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。This disclosure is based on the Chinese patent application with the application number of 202110332154.0 and the invention titled "A method, device, computer equipment and medium for processing resource requests" filed with the China Patent Office on March 29, 2021, and requires the Chinese patent application priority, the entire content of this Chinese patent application is hereby incorporated into the present disclosure by reference.
技术领域technical field
本公开实施例涉及但不限于一种资源请求处理的方法、装置、计算机设备及介质。The embodiments of the present disclosure relate to, but are not limited to, a method, an apparatus, a computer device, and a medium for processing a resource request.
背景技术Background technique
CDN的全称是Content Delivery Network,即内容分发网络。CDN是构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞。The full name of CDN is Content Delivery Network, that is, Content Delivery Network. CDN is an intelligent virtual network built on the basis of the existing network, relying on edge servers deployed in various places, through the load balancing, content distribution, scheduling and other functional modules of the central platform, so that users can obtain the desired content nearby and reduce network congestion.
CDN命中率是指用户访问的时候,命中缓存的概率。CDN的架构是多层缓存聚合结构,第一层是边缘节点,中间是由一层或者多层父节点构成,最后一层是源站。相关技术中,客户端通过DNS解析随机访问到CDN边缘节点,请求内容未命中时,边缘节点转发请求至上层父节点,增加了回父成本,导致CDN回源率高、产生内耗带宽、网络性能差、时延大等问题,直接影响到CDN整体性能,用户体验差。The CDN hit rate refers to the probability of hitting the cache when a user accesses it. The architecture of CDN is a multi-layer cache aggregation structure. The first layer is the edge node, the middle layer is composed of one or more layers of parent nodes, and the last layer is the origin site. In the related art, the client randomly accesses the CDN edge node through DNS resolution. When the request content is not hit, the edge node forwards the request to the upper-level parent node, which increases the cost of returning to the parent, resulting in high CDN return rate, internal bandwidth consumption, and network performance. Problems such as poor performance and large delay directly affect the overall performance of the CDN, resulting in poor user experience.
发明内容SUMMARY OF THE INVENTION
以下是对本公开详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the subject matter detailed in this disclosure. This summary is not intended to limit the scope of protection of the claims.
为克服相关技术中存在的问题,本公开提供一种资源请求处理的方法、装置、计算机设备及介质。In order to overcome the problems existing in the related art, the present disclosure provides a method, apparatus, computer equipment and medium for processing a resource request.
根据本公开的第一方面,提供一种资源请求处理的方法,应用于内容分发网络的第一边缘节点,所述方法包括:According to a first aspect of the present disclosure, there is provided a method for processing a resource request, applied to a first edge node of a content distribution network, the method comprising:
第一边缘节点接收客户端的资源请求;The first edge node receives the resource request from the client;
所述第一边缘节点判断所述资源请求所请求的资源是否存在于所述第一边缘节点;The first edge node judges whether the resource requested by the resource request exists in the first edge node;
当不存在所述资源时,所述第一边缘节点对所述资源的类型进行判断;When the resource does not exist, the first edge node judges the type of the resource;
当所述资源为第一类型资源时,由所述第一边缘节点确定第二边缘节点,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,其中,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息包括所述第二边缘节点的地址信息;When the resource is the first type of resource, the first edge node determines a second edge node, the first edge node returns a first response message for the resource request to the client, the first edge node The response message is used to instruct the client to send the adjusted resource request to the second edge node, wherein the first response message returned by the first edge node to the client for the resource request includes the first response message. address information of the second edge node;
当所述资源为第二类型资源时,所述第一边缘节点向上层节点或源站获取所述资源并返回给所述客户端。When the resource is of the second type, the first edge node acquires the resource from an upper node or an origin station and returns it to the client.
在一些示例性的实施例中,所述第一边缘节点对所述资源的类型进行判断,包括:In some exemplary embodiments, the first edge node determines the type of the resource, including:
当预设时间内所述资源的访问次数小于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第一类型资源;When the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
当预设时间内所述资源的访问次数大于或等于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第二类型资源。When the number of times of accessing the resource within a preset time is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type.
在一些示例性的实施例中,所述预设时间内所述资源的访问次数包括:In some exemplary embodiments, the number of times of accessing the resource within the preset time includes:
所述资源在所述预设时间内在所述第一边缘节点的访问次数,和/或,所述资源在所述预设时间内在所述客户端所在区域内的边缘节点群的总访问次数。The access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
在一些示例性的实施例中,所述第一预设阈值根据第一边缘节点上针对所述资源请求所包含的地址信息的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对所述资源请求所包含的地址信息的历史访问情况进行设置。In some exemplary embodiments, the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the location of the client in the area where the client is located. On the edge node group, the historical access situation of the address information included in the resource request is set.
在一些示例性的实施例中,所述第一边缘节点确定第二边缘节点,包括:In some exemplary embodiments, the first edge node determines the second edge node, including:
所述第一边缘节点根据所述资源请求,确定资源标识;determining, by the first edge node, a resource identifier according to the resource request;
所述第一边缘节点将所述资源标识进行一致性哈希计算,生成所述资源的哈希值,其中,所述资源标识包括统一资源定位符或者域名;The first edge node performs consistent hash calculation on the resource identifier to generate a hash value of the resource, where the resource identifier includes a uniform resource locator or a domain name;
所述第一边缘节点计算所述第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;The first edge node calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash value of each edge node on the consistent hash ring;
所述第一边缘节点根据所述资源的哈希值在一致性哈希环上确定对应的所述第二边缘节点。The first edge node determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
在一些示例性的实施例中,由所述第一边缘节点确定第二边缘节点之后,还包括:In some exemplary embodiments, after the second edge node is determined by the first edge node, the method further includes:
所述第一边缘节点记录所述第二边缘节点,当再次接收到访问相同资源的所述资源请求 且所述资源为第一类型资源时,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息包括记录的所述第二边缘节点的地址信息。The first edge node records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the first edge node returns the information to the client. The first response message of the resource request includes the recorded address information of the second edge node.
在一些示例性的实施例中,所述第一边缘节点确定所述第二边缘节点,还包括:In some exemplary embodiments, the first edge node determines the second edge node, further comprising:
根据所述第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定所述第二边缘节点。The second edge node is determined according to the load situation of each edge node in the edge node group where the first edge node is located.
在一些示例性的实施例中,所述第一边缘节点对所述资源的类型进行判断之前,还包括:In some exemplary embodiments, before the first edge node determines the type of the resource, the method further includes:
所述第一边缘节点判断自身负载是否大于或等于第二预设阈值;The first edge node determines whether its own load is greater than or equal to a second preset threshold;
若判断为否,所述第一边缘节点对所述资源的资源类型进行判断。If the judgment is no, the first edge node judges the resource type of the resource.
在一些示例性的实施例中,所述方法还包括:In some exemplary embodiments, the method further includes:
若判断为是,所述第一边缘节点确定第三边缘节点,所述第一边缘节点向所述客户端返回所述资源请求的第二响应消息;If the judgment is yes, the first edge node determines a third edge node, and the first edge node returns a second response message for the resource request to the client;
所述第二响应消息用于指示所述客户端向所述第三边缘节点发送调整后的资源请求。The second response message is used to instruct the client to send the adjusted resource request to the third edge node.
在一些示例性的实施例中,所述方法还包括:In some exemplary embodiments, the method further includes:
在判断所述资源存在于所述第一边缘节点的情况下,直接向所述客户端返回所述资源。When it is determined that the resource exists in the first edge node, the resource is directly returned to the client.
在一些示例性的实施例中,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,以使所述第二边缘节点向所述客户端返回调整后的资源请求所请求的资源,所述资源为距离调整后的资源请求到达所述第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。In some exemplary embodiments, the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node returns to the client The adjusted resource requests the requested resource, where the resource is a resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
根据本公开的第二方面,提供一种资源请求处理的装置,应用于内容分发网络的第一边缘节点,所述装置包括:According to a second aspect of the present disclosure, there is provided an apparatus for processing a resource request, which is applied to a first edge node of a content distribution network, the apparatus comprising:
接收模块,设置为接收客户端的资源请求;The receiving module is set to receive the resource request of the client;
判断模块,设置为判断所述资源请求所请求的资源是否存在于所述第一边缘节点;当不存在所述资源时,所述判断模块对所述资源的类型进行判断;a judgment module, configured to judge whether the resource requested by the resource request exists in the first edge node; when the resource does not exist, the judgment module judges the type of the resource;
确定模块,设置为当所述判断模块判断所述资源为第一类型资源时,所述确定模块确定第二边缘节点;a determining module, configured to determine the second edge node by the determining module when the determining module determines that the resource is the first type of resource;
响应模块,设置为当所述判断模块判断所述资源为第一类型资源时,所述响应模块向所 述客户端返回所述资源请求的第一响应消息,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,其中,所述响应模块向所述客户端返回所述资源请求的第一响应消息包括所述第二边缘节点的地址信息;A response module, configured to return a first response message of the resource request to the client when the determination module determines that the resource is a first type resource, where the first response message is used to indicate The client sends the adjusted resource request to the second edge node, wherein the first response message that the response module returns to the client for the resource request includes address information of the second edge node;
响应模块还设置为,当所述判断模块判断所述资源为第二类型资源时,所述响应模块向上层节点或源站获取所述资源并返回给所述客户端。The response module is further configured to, when the judgment module judges that the resource is a resource of the second type, the response module obtains the resource from the upper-layer node or the source station and returns it to the client.
在一些示例性的实施例中,所述判断模块具体设置为:In some exemplary embodiments, the judging module is specifically set as:
当预设时间内所述资源的访问次数小于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第一类型资源;When the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
当预设时间内所述资源的访问次数大于或等于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第二类型资源。When the number of times of accessing the resource within a preset time is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type.
在一些示例性的实施例中,所述预设时间内所述资源的访问次数包括:In some exemplary embodiments, the number of times of accessing the resource within the preset time includes:
所述资源在所述预设时间内在所述第一边缘节点的访问次数,和/或,所述资源在所述预设时间内在所述客户端所在区域内的边缘节点群的总访问次数。The access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
在一些示例性的实施例中,所述第一预设阈值根据第一边缘节点上针对所述资源请求所包含的地址信息的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对所述资源请求所包含的地址信息的历史访问情况进行设置。In some exemplary embodiments, the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the location of the client in the area where the client is located. On the edge node group, the historical access situation of the address information included in the resource request is set.
在一些示例性的实施例中,所述确定模块还设置为,In some exemplary embodiments, the determining module is further configured to:
所述确定模块根据所述资源请求,确定资源标识;The determining module determines a resource identifier according to the resource request;
所述确定模块将所述资源标识进行一致性哈希计算,生成所述资源的哈希值,其中,所述资源标识包括统一资源定位符或者域名;The determining module performs consistent hash calculation on the resource identifier to generate a hash value of the resource, wherein the resource identifier includes a uniform resource locator or a domain name;
所述确定模块计算所述第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;The determining module calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash value of each edge node on the consistent hash ring;
所述确定模块根据所述资源的哈希值在一致性哈希环上确定对应的所述第二边缘节点。The determining module determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
在一些示例性的实施例中,所述响应模块还设置为,In some exemplary embodiments, the response module is further configured to:
所述响应模块记录所述第二边缘节点,当再次接收到访问相同资源的所述资源请求且所述资源为第一类型资源时,所述响应模块向所述客户端返回所述资源请求的第一响应消息包括记录的所述第二边缘节点的地址信息。The response module records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the response module returns the resource request to the client. The first response message includes the recorded address information of the second edge node.
在一些示例性的实施例中,所述确定模块还设置为,In some exemplary embodiments, the determining module is further configured to:
所述确定模块根据所述第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定所述第二边缘节点。The determining module determines the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located.
在一些示例性的实施例中,所述判断模块还设置为,In some exemplary embodiments, the judging module is further configured to:
所述判断模块判断所述第一边缘节点负载是否大于或等于第二预设阈值;The judgment module judges whether the load of the first edge node is greater than or equal to a second preset threshold;
若判断为否,所述判断模块对所述资源的资源类型进行判断。If the judgment is no, the judgment module judges the resource type of the resource.
在一些示例性的实施例中,所述判断模块若判断为是,In some exemplary embodiments, if the judgment module judges yes,
所述确定模块还设置为,确定第三边缘节点;The determining module is further configured to determine a third edge node;
所述响应模块还设置为,当所述判断模块判断为是时,所述响应模块向所述客户端返回所述资源请求的第二响应消息;所述第二响应消息用于指示所述客户端向所述第三边缘节点发送调整后的资源请求。The response module is further configured to, when the judgment module judges yes, the response module returns a second response message of the resource request to the client; the second response message is used to indicate the client The terminal sends the adjusted resource request to the third edge node.
在一些示例性的实施例中,所述响应模块设置为,In some exemplary embodiments, the response module is configured to:
在所述判断模块判断所述资源存在于所述第一边缘节点的情况下,所述响应模块直接向所述客户端返回所述资源。When the judgment module judges that the resource exists in the first edge node, the response module directly returns the resource to the client.
在一些示例性的实施例中,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,以使所述第二边缘节点向所述客户端返回调整后的资源请求所请求的资源,所述资源为距离调整后的资源请求到达所述第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。In some exemplary embodiments, the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node returns to the client The adjusted resource requests the requested resource, where the resource is a resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
根据本公开的第三方面,提供一种计算机设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行所述存储器中的可执行指令以实现如第一方面任一所述的方法。According to a third aspect of the present disclosure, there is provided a computer device comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions in the memory to achieve The method of any one of the first aspects.
根据本公开的第四方面,提供一种非临时性计算机可读存储介质,其上存储有可执行指令,该可执行指令被处理器执行时实现如第一方面所述的方法。According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium having executable instructions stored thereon, the executable instructions implementing the method of the first aspect when executed by a processor.
本公开提供的技术方案可以包括以下有益效果:采用本公开的资源请求处理的方法,可以提高资源请求在边缘节点的命中率,有效降低了回父成本,减少了内耗带宽,提高了CDN边缘节点的利用效率。The technical solutions provided by the present disclosure may include the following beneficial effects: by using the resource request processing method of the present disclosure, the hit rate of resource requests at edge nodes can be improved, the cost of returning to the parent can be effectively reduced, the internal consumption bandwidth can be reduced, and the CDN edge node can be improved. utilization efficiency.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制 本公开。在阅读并理解了附图和详细描述后,可以明白其他方面。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. Other aspects will become apparent upon reading and understanding of the drawings and detailed description.
附图说明Description of drawings
构成本公开的一部分的附图用来提供对本公开的进一步理解,本公开的示例性实施例及其说明用于解释本公开,并不构成对本公开的不当限定。在附图中:The accompanying drawings, which constitute a part of the present disclosure, are used to provide a further understanding of the present disclosure, and the exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the attached image:
图1是根据一示例性实施例示出的一种资源请求处理的方法的示意流程图;FIG. 1 is a schematic flowchart of a method for processing a resource request according to an exemplary embodiment;
图2是根据一示例性实施例示出的一种资源请求处理的装置的框图;2 is a block diagram of an apparatus for processing a resource request according to an exemplary embodiment;
图3是根据一示例性实施例示出的一种计算机设备的框图。Fig. 3 is a block diagram of a computer device according to an exemplary embodiment.
具体实施方式Detailed ways
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments These are some, but not all, embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present disclosure. It should be noted that, the embodiments in the present application and the features in the embodiments may be arbitrarily combined with each other if there is no conflict.
图1为本申请一示例性实施例提供的一种资源请求处理的方法的示意流程图。FIG. 1 is a schematic flowchart of a method for processing a resource request provided by an exemplary embodiment of the present application.
如图1所示,根据本公开的资源请求处理的方法,适用于内容分发网络的第一边缘节点,包括:As shown in FIG. 1 , the method for processing a resource request according to the present disclosure is applicable to a first edge node of a content distribution network, including:
步骤101,第一边缘节点接收客户端发送的资源请求; Step 101, the first edge node receives the resource request sent by the client;
在一些示例性的实施例中,客户端可以是台式电脑、笔记本电脑、智能手机或IOT设备等终端设备,也可以是常规服务器、云服务器或服务器阵列等服务端设备,还可以是指在客户机上运行的程序。内容分发网络中的调度中心节点在接收到客户端发送资源请求后,会将请求调度至内容分发网络中的第一边缘节点,在内容分发网络中,将接收来自客户端的资源请求的边缘节点定义为第一边缘节点。In some exemplary embodiments, the client may be a terminal device such as a desktop computer, a notebook computer, a smart phone, or an IOT device, or a server device such as a conventional server, a cloud server, or a server array. programs running on the machine. After receiving the resource request sent by the client, the scheduling center node in the content distribution network will schedule the request to the first edge node in the content distribution network. In the content distribution network, the edge node that receives the resource request from the client will be defined. is the first edge node.
第一边缘节点接收到的资源请求中至少包括资源标识和客户端标识。其中,资源标识可以是统一资源定位符或者域名、资源的名称等,根据资源标识便能够确定客户端所请求的资源。客户端标识可以是客户端地址信息、客户端类型、客户端ID等。The resource request received by the first edge node includes at least a resource identifier and a client identifier. The resource identifier may be a uniform resource locator, a domain name, a resource name, etc., and the resource requested by the client can be determined according to the resource identifier. The client identifier may be client address information, client type, client ID, and the like.
步骤102,第一边缘节点判断资源请求所请求的资源是否存在于第一边缘节点; Step 102, the first edge node judges whether the resource requested by the resource request exists in the first edge node;
在一些示例性的实施例中,第一边缘节点在接收到用户的资源请求时,获取资源请求中的资源标识,第一边缘节点查询本地是否存在客户端请求的资源,若存在(命中),第一边缘节点则直接向客户端返回资源。In some exemplary embodiments, when receiving a resource request from a user, the first edge node obtains the resource identifier in the resource request, and the first edge node queries whether the resource requested by the client exists locally, and if it exists (hit), The first edge node directly returns resources to the client.
步骤103,当不存在资源时,第一边缘节点对资源的类型进行判断; Step 103, when the resource does not exist, the first edge node judges the type of the resource;
在一些示例性的实施例中,当第一服务器判断本地不存在(未命中)资源时,第一边缘节点对资源的类型进行判断。在本公开的一个实施例中,资源的类型可以是根据资源格式、资源请求的协议类型、资源文件大小、资源所属频道、资源访问热度等进行区分;通过不同的方式对资源的类型进行判断,可以满足不同的客户需求,例如客户根据内容运营的需求将资源区分为热门频道资源和一般频道资源,通过这种区分,可以使CDN厂商对不同内容的处理方式能够更加精准地把握。In some exemplary embodiments, when the first server determines that the resource does not exist locally (misses), the first edge node determines the type of the resource. In an embodiment of the present disclosure, the types of resources can be distinguished according to the resource format, the protocol type of the resource request, the size of the resource file, the channel to which the resource belongs, the popularity of resource access, etc.; It can meet different customer needs. For example, customers can divide resources into popular channel resources and general channel resources according to the needs of content operation. Through this distinction, CDN manufacturers can more accurately grasp the processing methods of different content.
在本公开的一个实施例中,可以通过提前在边缘节点上部署资源类型匹配表,和/或,预先设置预设阈值用于对资源类型的判断。在本公开的一个实施例中,可以通过资源访问热度来对资源类型进行区分,通过预先设定的用来判定资源访问热度的第一预设阈值,并将资源的访问次数与第一预设阈值比较,以对资源类型进行判断。In an embodiment of the present disclosure, a resource type matching table may be deployed on an edge node in advance, and/or a preset threshold may be preset for judging the resource type. In one embodiment of the present disclosure, resource types can be distinguished by resource access heat, a preset first preset threshold used to determine resource access heat, and the number of resource accesses is compared with the first preset threshold. Threshold comparison to judge the resource type.
在本公开的一个实施例中,当预设时间内资源的访问次数小于资源请求所包含的地址信息对应的第一预设阈值,则判断资源为第一类型资源;当预设时间内资源的访问次数大于或等于资源请求所包含的地址信息对应的第一预设阈值,则判断资源为第二类型资源。其中,资源请求所包含的地址信息可以是资源请求中携带的资源关联的域名、IP、URL等信息,第一预设阈值至少包含以下两种设置方式:In an embodiment of the present disclosure, when the number of accesses to the resource within the preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the first type; If the number of accesses is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type. The address information included in the resource request may be information such as domain name, IP, and URL associated with the resource carried in the resource request, and the first preset threshold includes at least the following two setting methods:
方式一、根据域名的业务特性进行人工预估设置;Method 1: Perform manual estimation settings according to the business characteristics of the domain name;
方式二、根据第一边缘节点上针对资源请求所携带的域名的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对资源请求所携带的域名的历史访问情况进行设置;Mode 2: Set according to the historical access status of the domain name carried in the resource request on the first edge node, and/or, according to the historical access status of the domain name carried in the resource request on the edge node group in the area where the client is located. set up;
通过统计边缘节点在历史时间内针对不同域名的访问次数,并基于本领域技术人员的经验及所熟知的任意算法或通过机器学习的方式计算获得针对不同域名第一预设阈值,可以使资源类型分类更准确,在边缘节点做到更精细粒度的带宽控制。By counting the number of visits of edge nodes to different domain names in historical time, and calculating the first preset thresholds for different domain names based on the experience of those skilled in the art and any well-known algorithm or through machine learning, the resource type The classification is more accurate, and more fine-grained bandwidth control is achieved at the edge nodes.
通过统计客户端所在区域内边缘节点群在历史时间内针对不同区域的总访问次数,并基于本领域技术人员的经验及所熟知的任意算法或通过机器学习的方式计算获得针对不同域名 第一预设阈值,能够控制客户端所在区域内资源回上层节点或回源站的数量,使某一类型资源基于某一区域的特征聚合或分散,降低整体内耗带宽。The first predictions for different domain names are obtained by calculating the total number of visits to different areas by the edge node group in the area where the client is located in historical time, and based on the experience of those skilled in the art and any well-known algorithm or by machine learning. Setting a threshold can control the number of resources in the area where the client is located to return to the upper-layer node or source station, so that a certain type of resources can be aggregated or dispersed based on the characteristics of a certain area, reducing the overall bandwidth consumption.
通过统计边缘节点在历史时间内针对不同域名的访问次数和客户端所在区域内边缘节点群在历史时间内针对不同区域的总访问次数,基于本领域技术人员的经验及所熟知的任意算法或机器学习的方式,分别设置对应的预设阈值,将两个预设阈值进行比较,选择较小的预设阈值作为第一预设阈值,从而同时兼顾更精细粒度的带宽控制和控制资源在客户端所在边缘节点群回上层节点或回源站的数量。其中,历史时间可以由人工根据实际情况设定周期,具体可以为过去一个月,过去半年,过去一年,或过去全部时间,本实施例不做限定。By counting the number of visits of edge nodes to different domain names in historical time and the total number of visits of edge node groups to different regions in historical time in the region where the client is located, based on the experience of those skilled in the art and any well-known algorithm or machine In the learning method, the corresponding preset thresholds are respectively set, the two preset thresholds are compared, and the smaller preset threshold is selected as the first preset threshold, so as to simultaneously take into account more fine-grained bandwidth control and control resources on the client The number of back-to-upper nodes or back-to-origin stations in the edge node group. The period of the historical time may be manually set according to the actual situation, and may specifically be the past month, the past half year, the past one year, or the past entire time period, which is not limited in this embodiment.
步骤104,当判断资源为第一类型资源时,第一边缘节点确定第二边缘节点,第一边缘节点向客户端返回资源请求的第一响应消息,第一响应消息用于指示客户端向第二边缘节点发送调整后的资源请求,其中,第一边缘节点向客户端返回资源请求的第一响应消息包括第二边缘节点的地址信息。 Step 104, when judging that the resource is the first type of resource, the first edge node determines the second edge node, and the first edge node returns a first response message for the resource request to the client, where the first response message is used to instruct the client to send the The second edge node sends the adjusted resource request, wherein the first response message that the first edge node returns to the client for the resource request includes address information of the second edge node.
在一些示例性的实施例中,第一边缘节点在判断用户所请求的资源为第一类型资源时,第一边缘节点确定第二边缘节点,包括:第一边缘节点获取客户端所属区域对应的边缘节点群和资源请求中的资源标识;第一边缘节点基于资源标识,在边缘节点群中确定第二边缘节点,第一边缘节点向客户端发送资源请求的响应消息,其中,第一边缘节点向客户端返回资源请求的响应消息包括第二边缘节点的地址信息,和/或,第二边缘节点的标识信息,以使客户端能够向第二边缘节点发送调整后的资源请求,进而从第二边缘节点获取客户端所请求的资源。In some exemplary embodiments, when the first edge node determines that the resource requested by the user is the first type of resource, the first edge node determines the second edge node, including: the first edge node obtains the resource corresponding to the area to which the client belongs. The edge node group and the resource identifier in the resource request; the first edge node determines the second edge node in the edge node group based on the resource identifier, and the first edge node sends a response message to the client for the resource request, wherein the first edge node The response message that returns the resource request to the client includes the address information of the second edge node and/or the identification information of the second edge node, so that the client can send the adjusted resource request to the second edge node, and then start from the second edge node. The second edge node obtains the resources requested by the client.
步骤105,当资源为第二类型资源时,第一边缘节点向上层节点或源站获取资源并返回给客户端。 Step 105, when the resource is the second type of resource, the first edge node obtains the resource from the upper node or the source station and returns it to the client.
具体的,当第一边缘节点判断资源为第二类型资源时,即,在本实施例内,客户端所请求的资源为访问热度较高的资源时,第一边缘节点通过向上层节点获取资源,当上层节点不存在该资源,或没有上层节点时,第一边缘节点通过回源获取资源给客户端。Specifically, when the first edge node determines that the resource is the second type of resource, that is, in this embodiment, when the resource requested by the client is a resource with high access popularity, the first edge node obtains the resource from the upper-layer node by , when the upper-layer node does not have the resource, or there is no upper-layer node, the first edge node obtains the resource to the client through back-to-source.
在本公开的一个实施例中,在步骤102中,第一边缘节点对资源的类型进行判断之前,还包括:第一边缘节点判断自身负载是否大于或等于第二预设阈值;若判断为是,第一边缘节点根据资源请求的资源标识在其所属区域中确定存在资源请求所请求资源的第三边缘节点,并向客户端返回资源请求的第二响应消息,使得客户端向第三边缘节点发送调整后的资 源请求;若判断为否,第一边缘节点才进一步对资源类型进行判断。In an embodiment of the present disclosure, in step 102, before the first edge node determines the type of the resource, the method further includes: the first edge node determines whether its own load is greater than or equal to a second preset threshold; if the determination is yes , the first edge node determines that there is a third edge node of the resource requested by the resource request in its area according to the resource identifier of the resource request, and returns the second response message of the resource request to the client, so that the client sends the third edge node to the third edge node. Send the adjusted resource request; if the judgment is no, the first edge node further judges the resource type.
当第一边缘节点自身负载大于或等于第二预设阈值时,表明第一边缘节点的负载较大,不能快速响应客户端发送的资源请求,为了提高用户访问体验,达到快速响应资源请求的目的,第一边缘节点根据资源请求的资源标识在其所属区域中确定存在资源请求所请求资源的第三边缘节点,将包含第三边缘节点地址信息的第二响应消息发送给客户端,使得客户端可根据第二响应信息向第三边缘节点发送调整后的资源请求。当第一边缘节点自身负载小于第二预设阈值时,表明该第一边缘服务自身的负载较小,能够快速响应用户的资源请求,进而第一边缘节点继续对该资源的资源类型进行判断。When the load of the first edge node is greater than or equal to the second preset threshold, it indicates that the load of the first edge node is large and cannot quickly respond to the resource request sent by the client. In order to improve user access experience and achieve the purpose of quickly responding to resource requests , the first edge node determines that there is a third edge node of the resource requested by the resource request in its area according to the resource identifier of the resource request, and sends a second response message containing the address information of the third edge node to the client, so that the client The adjusted resource request may be sent to the third edge node according to the second response information. When the load of the first edge node itself is less than the second preset threshold, it indicates that the load of the first edge service itself is small and can quickly respond to the user's resource request, and then the first edge node continues to judge the resource type of the resource.
在本公开的一个实施例中,在步骤103中,第一边缘节点通过统计预设时间内针对该资源的访问次数对资源的类型进行判断,其中,预设时间内针对该资源的访问次数包括:资源在预设时间内在第一边缘节点的访问次数,和/或,资源在预设时间内在客户端所在区域内边缘节点群上的总访问次数,具体如下:In an embodiment of the present disclosure, in step 103, the first edge node determines the type of the resource by counting the number of accesses to the resource within a preset time, wherein the number of accesses to the resource within the preset time includes: : the number of times the resource is accessed on the first edge node within the preset time, and/or the total number of times the resource is accessed on the edge node group in the area where the client is located within the preset time, as follows:
方式一、获取资源请求中资源标识;根据资源标识,确定预设时间内在第一边缘节点上针对资源的总访问次数;Manner 1: Obtain the resource identifier in the resource request; according to the resource identifier, determine the total number of accesses to the resource on the first edge node within a preset time;
方式二、确定客户端所属区域和资源请求中的资源标识,基于客户端所属区域,获取客户端所属区域对应的边缘节点群;根据资源标识,获取预设时间内边缘节点群上针对资源的总访问次数,其中,总访问次数为在预设时间内边缘节点群中各个边缘节点上针对资源的访问次数的和值。Method 2: Determine the region to which the client belongs and the resource identifier in the resource request, and obtain the edge node group corresponding to the region to which the client belongs based on the region to which the client belongs; and obtain the total amount of resources on the edge node group within a preset time according to the resource identifier. The number of visits, where the total number of visits is the sum of the times of visits to resources on each edge node in the edge node group within a preset time.
在实际应用中,边缘节点能够根据资源请求中的资源标识确定用户所请求的资源,进而可以获取到针对该资源的所有资源请求,需要说明的是,各个区域内的各个边缘节点均可以在本地按照预设的采集周期(例如1分钟)统计该资源的访问次数,进一步,将该各自的访问次数上传至调度中心节点,或者调度中心节点定时向各个边缘节点获取。In practical applications, the edge node can determine the resource requested by the user according to the resource identifier in the resource request, and then can obtain all resource requests for the resource. It should be noted that each edge node in each area can be locally The access times of the resource are counted according to a preset collection period (for example, 1 minute), and further, the respective access times are uploaded to the scheduling center node, or the scheduling center node obtains from each edge node regularly.
在方式一中,第一边缘节点在接收到用户的资源请求时,可以在本地统计出预设时间内针对该资源的总访问次数,例如可以统计5分钟内第一边缘节点针对该资源的总访问次数,该预设时间可以是以接收到用户资源请求当前时刻为终点的前5分钟、前10分钟等,采集周期和该预设时间的时长在这里不做具体限制。In mode 1, when the first edge node receives the resource request from the user, it can locally count the total number of accesses to the resource within a preset time, for example, it can count the total number of accesses to the resource by the first edge node within 5 minutes. The number of visits. The preset time can be the first 5 minutes, the first 10 minutes, etc., ending at the current moment when the user resource request is received. The collection period and the duration of the preset time are not specifically limited here.
需要说明的是,方式二中,第一边缘节点获取资源请求的客户端标识,通过客户端标识确定客户端所属区域,进而获取客户端所属区域对应的边缘节点群。在实际应用中,第一边 缘节点可以根据客户端标识,或者通过客户端所属区域信息,查询客户端所属区域对应的边缘节点群。It should be noted that, in the second method, the first edge node obtains the client identifier of the resource request, determines the area to which the client belongs by using the client identifier, and then obtains the edge node group corresponding to the area to which the client belongs. In practical applications, the first edge node can query the edge node group corresponding to the area to which the client belongs according to the client identifier or information about the area to which the client belongs.
具体的,第一边缘节点可以通过自身来统计获取边缘节点群针对该资源的总访问次数,也可以直接向调度中心节点获取。Specifically, the first edge node can obtain the total access times of the resource by the edge node group through statistics by itself, or directly obtain from the scheduling center node.
具体的,调度中心节点获得各个边缘节点中针对该资源的访问次数,由调度中心节点按照预设的统计周期(例如1分钟)统计各个区域内的所有边缘节点针对该资源的访问次数,然后按照预设同步周期(例如1分钟)将所有边缘节点针对该资源的访问次数同步给相应区域内的各个边缘节点,第一边缘节点只需根据调度中心节点同步过来的访问次数进行汇总,即通过第一边缘节点在本地统计在预设时间内该边缘节点群针对该资源的总访问次数,例如对5分钟内边缘节点群中各个边缘节点针对该资源的访问次数进行求和,实现边缘节点通过自身统计获取到边缘节点群针对该资源的总访问次数。Specifically, the scheduling center node obtains the number of accesses to the resource in each edge node, and the scheduling center node counts the number of accesses to the resource by all edge nodes in each area according to a preset statistical period (for example, 1 minute), and then according to The preset synchronization period (for example, 1 minute) synchronizes the access times of all edge nodes to the resource to each edge node in the corresponding area. The first edge node only needs to summarize the access times synchronized by the scheduling center node, that is, through the first An edge node locally counts the total access times of the edge node group to the resource within a preset time, for example, summing the access times of each edge node in the edge node group to the resource within 5 minutes, so that the edge node can pass its own The total number of visits to the resource by the edge node group is obtained by statistics.
需要说明的是,调度中心节点获得各个边缘节点中针对该资源的访问次数,可以按照预设的统计周期(例如1分钟)统计各个区域内的所有边缘节点针对该资源的访问次数,并向相应区域内的所有边缘节点同步数据。此外,也可以不向相应区域的各个边缘节点同步数据,边缘节点直接向调度中心节点发送获取边缘节点群针对资源的总访问次数的查询信息,查询信息中至少包括预设时间的时长、客户端标识(或者客户端所属区域)和资源标识,由调度中心节点根据查询信息中的客户端标识(或者客户端所属区域)确定客户端所属区域对应的边缘节点群,统计预设时间内边缘节点群中各个边缘节点针对该资源的访问次数的和值,然后将统计得到的和值发送给边缘节点,实现边缘节点从调度中心节点获取到边缘节点群针对该资源的总访问次数。It should be noted that the scheduling center node obtains the number of accesses to the resource in each edge node, and can count the number of accesses to the resource by all edge nodes in each area according to a preset statistical period (for example, 1 minute), and report to the corresponding All edge nodes in the region synchronize data. In addition, instead of synchronizing data to each edge node in the corresponding area, the edge node directly sends query information to obtain the total number of accesses to the resource by the edge node group to the scheduling center node, and the query information at least includes the duration of the preset time, the client The identifier (or the area to which the client belongs) and the resource identifier. The dispatch center node determines the edge node group corresponding to the area to which the client belongs according to the client identifier (or the area to which the client belongs) in the query information, and counts the edge node group within a preset time. The sum of the access times of each edge node to the resource is sent to the edge node, so that the edge node can obtain the total access times of the resource by the edge node group from the scheduling center node.
其中,预设时间可以是以接收到用户资源请求当前时刻为终点的前5分钟、前10分钟等,统计周期、同步周期和预设时间的时长在这里不做具体限制。The preset time may be the first 5 minutes, the first 10 minutes, etc., ending at the current moment when the user resource request is received, and the duration of the statistical period, the synchronization period, and the preset time is not specifically limited here.
具体的,在本公开的一个实施例中,在步骤104中,第一边缘节点确定第二边缘节点,包括:第一边缘节点根据资源请求,确定资源标识;第一边缘节点将资源标识进行一致性哈希计算,生成资源的哈希值,其中,资源标识包括统一资源定位符或者域名;第一边缘节点计算第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;第一边缘节点根据资源的哈希值在一致性哈希环上确定对应的第二边缘节点。Specifically, in an embodiment of the present disclosure, in step 104, the first edge node determines the second edge node, including: the first edge node determines the resource identifier according to the resource request; the first edge node matches the resource identifier The first edge node calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and assigns each edge The hash value of the node is allocated on the consistent hash ring; the first edge node determines the corresponding second edge node on the consistent hash ring according to the hash value of the resource.
需要说明的是,第一边缘节点可以在资源请求中获取资源标识,资源标识可以是统一资源定位符URL或者域名,根据资源标识,通过一致性哈希算法计算得到该资源标识对应的哈希值,即资源对应的哈希值,对于不同的资源标识,通常可以计算得到不同的哈希值,因此资源标识与哈希值之间可以具备一一对应的关系,然后通过计算边缘节点群中全部或部分边缘节点的IP地址的哈希值,计算出各边缘节点对应的哈希值,即各个边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;在一致性哈希环上,从资源的哈希值位置出发沿预设方向搜索查找各个边缘节点IP地址的哈希值对应的位置,并将搜索到的第一个边缘节点IP地址的哈希值位置处表征的边缘节点确定为第二边缘节点,在本实施例中,通过一致性哈希算法,可以使边缘节点上的资源请求更加集中。客户端向根据资源标识确定的第二边缘节点发送调整后的资源请求,当第二边缘节点存在资源时,则将资源返回给客户端;当第二边缘节点不存在资源时,向上层节点或源站获取资源。It should be noted that the first edge node can obtain the resource identifier in the resource request, and the resource identifier can be a uniform resource locator URL or a domain name. According to the resource identifier, the hash value corresponding to the resource identifier is calculated by a consistent hash algorithm. , that is, the hash value corresponding to the resource. For different resource identifiers, different hash values can usually be calculated. Therefore, there can be a one-to-one correspondence between resource identifiers and hash values. Or the hash value of the IP address of some edge nodes, calculate the hash value corresponding to each edge node, that is, the hash value of each edge node, and assign the hash value of each edge node on the consistent hash ring; On the consistent hash ring, starting from the location of the hash value of the resource, search along the preset direction to find the location corresponding to the hash value of the IP address of each edge node, and use the hash value of the IP address of the first edge node to be searched. The edge node represented at the location is determined to be the second edge node. In this embodiment, the resource request on the edge node can be more concentrated through the consistent hashing algorithm. The client sends the adjusted resource request to the second edge node determined according to the resource identifier, and when the second edge node has resources, returns the resources to the client; when the second edge node does not have resources, sends the resource to the upper node or The origin site obtains resources.
在本公开的一个实施例中,通过一致性哈希算法定位第二边缘节点,可以保证同一个第一类型资源每次被访问时,都能访问到该第二边缘节点上,使得资源在边缘节点的命中率高,有效降低了回源率,使边缘节点的访问更加集中,不仅降低了回父的带宽,用户体验效果也更好。In an embodiment of the present disclosure, by locating the second edge node through a consistent hash algorithm, it can be ensured that the same first type resource can be accessed to the second edge node every time the resource is accessed, so that the resource is on the edge The high hit rate of the node effectively reduces the back-to-source rate and makes the access of edge nodes more concentrated, which not only reduces the bandwidth for returning to the parent, but also provides a better user experience.
在本公开的一个实施例中,在第一边缘节点确定第二边缘节点之后,还第一边缘节点可以记录下该第二边缘节点,当再次接收到访问相同资源的资源请求且该资源为第一类型资源时,第一边缘节点可以根据该记录的信息,直接向客户端返回包含该记录的第二边缘节点地址信息的响应消息。通过记录该第二边缘节点的消息,可以省去确定第二边缘节点的时长,提高客户端获得请求资源的效率。In an embodiment of the present disclosure, after the first edge node determines the second edge node, the first edge node may also record the second edge node, when a resource request for accessing the same resource is received again and the resource is the first edge node In the case of one type of resource, the first edge node may directly return to the client a response message containing the recorded address information of the second edge node according to the recorded information. By recording the message of the second edge node, the time for determining the second edge node can be omitted, and the efficiency of the client in obtaining the requested resource can be improved.
具体的,在本公开的一个实施例中,在步骤104中,第一边缘节点向客户端返回资源请求的第一响应消息,包括:获取资源请求中的资源标识和第二边缘节点的地址信息;第一边缘节点根据资源标识和地址信息,生成资源请求的第一响应消息,向客户端返回第一响应消息。Specifically, in an embodiment of the present disclosure, in step 104, the first edge node returns a first response message of the resource request to the client, including: obtaining the resource identifier in the resource request and the address information of the second edge node ; The first edge node generates a first response message for the resource request according to the resource identifier and address information, and returns the first response message to the client.
在实际应用中,第一边缘节点判断用户所请求的资源为第一类型资源时,可以根据获取的统一资源定位符URL和第二边缘节点的地址信息,构造第一响应消息,第一边缘节点将该第一响应消息发送给客户端,以使客户端接收到第一响应消息后将调整后的资源请求发送至第二边缘节点,进而客户端能够通过第二边缘节点获取用户所请求的资源,第二边缘节点的地址信息可以为第二边缘节点的IP地址,其中,第一响应消息可以携带HTTP状态码30X, 当状态码为30X时,是表示指示客户端重新发一个请求,第一边缘节点发送一个响应头Location,指定新请求的URL地址。In practical applications, when the first edge node determines that the resource requested by the user is the first type of resource, it can construct a first response message according to the obtained uniform resource locator URL and the address information of the second edge node. The first edge node Send the first response message to the client, so that the client sends the adjusted resource request to the second edge node after receiving the first response message, so that the client can obtain the resource requested by the user through the second edge node , the address information of the second edge node may be the IP address of the second edge node, wherein the first response message may carry the HTTP status code 30X, when the status code is 30X, it indicates that the client is instructed to resend a request, and the first response message may carry the HTTP status code 30X. The edge node sends a response header Location, specifying the URL address of the new request.
其中,第二边缘节点与第一边缘节点属于同一逻辑区域,例如可以是地理区域,或者运营商。The second edge node and the first edge node belong to the same logical area, which may be, for example, a geographic area or an operator.
在本公开的一个实施例中,第一边缘节点接收到客户端的资源请求,并在判断用户所请求的资源在第一边缘节点中不存在(未命中)时,根据资源请求,对用户所请求的资源进行资源类型判断,当判断用户所请求的资源为第一类型资源时,根据资源的资源标识确定第二边缘节点,然后向客户端发送该资源请求的响应消息,客户端根据响应消息向第二边缘节点发送调整后的资源请求,以使客户端可以通过同一地理区域内的第二边缘节点获取用户所请求的资源,可以实现当用户所请求的资源在第一边缘节点中属于访问热度低的第一类型资源时,指示客户端的发送调整后的资源请求至最有可能存在用户所请求的资源的其他边缘节点上,降低了回父成本,提高了冷资源在边缘节点的命中率,减少了内耗带宽和父节点性能带来的访问延迟,同时,使得与第一边缘节点属于同一区域的边缘节点中的资源能够被访问,提高了同一区域中其他边缘节点中的资源的使用率和访问率。In an embodiment of the present disclosure, the first edge node receives the resource request from the client, and when judging that the resource requested by the user does not exist (misses) in the first edge node, according to the resource request, determine the resource type of the resource requested by the user, when it is determined that the resource requested by the user is the first type of resource, determine the second edge node according to the resource identifier of the resource, and then send a response message to the client for the resource request, and the client sends a response message to the client according to the response message. The second edge node sends the adjusted resource request, so that the client can obtain the resource requested by the user through the second edge node in the same geographical area, which can realize that when the resource requested by the user belongs to the access heat in the first edge node When the first type resource is low, it instructs the client to send the adjusted resource request to other edge nodes that are most likely to have the resources requested by the user, which reduces the cost of returning to the parent and improves the hit rate of cold resources on edge nodes. It reduces the access delay caused by the internal bandwidth consumption and the performance of the parent node, and at the same time, enables the resources in the edge nodes that belong to the same area as the first edge node to be accessed, and improves the utilization rate of resources in other edge nodes in the same area. access rate.
在本公开的一个实施例中,在步骤104中,第一边缘节点确定第二边缘节点,还包括,根据第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定第二边缘节点。第一边缘节点根据边缘节点群中各边缘节点的负载情况进行筛选负载较低的边缘节点,确定为第二边缘节点,第一边缘节点将携带第二边缘节点地址信息的响应信息发送给客户端,客户端根据第二边缘节点的地址信息发送资源请求,第一边缘节点通过筛选负载较低的第二边缘节点能够快速的响应用户的资源请求,提高用户请求资源的响应速度和成功率,提升用户的使用体验。当选择负载较低的边缘节点不存在资源时,第二边缘节点通过回上层节点或源站获取资源,发送给客户端。在本实施例中,边缘节点也可以判断机器的带宽情况、CPU、IO、丢包率等质量数据替代负载情况进行判断和目标边缘节点的筛选。In an embodiment of the present disclosure, in step 104, the first edge node determines the second edge node, which further includes determining the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located . The first edge node selects the edge node with lower load according to the load situation of each edge node in the edge node group, and determines it as the second edge node, and the first edge node sends the response information carrying the address information of the second edge node to the client , the client sends a resource request according to the address information of the second edge node, the first edge node can quickly respond to the user's resource request by screening the second edge node with lower load, improve the response speed and success rate of the user's request for resources, and improve the User experience. When the selected edge node with lower load does not have the resource, the second edge node obtains the resource by returning to the upper-layer node or the source station, and sends it to the client. In this embodiment, the edge node can also judge the bandwidth of the machine, CPU, IO, packet loss rate and other quality data instead of the load to judge and screen the target edge node.
在本公开的一个实施例中,第一响应消息用于指示客户端向第二边缘节点发送调整后的资源请求,以使第二边缘节点向客户端返回调整后的资源请求所请求的资源。也就是说,客户端根据第一响应消息向第二边缘节点发送调整后的资源请求之后,客户端接收第二边缘节点返回的调整后的资源请求所请求的资源,资源为距离调整后的资源请求到达第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。在直播场景下,主播端开始直播后,主播端会将直播视频数据实时推流到边缘节点,当用户的资源请求到达第二边缘节点时,为保 证用户能够用户在请求到达时能够准确获取对应时间的视频资源,第二边缘节点会将距离资源请求到达第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源推给客户端,以便用户能够及时观看到清晰的直播流内容而不产生花屏和卡顿。In an embodiment of the present disclosure, the first response message is used to instruct the client to send the adjusted resource request to the second edge node, so that the second edge node returns the resource requested by the adjusted resource request to the client. That is, after the client sends the adjusted resource request to the second edge node according to the first response message, the client receives the resource requested by the adjusted resource request returned by the second edge node, and the resource is the resource after distance adjustment The resource that requests the starting position of the key frame position that reaches the second edge node with the closest system time. In the live broadcast scenario, after the host starts the live broadcast, the host will push the live video data to the edge node in real time. When the user's resource request reaches the second edge node, in order to ensure that the user can accurately obtain the corresponding information when the request arrives Time video resources, the second edge node will push the key frame position closest to the system time when the resource request reaches the second edge node as the resource at the starting position to the client, so that the user can watch the clear live streaming content in time. Does not produce blur and freeze.
根据大量的实验数据得出,利用本公开实施例提供的方法进行资源请求,使得在边缘节点未命中的概率低,对于同一个第一类型资源来说,在N个区域中,在第一边缘节点未命中时,第一边缘节点最多回父或者回源N次,有效降低15-20%的回父或者回源带宽,而且,通过在边缘节点上判断决策对不同资源类型请求的处理方式以重新分配和调整处理请求的边缘节点,还能够大大提高CDN边缘节点的利用效率。According to a large amount of experimental data, it is concluded that the method provided by the embodiments of the present disclosure is used to perform resource requests, so that the probability of the edge node being missed is low. For the same first type resource, in N regions, the first edge When the node is not hit, the first edge node will return to the parent or the source N times at most, effectively reducing the bandwidth of returning to the parent or the source by 15-20%. Moreover, the processing method of different resource type requests is determined by judging and deciding on the edge node. Reallocating and adjusting edge nodes that process requests can also greatly improve the utilization efficiency of CDN edge nodes.
图2示例性地示出了根据本公开的资源请求处理的装置的框图。FIG. 2 exemplarily shows a block diagram of an apparatus for resource request processing according to the present disclosure.
如图2所示,提供一种资源请求处理的装置,应用于内容分发网络的第一边缘节点,该装置包括:As shown in FIG. 2, an apparatus for processing a resource request is provided, which is applied to a first edge node of a content distribution network, and the apparatus includes:
接收模块201,设置为接收客户端的资源请求;The receiving module 201 is configured to receive the resource request of the client;
判断模块202,设置为判断资源请求所请求的资源是否存在于第一边缘节点;当不存在资源时,判断模块202对资源的类型进行判断;The judging module 202 is configured to judge whether the resource requested by the resource request exists in the first edge node; when the resource does not exist, the judging module 202 judges the type of the resource;
确定模块203,设置为当判断模块202判断资源为第一类型资源时,确定模块203确定第二边缘节点;The determining module 203 is configured to determine the second edge node when the determining module 202 determines that the resource is the first type of resource;
响应模块204,设置为当判断模块202判断资源为第一类型资源时,响应模块204向客户端返回资源请求的第一响应消息,第一响应消息设置为指示客户端向第二边缘节点发送调整后的资源请求,其中,响应模块204向客户端返回资源请求的第一响应消息包括第二边缘节点的地址信息;The response module 204 is configured to, when the determination module 202 determines that the resource is the first type of resource, the response module 204 returns a first response message of the resource request to the client, and the first response message is set to instruct the client to send the adjustment to the second edge node The subsequent resource request, wherein the first response message that the response module 204 returns to the client for the resource request includes the address information of the second edge node;
响应模块204还设置为,当判断模块202判断资源为第二类型资源时,响应模块204向上层节点或源站获取资源并返回给客户端。The response module 204 is further configured to, when the determination module 202 determines that the resource is the second type of resource, the response module 204 obtains the resource from the upper-layer node or the source station and returns it to the client.
其中,判断模块202具体设置为:Wherein, the judging module 202 is specifically set as:
当预设时间内资源的访问次数小于资源请求所包含的地址信息对应的第一预设阈值,则判断资源为第一类型资源;When the number of times the resource is accessed within the preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the first type;
当预设时间内资源的访问次数大于或等于资源请求所包含的地址信息对应的第一预设阈值,则判断资源为第二类型资源。When the number of accesses to the resource within the preset time is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, the resource is determined to be of the second type.
其中,预设时间内资源的访问次数包括:The number of accesses to the resource within the preset time period includes:
资源在预设时间内在第一边缘节点的访问次数,和/或,资源在预设时间内在客户端所在区域内的边缘节点群的总访问次数。The number of times the resource is accessed at the first edge node within the preset time, and/or the total number of times the resource is accessed by the edge node group in the area where the client is located within the preset time.
其中,第一预设阈值根据第一边缘节点上针对资源请求所包含的地址信息的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对资源请求所包含的地址信息的历史访问情况进行设置。The first preset threshold is set according to the historical access situation of the address information included in the resource request on the first edge node, and/or according to the address included in the resource request on the edge node group in the area where the client is located Set the historical access to information.
其中,确定模块203还设置为,Wherein, the determining module 203 is also set to:
确定模块203根据资源请求,确定资源标识;The determining module 203 determines the resource identifier according to the resource request;
确定模块203将资源标识进行一致性哈希计算,生成资源的哈希值,其中,资源标识包括统一资源定位符或者域名;The determination module 203 performs consistent hash calculation on the resource identifier, and generates a hash value of the resource, wherein the resource identifier includes a uniform resource locator or a domain name;
确定模块203计算第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;The determination module 203 calculates the hash values of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash values of each edge node on the consistent hash ring;
确定模块203根据资源的哈希值在一致性哈希环上确定对应的第二边缘节点。The determining module 203 determines the corresponding second edge node on the consistent hash ring according to the hash value of the resource.
其中,响应模块204还设置为,Wherein, the response module 204 is also set to:
响应模块204记录第二边缘节点,当再次接收到访问相同资源的资源请求且资源为第一类型资源时,响应模块204向客户端返回资源请求的第一响应消息包括记录的第二边缘节点的地址信息。The response module 204 records the second edge node, and when the resource request for accessing the same resource is received again and the resource is the first type of resource, the response module 204 returns the first response message of the resource request to the client including the recorded second edge node. Address information.
其中,确定模块203还设置为,Wherein, the determining module 203 is also set to:
确定模块203根据第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定第二边缘节点。The determining module 203 determines the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located.
其中,判断模块202还设置为,Wherein, the judging module 202 is also set to:
判断模块202判断第一边缘节点负载是否大于或等于第二预设阈值;The judgment module 202 judges whether the load of the first edge node is greater than or equal to the second preset threshold;
若判断为否,判断模块202对资源的资源类型进行判断。If the judgment is no, the judgment module 202 judges the resource type of the resource.
其中,判断模块202若判断为是,Wherein, if the judgment module 202 judges to be yes,
确定模块203还设置为,确定第三边缘节点;The determining module 203 is further configured to determine the third edge node;
响应模块204还设置为,当判断模块202判断为是时,响应模块204向客户端返回资源 请求的第二响应消息;第二响应消息用于指示客户端向第三边缘节点发送调整后的资源请求。The response module 204 is further configured to, when the judgment module 202 judges as yes, the response module 204 returns a second response message of the resource request to the client; the second response message is used to instruct the client to send the adjusted resource to the third edge node ask.
其中,响应模块204设置为,Wherein, the response module 204 is set to,
在判断模块202判断资源存在于第一边缘节点的情况下,响应模块204直接向客户端返回资源。When the determination module 202 determines that the resource exists in the first edge node, the response module 204 directly returns the resource to the client.
其中,第一响应消息用于指示客户端向第二边缘节点发送调整后的资源请求,以使第二边缘节点向客户端返回调整后的资源请求所请求的资源,资源为距离调整后的资源请求到达第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。The first response message is used to instruct the client to send the adjusted resource request to the second edge node, so that the second edge node returns the resource requested by the adjusted resource request to the client, and the resource is the resource after distance adjustment The resource that requests the starting position of the key frame position that reaches the second edge node with the closest system time.
本公开实施例中提供一种计算机设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,处理器被配置为执行存储器中的可执行指令以实现上述资源请求处理的方法。An embodiment of the present disclosure provides a computer device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the executable instructions in the memory to implement the above method for processing a resource request.
图3是根据一示例性实施例示出的一种用于资源请求处理方法的计算机设备300的框图。例如,计算机设备300可以被提供为一服务器。参照图3,计算机设备300包括处理器301,处理器的个数可以根据需要设置为一个或者多个。计算机设备300还存储器302,用于存储可由处理器301的执行的指令,例如应用程序。存储器的个数可以根据需要设置一个或者多个。其存储的应用程序可以为一个或者多个。处理器301被配置为执行指令,以执行上述资源请求处理方法的步骤。FIG. 3 is a block diagram of a computer device 300 for a method for processing a resource request according to an exemplary embodiment. For example, computer device 300 may be provided as a server. Referring to FIG. 3 , the computer device 300 includes a processor 301, and the number of the processors can be set to one or more as required. Computer device 300 also has memory 302 for storing instructions executable by processor 301, such as application programs. The number of memories can be set to one or more as required. It can store one or more applications. The processor 301 is configured to execute instructions to perform the steps of the above-mentioned resource request processing method.
本公开实施例还提供了一种包括指令的非临时性计算机可读存储介质,其上存储有可执行指令,该可执行指令被处理器执行时实现上述资源请求处理的方法。例如,非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium including instructions, on which executable instructions are stored, and when the executable instructions are executed by a processor, the above-mentioned method for processing a resource request is implemented. For example, the non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
本领域技术人员应明白,本公开的实施例可提供为方法、装置(设备)、或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质上实施的计算机程序产品的形式。计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质,包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质等。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或 者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。As will be appreciated by those skilled in the art, embodiments of the present disclosure may be provided as a method, an apparatus (apparatus), or a computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied therein. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data , including but not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or may be used for Any other medium that stores desired information and can be accessed by a computer, etc. In addition, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and can include any information delivery media, as is well known to those of ordinary skill in the art .
本公开是参照根据本公开实施例的方法、装置(设备)和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (apparatus) and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The means implements the functions specified in one or more of the flowcharts and/or one or more blocks of the block diagrams
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.
在本公开中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括……”限定的要素,并不排除在包括所述要素的物品或者设备中还存在另外的相同要素。In this disclosure, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that an article or device comprising a list of elements includes not only those elements, but also elements not expressly listed. other elements, or elements inherent to the article or equipment. Without further limitation, an element defined by the phrase "comprising" does not preclude the presence of additional identical elements in the article or device comprising said element.
尽管已描述了本公开的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本公开范围的所有变更和修改。While the preferred embodiments of the present disclosure have been described, additional changes and modifications to these embodiments may occur to those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be construed to include the preferred embodiment and all changes and modifications that fall within the scope of the present disclosure.
显然,本领域的技术人员可以对本公开进行各种改动和变型而不脱离本公开的精神和范围。这样,倘若本公开的这些修改和变型属于本公开权利要求及其等同技术的范围之内,则本公开的意图也包含这些改动和变型在内。It will be apparent to those skilled in the art that various modifications and variations can be made in the present disclosure without departing from the spirit and scope of the present disclosure. Thus, provided that these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include such modifications and variations as well.
工业实用性Industrial Applicability
在本公开中,采用本公开的资源请求处理的方法,可以提高资源请求在边缘节点的命中率,有效降低了回父成本,减少了内耗带宽,提高了CDN边缘节点的利用效率。In the present disclosure, using the resource request processing method of the present disclosure can improve the hit rate of resource requests at edge nodes, effectively reduce the cost of returning to the parent, reduce the internal consumption bandwidth, and improve the utilization efficiency of CDN edge nodes.

Claims (24)

  1. 一种资源请求处理的方法,应用于内容分发网络的第一边缘节点,所述方法包括:A method for processing a resource request, applied to a first edge node of a content distribution network, the method comprising:
    第一边缘节点接收客户端的资源请求;The first edge node receives the resource request from the client;
    所述第一边缘节点判断所述资源请求所请求的资源是否存在于所述第一边缘节点;The first edge node judges whether the resource requested by the resource request exists in the first edge node;
    当不存在所述资源时,所述第一边缘节点对所述资源的类型进行判断;When the resource does not exist, the first edge node judges the type of the resource;
    当所述资源为第一类型资源时,由所述第一边缘节点确定第二边缘节点,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,其中,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息包括所述第二边缘节点的地址信息;When the resource is the first type of resource, the first edge node determines a second edge node, the first edge node returns a first response message for the resource request to the client, the first edge node The response message is used to instruct the client to send the adjusted resource request to the second edge node, wherein the first response message returned by the first edge node to the client for the resource request includes the first response message. address information of the second edge node;
    当所述资源为第二类型资源时,所述第一边缘节点向上层节点或源站获取所述资源并返回给所述客户端。When the resource is of the second type, the first edge node acquires the resource from an upper node or an origin station and returns it to the client.
  2. 如权利要求1所述的方法,其中,所述第一边缘节点对所述资源的类型进行判断,包括:The method of claim 1, wherein the first edge node determines the type of the resource, comprising:
    当预设时间内所述资源的访问次数小于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第一类型资源;When the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
    当预设时间内所述资源的访问次数大于或等于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第二类型资源。When the number of times of accessing the resource within a preset time is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type.
  3. 如权利要求2所述的方法,其中,所述预设时间内所述资源的访问次数包括:The method of claim 2, wherein the number of times of accessing the resource within the preset time comprises:
    所述资源在所述预设时间内在所述第一边缘节点的访问次数,和/或,所述资源在所述预设时间内在所述客户端所在区域内的边缘节点群的总访问次数。The access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
  4. 如权利要求2所述的方法,其中,所述第一预设阈值根据第一边缘节点上针对所述资源请求所包含的地址信息的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对所述资源请求所包含的地址信息的历史访问情况进行设置。The method according to claim 2, wherein the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the region where the client is located The historical access situation of the address information included in the resource request is set on the edge node group within the resource request.
  5. 如权利要求1所述的方法,其中,所述第一边缘节点确定第二边缘节点,包括:The method of claim 1, wherein the first edge node determines the second edge node, comprising:
    所述第一边缘节点根据所述资源请求,确定资源标识;determining, by the first edge node, a resource identifier according to the resource request;
    所述第一边缘节点将所述资源标识进行一致性哈希计算,生成所述资源的哈希值,其中,所述资源标识包括统一资源定位符或者域名;The first edge node performs consistent hash calculation on the resource identifier to generate a hash value of the resource, where the resource identifier includes a uniform resource locator or a domain name;
    所述第一边缘节点计算所述第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各个边缘节点的哈希值分配在一致性哈希环上;The first edge node calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and allocates the hash value of each edge node on the consistent hash ring;
    所述第一边缘节点根据所述资源的哈希值在一致性哈希环上确定对应的所述第二边缘节点。The first edge node determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
  6. 如权利要求1所述的方法,其中,由所述第一边缘节点确定第二边缘节点之后,还包括:The method of claim 1, wherein after the second edge node is determined by the first edge node, the method further comprises:
    所述第一边缘节点记录所述第二边缘节点,当再次接收到访问相同资源的所述资源请求且所述资源为第一类型资源时,所述第一边缘节点向所述客户端返回所述资源请求的第一响应消息包括记录的所述第二边缘节点的地址信息。The first edge node records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the first edge node returns the information to the client. The first response message of the resource request includes the recorded address information of the second edge node.
  7. 如权利要求1所述的方法,其中,所述第一边缘节点确定所述第二边缘节点,还包括:The method of claim 1, wherein the first edge node determines the second edge node, further comprising:
    根据所述第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定所述第二边缘节点。The second edge node is determined according to the load situation of each edge node in the edge node group where the first edge node is located.
  8. 如权利要求1所述的方法,其中,所述第一边缘节点对所述资源的类型进行判断之前,还包括:The method according to claim 1, wherein before the first edge node judges the type of the resource, the method further comprises:
    所述第一边缘节点判断自身负载是否大于或等于第二预设阈值;The first edge node determines whether its own load is greater than or equal to a second preset threshold;
    若判断为否,所述第一边缘节点对所述资源的资源类型进行判断。If the judgment is no, the first edge node judges the resource type of the resource.
  9. 如权利要求8所述的方法,所述方法还包括:The method of claim 8, further comprising:
    若判断为是,所述第一边缘节点确定第三边缘节点,所述第一边缘节点向所述客户端返回所述资源请求的第二响应消息;If the judgment is yes, the first edge node determines a third edge node, and the first edge node returns a second response message for the resource request to the client;
    所述第二响应消息用于指示所述客户端向所述第三边缘节点发送调整后的资源请求。The second response message is used to instruct the client to send the adjusted resource request to the third edge node.
  10. 如权利要求1所述的方法,所述方法还包括:The method of claim 1, further comprising:
    在判断所述资源存在于所述第一边缘节点的情况下,直接向所述客户端返回所述资源。When it is determined that the resource exists in the first edge node, the resource is directly returned to the client.
  11. 如权利要求1所述的方法,其中,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,以使所述第二边缘节点向所述客户端返回调整后的资源请求所请求的资源,所述资源为距离调整后的资源请求到达所述第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。The method of claim 1, wherein the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node sends the client The terminal returns the resource requested by the adjusted resource request, where the resource is the resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
  12. 一种资源请求处理的装置,应用于内容分发网络的第一边缘节点,所述装置包括:An apparatus for processing a resource request, applied to a first edge node of a content distribution network, the apparatus comprising:
    接收模块,设置为接收客户端的资源请求;The receiving module is set to receive the resource request of the client;
    判断模块,设置为判断所述资源请求所请求的资源是否存在于所述第一边缘节点;当不存在所述资源时,所述判断模块对所述资源的类型进行判断;a judgment module, configured to judge whether the resource requested by the resource request exists in the first edge node; when the resource does not exist, the judgment module judges the type of the resource;
    确定模块,设置为当所述判断模块判断所述资源为第一类型资源时,所述确定模块确定第二边缘节点;a determining module, configured to determine the second edge node by the determining module when the determining module determines that the resource is the first type of resource;
    响应模块,设置为当所述判断模块判断所述资源为第一类型资源时,所述响应模块向所述客户端返回所述资源请求的第一响应消息,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,其中,所述响应模块向所述客户端返回所述资源请求的第一响应消息包括所述第二边缘节点的地址信息;A response module, configured to return a first response message of the resource request to the client when the determination module determines that the resource is a first type resource, where the first response message is used to indicate The client sends the adjusted resource request to the second edge node, wherein the first response message that the response module returns to the client for the resource request includes address information of the second edge node;
    响应模块还设置为,当所述判断模块判断所述资源为第二类型资源时,所述响应模块向上层节点或源站获取所述资源并返回给所述客户端。The response module is further configured to, when the judgment module judges that the resource is a resource of the second type, the response module obtains the resource from the upper-layer node or the source station and returns it to the client.
  13. 如权利要求12所述的装置,其中,所述判断模块具体设置为:The device according to claim 12, wherein the judging module is specifically set as:
    当预设时间内所述资源的访问次数小于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第一类型资源;When the access times of the resource within a preset time is less than the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is a first type of resource;
    当预设时间内所述资源的访问次数大于或等于所述资源请求所包含的地址信息对应的第一预设阈值,则判断所述资源为第二类型资源。When the number of times of accessing the resource within a preset time is greater than or equal to the first preset threshold corresponding to the address information included in the resource request, it is determined that the resource is of the second type.
  14. 如权利要求13所述的装置,其中,所述预设时间内所述资源的访问次数包括:The apparatus of claim 13, wherein the number of times of accessing the resource within the preset time comprises:
    所述资源在所述预设时间内在所述第一边缘节点的访问次数,和/或,所述资源在所述预设时间内在所述客户端所在区域内的边缘节点群的总访问次数。The access times of the resource at the first edge node within the preset time, and/or the total access times of the resource in the edge node group in the area where the client is located within the preset time.
  15. 如权利要求14所述的装置,其中,所述第一预设阈值根据第一边缘节点上针对所述资源请求所包含的地址信息的历史访问情况进行设置,和/或,根据客户端所在区域内的边缘节点群上针对所述资源请求所包含的地址信息的历史访问情况进行设置。The apparatus according to claim 14, wherein the first preset threshold is set according to historical access conditions of the address information included in the resource request on the first edge node, and/or according to the region where the client is located The historical access situation of the address information included in the resource request is set on the edge node group within the resource request.
  16. 如权利要求12所述的装置,其中,所述确定模块还设置为,The apparatus of claim 12, wherein the determining module is further configured to:
    所述确定模块根据所述资源请求,确定资源标识;The determining module determines a resource identifier according to the resource request;
    所述确定模块将所述资源标识进行一致性哈希计算,生成所述资源的哈希值,其中,所述资源标识包括统一资源定位符或者域名;The determining module performs consistent hash calculation on the resource identifier to generate a hash value of the resource, wherein the resource identifier includes a uniform resource locator or a domain name;
    所述确定模块计算所述第一边缘节点所在区域内的全部或部分边缘节点的哈希值,将各 个边缘节点的哈希值分配在一致性哈希环上;The determining module calculates the hash value of all or part of the edge nodes in the area where the first edge node is located, and assigns the hash value of each edge node on the consistent hash ring;
    所述确定模块根据所述资源的哈希值在一致性哈希环上确定对应的所述第二边缘节点。The determining module determines the corresponding second edge node on a consistent hash ring according to the hash value of the resource.
  17. 如权利要求12所述的装置,其中,所述响应模块还设置为,The apparatus of claim 12, wherein the response module is further configured to:
    所述响应模块记录所述第二边缘节点,当再次接收到访问相同资源的所述资源请求且所述资源为第一类型资源时,所述响应模块向所述客户端返回所述资源请求的第一响应消息包括记录的所述第二边缘节点的地址信息。The response module records the second edge node, and when the resource request for accessing the same resource is received again and the resource is of the first type, the response module returns the resource request to the client. The first response message includes the recorded address information of the second edge node.
  18. 如权利要求12所述的装置,其中,所述确定模块还设置为,The apparatus of claim 12, wherein the determining module is further configured to:
    所述确定模块根据所述第一边缘节点所在的边缘节点群中的各个边缘节点的负载情况确定所述第二边缘节点。The determining module determines the second edge node according to the load situation of each edge node in the edge node group where the first edge node is located.
  19. 如权利要求12所述的装置,其中,所述判断模块还设置为,The device of claim 12, wherein the judgment module is further configured to:
    所述判断模块判断所述第一边缘节点负载是否大于或等于第二预设阈值;The judgment module judges whether the load of the first edge node is greater than or equal to a second preset threshold;
    若判断为否,所述判断模块对所述资源的资源类型进行判断。If the judgment is no, the judgment module judges the resource type of the resource.
  20. 如权利要求19所述的装置,其中,所述判断模块若判断为是,The device according to claim 19, wherein, if the judgment module judges yes,
    所述确定模块还设置为,确定第三边缘节点;The determining module is further configured to determine a third edge node;
    所述响应模块还设置为,当所述判断模块判断为是时,所述响应模块向所述客户端返回所述资源请求的第二响应消息;所述第二响应消息用于指示所述客户端向所述第三边缘节点发送调整后的资源请求。The response module is further configured to, when the judgment module judges yes, the response module returns a second response message of the resource request to the client; the second response message is used to indicate the client The terminal sends the adjusted resource request to the third edge node.
  21. 如权利要求12所述的装置,其中,所述响应模块设置为,The apparatus of claim 12, wherein the response module is configured to,
    在所述判断模块判断所述资源存在于所述第一边缘节点的情况下,所述响应模块直接向所述客户端返回所述资源。When the judgment module judges that the resource exists in the first edge node, the response module directly returns the resource to the client.
  22. 如权利要求12所述的装置,其中,所述第一响应消息用于指示所述客户端向所述第二边缘节点发送调整后的资源请求,以使所述第二边缘节点向所述客户端返回调整后的资源请求所请求的资源,所述资源为距离调整后的资源请求到达所述第二边缘节点的系统时间最近的关键帧位置作为起始位置的资源。The apparatus of claim 12, wherein the first response message is used to instruct the client to send an adjusted resource request to the second edge node, so that the second edge node sends an adjusted resource request to the client The terminal returns the resource requested by the adjusted resource request, where the resource is the resource whose starting position is the key frame position closest to the system time at which the adjusted resource request arrives at the second edge node.
  23. 一种计算机设备,包括处理器、存储器和存储于所述存储器上的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1-11中任一项所述方法的步骤。A computer device comprising a processor, a memory and a computer program stored on the memory, wherein the processor implements the steps of the method according to any one of claims 1-11 when the processor executes the computer program.
  24. 一种计算机可读存储介质,其上存储有可执行指令,其中,该可执行指令被处理器执行时,实现如权利要求1-11中任一项所述方法的步骤。A computer-readable storage medium having executable instructions stored thereon, wherein the executable instructions, when executed by a processor, implement the steps of the method according to any one of claims 1-11.
PCT/CN2022/082667 2021-03-29 2022-03-24 Resource request processing method and apparatus, computer device, and medium WO2022206529A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110332154.0A CN115208955B (en) 2021-03-29 Method, device, computer equipment and medium for processing resource request
CN202110332154.0 2021-03-29

Publications (1)

Publication Number Publication Date
WO2022206529A1 true WO2022206529A1 (en) 2022-10-06

Family

ID=83457973

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/082667 WO2022206529A1 (en) 2021-03-29 2022-03-24 Resource request processing method and apparatus, computer device, and medium

Country Status (1)

Country Link
WO (1) WO2022206529A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106888270A (en) * 2017-03-30 2017-06-23 网宿科技股份有限公司 Return the method and system of source routing scheduling
CN107172186A (en) * 2017-06-12 2017-09-15 中国联合网络通信集团有限公司 Content acquisition method and system
CN110430286A (en) * 2019-08-30 2019-11-08 杭州领智云画科技有限公司 Method, apparatus, equipment and the storage medium of resource are obtained in CDN system
CN112422702A (en) * 2020-08-10 2021-02-26 上海哔哩哔哩科技有限公司 CDN back-to-source method, system and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106888270A (en) * 2017-03-30 2017-06-23 网宿科技股份有限公司 Return the method and system of source routing scheduling
CN107172186A (en) * 2017-06-12 2017-09-15 中国联合网络通信集团有限公司 Content acquisition method and system
CN110430286A (en) * 2019-08-30 2019-11-08 杭州领智云画科技有限公司 Method, apparatus, equipment and the storage medium of resource are obtained in CDN system
CN112422702A (en) * 2020-08-10 2021-02-26 上海哔哩哔哩科技有限公司 CDN back-to-source method, system and computer equipment

Also Published As

Publication number Publication date
CN115208955A (en) 2022-10-18

Similar Documents

Publication Publication Date Title
EP3595268B1 (en) Streaming media resource distribution method, system, edge node and central dispatching system
US10757037B2 (en) Method and system for dynamic scheduling and allocation of network traffic
WO2021004384A1 (en) Content delivery network, data processing method, apparatus and device, and storage medium
CN110336843B (en) Content distribution method for crowdsourcing, central node and edge node
US20180205976A1 (en) Method and apparatus of obtaining video fragment
WO2018001144A1 (en) Base station, and method, apparatus and system for responding to access request
WO2012072049A1 (en) Method and device for cooperating cache
US20140089454A1 (en) Method for managing content caching based on hop count and network entity thereof
WO2013075436A1 (en) Radio resource optimization method, device and system
WO2011157173A2 (en) Route decision method, content delivery apparatus and content delivery network interconnection system
WO2022151643A1 (en) Domain name resolution method and system
WO2013075578A1 (en) System and method for offline download of network resource file
US20150172413A1 (en) Data relay apparatus and method, server apparatus, and data sending method
WO2022193835A1 (en) Data processing method, live streaming method, authentication server and live streaming data server
CN110445723B (en) Network data scheduling method and edge node
US20220272392A1 (en) Burst traffic processing method, computer device and readable storage medium
WO2012075970A1 (en) Method, device and system for obtaining media content
CN110830565A (en) Resource downloading method, device, system, electronic equipment and storage medium
KR20170103255A (en) Method, program and recoding medium for d2d-based content caching service
WO2020024445A1 (en) Data storage method and apparatus, computer device, and computer storage medium
CN113296924B (en) Content distribution method, device, system and storage medium
WO2019196225A1 (en) Resource file feedback method and apparatus
WO2022206529A1 (en) Resource request processing method and apparatus, computer device, and medium
US11398986B2 (en) Controlling data rate based on domain and radio usage history
CN112311826B (en) Method, device and system for processing access request in content distribution system

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: 22778712

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22778712

Country of ref document: EP

Kind code of ref document: A1