WO2021135835A1 - 资源获取方法、装置及cdn网络中的节点设备 - Google Patents

资源获取方法、装置及cdn网络中的节点设备 Download PDF

Info

Publication number
WO2021135835A1
WO2021135835A1 PCT/CN2020/134229 CN2020134229W WO2021135835A1 WO 2021135835 A1 WO2021135835 A1 WO 2021135835A1 CN 2020134229 W CN2020134229 W CN 2020134229W WO 2021135835 A1 WO2021135835 A1 WO 2021135835A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
resource
target
priority
virtual point
Prior art date
Application number
PCT/CN2020/134229
Other languages
English (en)
French (fr)
Inventor
辛波
年彦东
Original Assignee
北京金山云网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京金山云网络技术有限公司 filed Critical 北京金山云网络技术有限公司
Publication of WO2021135835A1 publication Critical patent/WO2021135835A1/zh

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
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]

Definitions

  • This application relates to the field of Internet technology, and in particular to a method and device for resource acquisition and node equipment in a CDN network.
  • CDN Content Delivery Network
  • edge nodes usually has edge nodes, mid-level nodes, upper-level nodes, and source stations; if the edge nodes do not store the resources that users want to access, they need to return to the middle-level nodes and upper-level nodes. Or the source station obtains resources.
  • the resource is usually stored on many middle-level nodes or upper-level nodes, and the repeated storage method will waste more CDN network storage resources; in addition, when the edge node selects the node back to the source, usually Considering only the network status and bandwidth status of each node, it is likely that the selected node does not store the resources that the user wants to access. At this time, it is necessary to continue to select nodes to obtain resources. Therefore, the hit rate of obtaining resources is low, which is easy to cause CDN network Waste of bandwidth.
  • the purpose of this application is to provide a resource acquisition method, device, and node equipment in a CDN network to improve the hit rate of resource acquisition by edge nodes in the process of returning to the source, reduce the waste of CDN network bandwidth, and save CDN network storage resources .
  • the embodiments of the present application provide a resource acquisition method, which is applied to a node device in a CDN network; the method includes: if the node device cannot query the resource corresponding to the domain name of the resource to be accessed by the user, acquiring the resource The node hash ring associated with the domain name; wherein the node hash ring is established in advance according to the target node associated with the resource domain name in the CDN network; the target node is preset with node weights; the node hash ring is composed of multiple virtual points, each Each target node corresponds to at least one virtual point, and the number of virtual points corresponding to each target node is associated with the node weight of the target node; the target virtual point is determined from the virtual points in the node hash ring according to the resource corresponding to the resource domain name ; Obtain the resource corresponding to the resource domain name from the target node corresponding to the target virtual point.
  • an embodiment of the present application also provides a resource acquisition device, which is set in a node device in a CDN network; the device includes: a node hash ring acquisition module, which is set to query the node device for the user to be accessed The resource corresponding to the resource domain name obtains the node hash ring associated with the resource domain name; wherein the node hash ring is established in advance according to the target node associated with the resource domain name in the CDN network; the target node is preset with node weight; node hash The ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, and the number of virtual points corresponding to each target node is associated with the node weight of the target node; the target virtual point determination module is set to correspond to the resource domain name The target virtual point is determined from the virtual points in the node hash ring; the resource acquisition module is set to acquire the resource corresponding to the resource domain name from the target node corresponding to the target virtual point.
  • an embodiment of the present application also provides a node device in a CDN network, including a processor and a memory.
  • the memory stores machine-executable instructions that can be executed by the processor.
  • the processor executes the machine-executable instructions to implement the above method. .
  • the embodiments of the present application also provide a machine-readable storage medium that stores machine-executable instructions.
  • the machine-executable instructions When the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt processing
  • the device implements the above method.
  • the above-mentioned resource acquisition method, device and node equipment in the CDN network are applied to the node equipment in the CDN network; when the resource corresponding to the resource domain name to be accessed by the user cannot be queried from the node equipment, the acquisition is associated with the resource domain name
  • the node hash ring among them, the node hash ring is established in advance according to the target node associated with the resource domain name in the CDN network; the target node is preset with node weight; the node hash ring is composed of multiple virtual points, and each target node Corresponding to at least one virtual point, the number of virtual points corresponding to each target node is associated with the node weight of the target node; according to the resource corresponding to the resource domain name, the target virtual point is determined from the virtual points in the node hash ring, and then from The target node corresponding to the target virtual point obtains the resource corresponding to the resource domain name.
  • the current node device can obtain the resource corresponding to the resource domain name to be accessed through the node hash ring, which improves the hit rate of the resource obtained by the edge node in the process of returning to the source, and reduces the waste of CDN network bandwidth.
  • the storage resources of the CDN network are saved.
  • FIG. 1 is a schematic diagram of an application scenario of a resource acquisition method provided by an embodiment of the application
  • FIG. 2 is a flowchart of a method for acquiring resources according to an embodiment of the application
  • FIG. 3 is a flowchart of a process of establishing a node hash ring in a resource acquisition method provided by an embodiment of the application;
  • FIG. 4 is a flowchart of another resource acquisition method provided by an embodiment of the application.
  • FIG. 5 is a flowchart of a process of establishing a node hash ring in another resource acquisition method provided by an embodiment of the application;
  • FIG. 6 is a flowchart of another resource acquisition method provided by an embodiment of the application.
  • FIG. 7 is an architecture diagram of a node device provided by an embodiment of this application.
  • FIG. 8 is a schematic diagram of a node hash ring provided by an embodiment of this application.
  • FIG. 9 is a schematic structural diagram of a resource acquisition device provided by an embodiment of this application.
  • FIG. 10 is a schematic structural diagram of a node device in a CDN network provided by an embodiment of this application.
  • the scenario includes a user terminal, a Domain Name System (DNS), a CDN node device, and an origin server.
  • DNS Domain Name System
  • CDN node device a CDN node device
  • origin server an origin server
  • the above-mentioned user terminal may be a mobile terminal (such as a tablet computer, a mobile phone, etc.), a computer or a dedicated terminal device, and a client or a browser is installed on the user terminal; the user can send a resource access request through the user terminal, and the resource access request includes URL information of the resource to be accessed; the user terminal usually sends the resource access request to the local recursive domain name server in the domain name system.
  • the above-mentioned domain name system usually includes local recursive domain name servers, root domain name servers, top-level domain name servers, and domain name servers at all levels.
  • the domain name system After receiving the resource access request sent by the user terminal, the domain name system obtains the IP (Internet Protocol) address of the web server corresponding to the URL information of the resource to be accessed based on the common DNS resolution method: that is, through the local recursive domain name
  • the server, the root domain name server, the top-level domain name server to which the URL information of the resource to be accessed belongs, and the domain name servers at all levels perform layer-by-layer analysis to obtain the access address of a server that can obtain the resource to be accessed; and send the access address of the server To the user terminal.
  • the user terminal After receiving the access address of the server that can obtain the resource to be accessed, the user terminal sends a resource access request to the server.
  • the foregoing server that can obtain the resource to be accessed may be an edge node in the node device of the CDN network.
  • the node equipment of the CDN network includes edge nodes, middle-level nodes and upper-level nodes.
  • the number of edge nodes is the largest, and they directly serve network users (also known as netizens); the middle-level nodes mainly converge edge node back-to-origin requests, and do not directly serve network users, and the number is small; upper-level nodes mainly converge middle-level nodes back to the source.
  • Source requests do not directly serve network users, and the number of them is the smallest; under normal circumstances, ordinary network users will not pay for the bandwidth generated by the middle-level or upper-level nodes.
  • the node equipment and source station of the CDN network belong to the content distribution network; the source station of the content distribution network stores website resources, and the website resources in the source station are distributed to the edge nodes through the upper and middle nodes; the edge nodes are directly accessed by user terminals. Obtain the node device of the CDN network of the resource to be accessed.
  • the edge node After receiving the resource access request, if the edge node does not store the resource to be accessed corresponding to the resource access request, the edge node can obtain the resource to be accessed from the middle-level node; if the middle-level node does not have the resource to be accessed, it can go to the upper level The node obtains the resource to be visited; if the upper-level node does not have the resource to be visited, it can obtain the resource to be visited from the source station; the above process of obtaining the resource to be visited by the upper-level node device can be called back-to-source pull (that is, the aforementioned back-to-source request).
  • the internal return process of the CDN node equipment is mainly based on the best method; in one embodiment, a middle-level node covers several surrounding edge nodes, and these edge nodes all return to the middle-level node when returning to the source. Obtain resources; an upper-level node covers several surrounding middle-level nodes, and these middle-level nodes all obtain resources from the upper-level node when returning to the source.
  • the network conditions such as whether it can communicate with the upper-level node equipment
  • the bandwidth of the upper-level node equipment also called water level
  • the network conditions such as whether it can communicate with the upper-level node equipment
  • the bandwidth of the upper-level node equipment also called water level
  • the resource to be acquired exists in the upper-level node device (middle-level node or upper-level node)
  • the resources to be obtained need to be stored in different upper-level node devices, and the repeated storage method wastes more CDN network storage resources.
  • the embodiments of the present application provide a resource acquisition method, device, and node equipment in a CDN network, which can be applied to the resource reading process of various distributed systems.
  • the method is applied to a node device of a CDN network; the method includes the following steps:
  • Step S200 if the resource corresponding to the resource domain name to be accessed by the user cannot be queried from the node device, obtain the node hash ring associated with the resource domain name; wherein the node hash ring is preliminarily associated with the resource domain name in the CDN network
  • the target node is established; the target node is preset with node weights; the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, the number of virtual points corresponding to each target node and the node weight of the target node Associated.
  • the above-mentioned node device may be an edge node or a middle-level node. If the node device is an edge node, after receiving the resource access request sent by the user terminal, the edge node queries from the internal storage disk whether the resource to be accessed corresponding to the resource access request is stored; the resource access request includes the resource to be accessed
  • the resource domain name corresponding to the resource is usually the domain name of the website where the resource to be accessed is stored; Domain Name is the name of a computer or computer group on the Internet composed of a series of names separated by dots. It is used to identify the electronic location of the computer during data transmission.
  • the domain name can be represented by xyz.com, etc.
  • the middle-level node queries from the internal storage disk whether the resource to be accessed corresponding to the return-to-origin request is stored; the aforementioned return-to-origin request includes storage to be accessed
  • the resource domain name of the resource can be the URL to be accessed.
  • the node device When the node device cannot query the resource corresponding to the domain name of the resource to be accessed by the user, it is determined that the resource is not stored in the node device, and the resource needs to be pulled back from the upper-level node device to obtain the resource. In one embodiment, it is first necessary to determine which upper-level node device to pull back to the source; the upper-level node device needs to store the resource corresponding to the resource domain name to be accessed.
  • the central platform of the CDN network can store the website resource in some upper and middle nodes according to certain rules; these upper and middle nodes can be regarded as The target node associated with the resource domain name corresponding to the website resource.
  • a weight can be assigned to each node; in general, the greater the bandwidth that the node can bear, the higher the corresponding weight.
  • the above priority can be related to the current node and the physical distance between each node in the node combination; generally speaking, the closer the physical distance between the two node devices, the faster the communication speed, which can be the distance from the current node
  • the target node that is closer to the device is set to a higher priority.
  • the node hash ring associated with the aforementioned resource domain name can be established based on the target node associated with the aforementioned resource domain name; in one embodiment, the node with the same priority in the node combination can be selected to establish the node hash ring; when the node in the node combination When there are multiple priorities, multiple node hash rings can be established.
  • a virtual node proportional to its weight can be set for each target node; for example, a target node with a weight of 1, set 10 virtual nodes for it; with a weight of 3. Set up 30 virtual nodes for the target node.
  • different labels can be assigned to virtual nodes corresponding to the same target node, and the node domain name and label of the target node corresponding to the virtual node are used as the identifier of the virtual node.
  • the probability of each virtual node being accessed on the hash ring is the same, and the number of virtual nodes of the target node is related to its weight, and the probability of each target node being accessed is related to its weight; according to the node's hash ring, the corresponding return source is selected
  • the target node of the request can make the node device capable of withstanding a larger bandwidth to have a larger amount of visits.
  • Step S202 Determine the target virtual point from the virtual points in the node hash ring according to the resource corresponding to the resource domain name.
  • the hash value of the resource corresponding to the resource domain name can be calculated; in the calculation process, the resource corresponding to the resource domain name can also be understood as the URL (Uniform Resource Locator) address of the resource, and then The URL address of the resource is used as the key for calculating the hash value, thereby obtaining the hash value of the resource corresponding to the resource domain name; the above-mentioned uniform resource locator can be expressed in the form of http://mail.xyz.com/index.html.
  • the hash value can be mapped to the established node hash ring according to the consistent hash algorithm, and the hash value of the resource corresponding to the resource domain name can be selected according to certain rules. If a virtual point with a matching value is found, if the first virtual point greater than the hash value of the resource is found, the virtual point is used as the target virtual node.
  • Step S204 Obtain the resource corresponding to the resource domain name from the target node corresponding to the target virtual point.
  • the target node corresponding to the target virtual point can be used as the upper-level node device in response to the return request of the current node device; the node device may be a middle-level node or an upper-level node.
  • the node domain name of the node corresponding to the target virtual point may be sent to the DNS server in the CDN network. After the DNS server resolves the node domain name and returns the IP address corresponding to the node domain name, the IP address is sent to the IP address. A return-to-origin request for accessing resources, so that the target node corresponding to the target virtual point returns the resource to be accessed to the current node device.
  • the target node corresponding to the selected target virtual node cannot respond to the back-to-origin request of the current device; this situation can be recorded in the historical usage record of the target node; at this time, delete the target node on the node hash ring To all virtual nodes and reselect the target virtual node.
  • the target virtual node can be selected from other node hash rings; usually follow the priority order from high to low from different node hash rings Select the target virtual node.
  • the node hash ring associated with the resource domain name is obtained; wherein the node hash ring is pre-according to the CDN network and The target node associated with the resource domain name is established; the target node is preset with node weights; the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, and the number of virtual points corresponding to each target node is The node weight of the target node is correlated; according to the resource corresponding to the resource domain name, the target virtual point is determined from the virtual points in the node hash ring, and then the resource corresponding to the resource domain name is obtained from the target node corresponding to the target virtual point.
  • the current node device can obtain the resource corresponding to the resource domain name to be accessed through the node's hash ring, which improves the hit rate of resource acquisition by edge nodes in the process of returning to the source, reduces the waste of CDN network bandwidth, and saves The storage resources of the CDN network.
  • the embodiment of the present application also provides another resource acquisition method, which is implemented on the basis of the method in the above-mentioned embodiment; the method is implemented based on a pre-established node hash ring; the method focuses on the description when a plurality of different priorities are acquired During the node hash ring, the realization process of determining the target virtual point from the virtual points in the node hash ring (implemented through the following steps S402-S412), and obtaining the resource corresponding to the resource domain name from the node corresponding to the target virtual point The implementation process in an embodiment (implemented through the following steps S414-S416).
  • Step S300 Obtain a node combination associated with the resource domain name; wherein the node combination includes multiple nodes in the CDN network and the priority of each node.
  • the above node combination including the target node, and the weight and priority of each target node, can be stored in the set device; when the current node device pulls back to the source, it can first send a request to the set device; The request includes the resource domain name to be accessed, so that the setting device sends the node combination associated with the resource domain name to the current node device. Since this process is similar to a common DNS resolution method, the setting device can be regarded as an internal DNS server in the CDN network.
  • Step S302 According to the priority of each node, a target node is selected from the node combination, and a node hash ring is established according to the target node.
  • the node corresponding to the current priority can be selected from the node combination for each priority, and the node corresponding to the current priority can be established according to the node corresponding to the current priority. Greek ring.
  • the priorities of the nodes in the node combination are multi-level priorities
  • nodes with the same priority can be used as a group to generate node hash rings respectively, and finally multiple node hash rings are obtained.
  • the priority of the node in the node hash ring can be set as the priority of the node hash ring; each priority corresponds to a node hash ring.
  • the node combination includes 5 nodes of the first priority, 6 nodes of the second priority, and 4 nodes of the third priority.
  • the 5 nodes of the first priority can be used as the target node, and according to the first priority
  • the identifier of each virtual node corresponding to the five nodes of one priority calculates its hash value, and the consistent hash algorithm is used to map each virtual node on the hash ring to generate the node hash ring of the first priority.
  • the second-priority node hash ring and the third-priority node hash ring are established in sequence, and the order of establishment can be set according to requirements.
  • the above-mentioned resource acquisition method includes the following steps:
  • Step S400 if the resource corresponding to the resource domain name to be accessed by the user cannot be queried from the node device, obtain the node hash ring associated with the resource domain name; wherein the node hash ring is preliminarily based on the resource domain name associated with the CDN network
  • the target node is established; the target node is preset with node weights; the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, the number of virtual points corresponding to each target node and the node weight of the target node Associated.
  • Step S402 According to the priority order from high to low, the target virtual point is determined from the hash ring of the node corresponding to the highest priority according to the resource corresponding to the resource domain name.
  • the resource hash value can be mapped to the node hash ring corresponding to the highest priority according to the consistent hash algorithm, and the node can be selected.
  • the virtual point closest to the resource hash value on the hope ring is used as the target virtual point.
  • Step S404 query the historical usage record of the node corresponding to the target virtual node; in one embodiment, the historical usage record may be the historical result of the node corresponding to the target virtual node in responding to the source request; For the back-to-origin request sent by the node, the historical usage record can be set to using, which means that the node can be used normally; if there is no successful response, the historical usage record can be set to down, which means that the node cannot be used; the historical response record can be used as The relevant information of the node is stored in the DNS resolution record.
  • Step S406 if the historical use record indicates that the node corresponding to the target virtual point is not available, perform step S408; if it is available, perform step S412; after querying the historical use record, determine whether the target virtual point is available according to the historical use record; When the historical use record is up, it can be determined that the target virtual point is available, and when the historical use record is down, it can be determined that the target virtual point is not available.
  • Step S408 Delete the unavailable virtual points in the node hash ring corresponding to the target virtual point; in fact, if the actual node corresponding to the target virtual point is unavailable, there are usually multiple nodes on the node hash ring.
  • the virtual point corresponds to the actual node; at this node, the hash ring may again select the virtual point corresponding to the actual node, which is still unavailable, making the entire method redundant; therefore, when it is determined that an actual node is unavailable, It is necessary to delete all virtual points corresponding to the actual node on the hash ring of the corresponding node.
  • Step S410 if the current node hash ring is the last priority node hash ring, go to step S402; if the current node hash ring is not the last priority node hash ring, go to step S412; In actual situations, when multiple node hash rings with different priorities are established for the resource domain name, you can determine whether the current node hash ring is the last level by checking the priority of the current node hash ring The priority node hash ring is the node hash ring with the lowest priority.
  • Step S412 according to the resource corresponding to the resource domain name, determine the updated target virtual point from the node hash ring of the next priority, and perform step S404; if the current node hash ring is not the node hash ring with the lowest priority, you can In the node hash ring whose priority is one level lower than the current node hash ring, the target virtual point in the node hash ring is determined according to the hash value of the resource corresponding to the resource domain name; the process of determining the target virtual point Similar to the process of determining the target virtual point from the node hash ring corresponding to the highest priority, both adopt the principle of consistent hashing. Next, it is also necessary to determine whether the updated target virtual point is available through the historical usage record, as described in step S306.
  • Step S414 Send the node domain name of the node corresponding to the target virtual point to the DNS server in the CDN network, so that the DNS server in the CDN network resolves the node domain name, and obtains and returns a list of IP addresses corresponding to the node domain name.
  • the current node device If it is determined that the target virtual node is available, at this time, although the current node device has obtained the node domain name of the corresponding actual node, it cannot access the node. At this time, it is necessary to send the node domain name of the node corresponding to the target virtual point to the DNS server in the CDN network; after receiving the node domain name, the DNS server in the CDN network performs domain name resolution on it to obtain the IP address list corresponding to the node domain name , And return the IP address list to the current node device.
  • step S416 the target IP address is selected from the IP address list, and the resource corresponding to the resource domain name is obtained through the target IP address.
  • a node may correspond to multiple servers; the IP address list received by the current node device lists multiple IP addresses of the node corresponding to the target virtual point; an IP address can be randomly selected from the IP address list The address is used as the target IP address, and the target IP address is accessed to obtain the resource corresponding to the resource domain name.
  • the node hash ring associated with the resource domain name is obtained; when there are multiple node hash rings, And when the priority is different, according to the priority order from high to low, according to the resource corresponding to the resource domain name, determine the target virtual point from the node hash ring corresponding to the highest priority, and query the historical use of the node corresponding to the target virtual point Record to determine whether the node is available.
  • the node determines the target virtual point from the node hash ring of the next priority until the available target virtual node is obtained; if it is available, perform the domain name through the DNS in the CND network Resolve to obtain the IP address of the node, thereby accessing the node to obtain the resource corresponding to the resource domain name.
  • available nodes can be selected from multiple node hash rings associated with the resource domain name in the order of priority, so as to obtain the resources corresponding to the resource domain name, which improves the edge node's acquisition of resources in the process of returning to the source.
  • the hit rate reduces the waste of CDN network bandwidth.
  • the embodiment of the present application also provides another resource acquisition method, which is implemented on the basis of the method in the above embodiment; the method is implemented based on a pre-established node hash ring; the method focuses on the priority of the nodes in the node combination When the first priority and the second priority are included, and the first priority is higher than the second priority, the realization process of determining the target virtual node from the node hash ring in an embodiment (through the following steps S402-S416 achieve). As shown in Figure 5, the above-mentioned node hash ring is established in the following way:
  • Step S500 Send the resource domain name to the DNS server in the CDN network, so that the DNS server in the CDN network resolves the resource domain name, and obtains and returns a DNS resolution record in the SRV format of the node combination associated with the resource domain name; wherein, the DNS resolution record It includes multiple nodes in the node combination, as well as the node weight and priority of each node.
  • the above node combination and the resource domain name associated with the node combination can be stored in the DNS server in the CDN network; in one embodiment, the DNS server can be set inside the CDN network, and the node combination and the node combination associated The resource domain name is stored in the DNS server in the CDN network.
  • the resource domain name can be sent to the DNS server; the DNS server is used to resolve the received resource domain name to obtain the combination of nodes associated with the resource domain name Relevant information is returned to the current node device as the DNS resolution record of the resource domain name; the DNS resolution record may include multiple nodes in the node combination, and the weight and priority of each node.
  • the DNS resolution record may be stored in the DNS server in the SRV format, and the SRV record is a type of resource record supported in the database of the DNS server.
  • Step S502 a node corresponding to the first priority is selected from the node combination, and a hash ring of the master node is established according to the node corresponding to the first priority.
  • Step S504 Select a node corresponding to the second priority from the node combination, and establish a backup node hash ring according to the node corresponding to the second priority.
  • Both the active node hash ring and the standby node hash ring are composed of multiple virtual points; in the active node hash ring, each node with the first priority corresponds to at least one virtual point, and the virtual point corresponding to this node The number of is associated with the weight of the target node; in the standby node hash ring, each second-priority node corresponds to at least one virtual point, and the number of virtual points corresponding to the node is associated with the weight of the target node.
  • the number of virtual points corresponding to each target node can be: the weight of the target node multiplied by a preset multiple, for example, the preset multiple can be 10; in the node hash ring
  • Each virtual point of is set with a virtual point hash value; in one embodiment, the hash value of the virtual point can be calculated according to the node domain name corresponding to the virtual point and the subscript set for the virtual point.
  • the above-mentioned resource acquisition method includes the following steps:
  • Step S600 if the resource corresponding to the resource domain name to be accessed by the user cannot be queried from the node device, obtain the node hash ring associated with the resource domain name; wherein the node hash ring is preliminarily associated with the resource domain name in the CDN network
  • the target node is established; the target node is preset with node weights; the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, the number of virtual points corresponding to each target node and the node weight of the target node Associated.
  • Step S602 Calculate the resource hash value of the resource corresponding to the resource domain name; in one embodiment, a hash algorithm is used to calculate the hash value of the resource domain name as the resource hash value of the resource corresponding to the resource domain name.
  • Step S604 Using a consistent hash algorithm, select a virtual point whose hash value of the virtual point matches the hash value of the resource from each virtual point in the hash ring of the active node, and determine the selected virtual point as the target virtual point.
  • a consistent hash algorithm can be used to map the resource hash value to the main node hash ring, and the corresponding virtual point can be selected according to certain rules, such as selecting the main node hash ring, The hash value of the virtual point is greater than the hash value of the resource and the hash value of the virtual point closest to the hash value of the resource matches the hash value of the resource, and the virtual point corresponding to the hash value of the virtual point is used as the target virtual point.
  • Step S606 query the historical usage record of the node corresponding to the target virtual point of the active node.
  • step S608 if the historical usage record indicates that the node corresponding to the target virtual point of the active node is not available, step S610 is executed; if it is available, step S620 is executed.
  • Step S610 delete the virtual points that are unavailable to the node in the hash ring of the active node
  • Step S612 using a consistent hash algorithm, select a virtual point whose hash value of the virtual point matches the hash value of the resource from each virtual point in the hash ring of the standby node, and determine the updated target virtual point from the selected virtual point.
  • Point the process is similar to the process of determining the target virtual point from the hash ring of the active node, and will not be repeated.
  • Step S614 Query the historical usage record of the node corresponding to the target virtual point of the standby node.
  • Step S616 if the historical usage record indicates that the node corresponding to the target virtual point of the standby node is not available, step S618 is executed; if it is available, step S620 is executed.
  • Step S618, delete the unavailable virtual points in the hash ring of the backup node; perform step S604; when the node corresponding to the target virtual point of the selected backup node hash ring is unavailable, put the backup node in the hash ring.
  • the virtual points corresponding to the unavailable nodes are deleted, and the target virtual node is selected from the hash ring of the active and standby nodes again, and the process is as described in step S604.
  • Step S620 Obtain the resource corresponding to the resource domain name from the node corresponding to the target virtual point.
  • the node hash ring corresponding to the resource domain name is obtained; when the node hash ring includes the Zhu Yong node hash ring and
  • the standby node hashes the ring first select the target virtual point from the active node hash ring according to the resource corresponding to the resource domain name, and use the historical usage record to determine whether the target virtual point is available, if not, then hash from the standby node In the ring, the target virtual point is selected according to the resource corresponding to the resource domain name until an available target virtual node is obtained, and the resource corresponding to the resource domain name is obtained from the node corresponding to the target virtual point.
  • the target virtual point can be selected from the hash ring of the active node or the hash ring of the standby node, and the available node can be selected from the multiple nodes associated with the resource domain name, so as to obtain the resource domain name corresponding This improves the hit rate of resource acquisition by edge nodes in the process of returning to the source, and reduces the waste of CDN network bandwidth.
  • the embodiment of the present application also provides another resource acquisition method, which is implemented on the basis of the method in the foregoing embodiment.
  • This method is applied to the node equipment of CND; as shown in Figure 7, the node equipment of CND includes a Linux virtual server (LVS) and multiple cache devices (in Figure 7, two cache devices are included as an example); in each cache device Including Nginx (a high-performance HTTP (HyperText Transfer Protocol) and reverse proxy web server) and cache disks (cache).
  • Nginx a high-performance HTTP (HyperText Transfer Protocol) and reverse proxy web server
  • cache disks cache disks
  • the Linux virtual server can receive the resource access request sent by the user; through the function of Nginx, the resource to be accessed corresponding to the resource access request is finally output from the cache disk; the cache software is run in the cache device to manage the storage disk.
  • the resource to be accessed corresponding to the resource access request cannot be obtained from the current node device (edge node or middle-level node), when pulling back to the source from the upper-level node device (middle-level node or upper-level node), select In the process of the upper-level node equipment, only the network status and water level of the upper-level node equipment are considered, and whether the resources are stored in the upper-level node is not considered, resulting in a low return hit rate to the upper-level node equipment At the same time, it also causes a waste of upper-level node and user source station bandwidth; in addition, based on the above method, the same resource will be repeatedly stored in all middle-level and upper-level nodes, and the storage resources are not fully utilized, causing a waste of storage resources.
  • the method provided by the embodiment of the application forms a number of hash rings with middle and upper nodes, and pulls back to the source at the node device (edge nodes return to the source to the middle node, and edge nodes return to the source or the middle to the upper node.
  • the process of nodes returning to the source to the upper node uses a consistent hashing algorithm to select a fixed middle or upper layer for fixed resources (resources corresponding to the same resource domain name), thereby increasing the hit rate of middle-level nodes or upper-level nodes and shortening
  • the processing time of the return-to-origin request of the middle-level node and the upper-level node thereby improving the quality of service and reducing the back-to-origin bandwidth; at the same time, the repetition rate of the middle-level node and the upper-level storage resource is reduced, which is equivalent to expanding the storage space of the middle-level and upper-level nodes; and reducing Compared with the bandwidth of the user's source station, the number of times of returning to the user's source station is the same as the number of upper-level nodes.
  • the above method will only return to the source of the user's source station once.
  • the method includes the following steps:
  • Step (1) When the cache software in the current node device initiates back-to-origin, it obtains the information of the node hash ring corresponding to the resource to be obtained through the DNS SRV resolution record sent by the DNS inside the CDN network; this information includes Information about the nodes in the node hash ring, and the weight and priority of each node.
  • Step (2) the middle and upper nodes are formed into several hash rings, each node in the hash ring has a node domain name, weight and priority; for example, the 6 nodes of mid1, mid2, mid3, mid4, mid5, and mid6 are formed into one Node hash ring, the name of the node hash ring is md5.cdn-node.com; among them, md5 is an md5 value calculated by the node domain name + weight + priority of 6 nodes, and the md5 value is unique Sex.
  • Table 1 The information of each node is shown in the following Table 1 in one embodiment:
  • the node domain name is used instead of the node IP; the main consideration is that the change of the node IP will affect the cache, and the node domain name will not change, so the node domain name is selected as the key.
  • the above-mentioned weights are determined according to the outlet bandwidth of the node, mainly considering the outlet bandwidth and load conditions of the node, and can be dynamically adjusted. The greater the weight, the greater the probability of being used.
  • the above priority indicates the primary-standby relationship.
  • the priority of 0 is the hash ring of the active node (also called the primary ring), and the others are the hash ring of the standby node (also called the standby ring).
  • the lower the priority the priority The higher the level, the nodes of the same priority form a hash ring.
  • the hash ring of this node is associated with the resource domain name of the resource to be obtained by the current node device; for example, md5.cdn-node.com is associated with www.ksyun.com, that is, the edge node of www.ksyun.com returns to the source middle node or The middle-level node back to the upper-level node can use md5.cdn-node.com for resolution and generate the corresponding DNS resolution records.
  • the results are as follows:
  • the SRV format is: domain ttl IN SRV probability weight port host.
  • nodes with the same priority form a hash ring; then, the node weight is reflected in the number of virtual points (also called virtual nodes) on the hash ring, and the virtual The number of points is equal to the weight multiplied by 10, which is the multiple that is considered to be set; among them, the hash value of the virtual node is calculated according to the node domain name + the virtual point subscript.
  • Step (3) after the creation of the hash ring is completed, the cache software will calculate a hash value according to the URL (equivalent to the resource corresponding to the resource domain name) of this back-to-origin request. According to the consistent hash value, the one created in step (2) Find 1 node on the hash ring, such as mid2.
  • Step (4) if the historical usage record indicates that the mid2 node is unavailable, go to the standby node to find a node on the hash ring, such as mid4.
  • Step (5) if the historical usage record indicates that the mid4 node is unavailable, the unavailable node is removed according to the consistent hash algorithm until an available node location is selected.
  • Step (6) the cache software initiates DNS resolution to the designated DNS server again, obtains the IP list corresponding to the selected node, and randomly selects an available IP to return to the source.
  • the node domain name is selected as the keyword of the hash algorithm, which can solve the problem that a node has multiple IPs or node IP changes, and the change of node IP does not affect the hash result; and use SRV records to transfer the hash ring Information; when the node's hash ring does not change, the same resource can be stored on only one node of the node's hash ring, and all edge nodes of the node's hash ring will visit this node to improve the hit rate; and in the node's hash ring When Xihuan changes, according to the consistent hash algorithm, only the changed part will be affected, and the other unchanged parts will not be affected, which improves the stability of the service.
  • the above method improves the hit rate of edge nodes obtaining resources from middle-level or upper-level nodes; due to the use of hash (hash) back to the source, when different edge nodes return to the source to obtain the same resource, they will all return to the same middle-level or upper-level node. Therefore, the hit rate of resources obtained by the middle or upper nodes is improved; at the same time, this method causes different resources to be stored only on the same node, which is equivalent to expanding the storage space of the middle and upper layers.
  • an embodiment of the present application also provides a resource acquisition device, which is set in a node device of a CDN network; as shown in FIG. 9, the device includes:
  • the node hash ring obtaining module 700 is configured to obtain the node hash ring associated with the resource domain name if the resource corresponding to the resource domain name to be accessed by the user cannot be queried from the node device; wherein the node hash ring is preliminarily based on the CDN network
  • the target node associated with the resource domain name is established; the target node is preset with node weight; the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, and the number of virtual points corresponding to each target node Be associated with the node weight of the target node;
  • the target virtual point determination module 702 is configured to determine the target virtual point from the virtual points in the node hash ring according to the resource corresponding to the resource domain name;
  • the resource acquisition module 704 is configured to acquire the resource corresponding to the resource domain name from the target node corresponding to the target virtual point.
  • the above-mentioned resource acquisition device should be set as a node device in the CDN network; acquire the node hash ring associated with the resource domain name; wherein the node hash ring is established in advance according to the target node associated with the resource domain name in the CDN network;
  • the target node is preset with a node weight;
  • the node hash ring is composed of multiple virtual points, each target node corresponds to at least one virtual point, and the number of virtual points corresponding to each target node is associated with the node weight of the target node;
  • the target virtual point is determined from the virtual points in the node hash ring, and then the resource corresponding to the resource domain name is obtained from the target node corresponding to the target virtual point.
  • the current node device can obtain the resource corresponding to the resource domain name to be accessed through the node's hash ring, which improves the hit rate of resource acquisition by edge nodes in the process of returning to the source, reduces the waste of CDN network bandwidth, and saves The storage resources of the CDN network.
  • the above-mentioned apparatus further includes: a node combination obtaining module configured to obtain a node combination associated with the resource domain name; wherein the node combination includes multiple nodes in the CDN network and the priority of each node;
  • the hash ring establishment module is set to select a target node from the node combination according to the priority of each node, and establish a node hash ring according to the target node.
  • the above-mentioned node combination and the resource domain name associated with the above-mentioned node combination may be stored in the DNS server in the above-mentioned CDN network; in one embodiment, the above-mentioned node combination obtaining module is further configured to: send the resource to the DNS server in the CDN network Domain name, so that the DNS server in the CDN network resolves the resource domain name to obtain and return the DNS resolution record in the SRV format of the node combination associated with the resource domain name; wherein, the DNS resolution record includes multiple nodes in the node combination and each The node weight and priority of each node.
  • the priority of the nodes in the above-mentioned node combination may be multi-level priority; in one embodiment, the above-mentioned hash ring establishment module is further configured to: for each priority, select the node corresponding to the current priority from the node combination, The node hash ring corresponding to the current priority is established according to the node corresponding to the current priority.
  • the priority of the nodes in the above-mentioned node combination may include a first priority and a second priority; wherein the first priority is higher than the second priority; the above-mentioned hash ring establishment module is further configured as: Select the node corresponding to the first priority from the node combination, and establish the active node hash ring based on the node corresponding to the first priority; select the node corresponding to the second priority from the node combination, and select the node corresponding to the second priority according to the node combination Establish a hash ring for the standby node.
  • the priority of the nodes in the above-mentioned node combination is multi-level priority, and when each level of priority corresponds to a node hash ring, the above-mentioned resource acquisition module is also set to: according to the order of priority from high to low, from the highest priority Determine the target virtual point in the corresponding node hash ring; query the historical use record of the node corresponding to the target virtual point, if the historical use record indicates that the node corresponding to the target virtual point is unavailable, determine it from the node hash ring of the next priority For the updated target virtual point, the step of querying the historical usage record of the node corresponding to the target virtual point is continued until the node corresponding to the determined target virtual point is available.
  • the above-mentioned device further includes: a first node deletion module, configured to hash the node corresponding to the target virtual point in the ring with the unavailable virtual node if the historical usage record indicates that the node corresponding to the target virtual point is unavailable Point deletion; if until the updated target virtual point is determined in the hash ring of the last priority node, the historical usage record of the target virtual point indicates that the node corresponding to the target virtual point is not available, continue to execute the node corresponding to the highest priority The step of determining the target virtual point in the hash ring until the node corresponding to the determined target virtual point is available.
  • a first node deletion module configured to hash the node corresponding to the target virtual point in the ring with the unavailable virtual node if the historical usage record indicates that the node corresponding to the target virtual point is unavailable Point deletion; if until the updated target virtual point is determined in the hash ring of the last priority node, the historical usage record of the target virtual point indicates that the node corresponding to the target
  • the priority of the nodes in the above-mentioned node combination includes a first priority and a second priority; the first priority corresponds to the hash ring of the active node; the second priority corresponds to the hash ring of the standby node; where , The first priority is higher than the second priority; the above resource acquisition module is also set to: determine the target virtual point from the hash ring of the active node; query the historical use record of the node corresponding to the target virtual point, if the historical use record indicates The node corresponding to the target virtual point is unavailable, and the updated target virtual point is determined from the hash ring of the standby node.
  • the above-mentioned device further includes: a second node deletion module configured to, if the node corresponding to the target virtual point determined from the hash ring of the active node is unavailable, put the node in the hash ring of the active node and the node is unavailable The used virtual point is deleted; the third node deletion module is set to delete the unavailable virtual point in the standby node hash ring if the node corresponding to the updated target virtual point is determined to be unavailable from the standby node hash ring; Continue to perform the steps of determining the target virtual point from the hash ring of the active node until the node corresponding to the determined target virtual point is available.
  • the number of virtual points corresponding to each target node is: the node weight of the target node is multiplied by a preset multiple; each virtual point in the node hash ring is set with a virtual point Point hash value; the above resource acquisition module is also set to: calculate the resource hash value of the resource corresponding to the resource domain name; adopt a consistent hash algorithm to select the virtual point hash value and the hash value from each virtual point in the node hash ring The virtual point that matches the resource hash value is determined to be the selected virtual point as the target virtual point.
  • the resource acquisition module is further configured to send the node domain name of the node corresponding to the target virtual point to the DNS server in the CDN network, so that the DNS server in the CDN network resolves the node domain name, and obtains and returns the node domain name corresponding IP address list; select the target IP address from the IP address list, and obtain the resource corresponding to the resource domain name through the target IP address.
  • An embodiment of the present application also provides a node device in a CDN network.
  • the node device in the CDN network includes a processor 130 and a memory 131.
  • the memory 131 stores a machine that can be executed by the processor 130. Executable instructions, the processor 130 executes machine-executable instructions to implement the resource acquisition method.
  • the node device in the CDN network shown in FIG. 10 further includes a bus 132 and a communication interface 133, and the processor 130, the communication interface 133, and the memory 131 are connected by the bus 132.
  • the memory 131 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
  • the communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, a wide area network, a local network, a metropolitan area network, etc. may be used.
  • the bus 132 may be an ISA bus, a PCI bus, an EISA bus, or the like.
  • the bus can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one bidirectional arrow is used to indicate in FIG. 10, but it does not mean that there is only one bus or one type of bus.
  • the processor 130 may be an integrated circuit chip with signal processing capability. In the implementation process, the steps of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 130 or instructions in the form of software.
  • the above-mentioned processor 130 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processing, DSP for short), etc. ), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131, and completes the steps of the method of the foregoing embodiment in combination with its hardware.
  • the embodiment of the present application also provides a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions, when the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor
  • the machine-readable storage medium stores machine-executable instructions, when the machine-executable instructions are called and executed by the processor, the machine-executable instructions prompt the processor
  • the resource acquisition method and device provided by the embodiments of the application and the computer program product of the node device in the CDN network include a computer-readable storage medium storing program code, and the instructions included in the program code can be set to execute the foregoing method implementation
  • the instructions included in the program code can be set to execute the foregoing method implementation
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the related technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several
  • the instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .
  • the resource is usually stored on many middle-level nodes or upper-level nodes, and the repeated storage method will waste more CDN network storage resources; in addition, when the edge node selects the node back to the source, usually Considering only the network status and bandwidth status of each node, it is likely that the selected node does not store the resources that the user wants to access. At this time, it is necessary to continue to select nodes to obtain resources. Therefore, the hit rate of obtaining resources is low, which is easy to cause CDN network Waste of bandwidth.
  • the embodiments of this application do not need to cache resources corresponding to the resource domain names to be accessed in multiple middle and upper nodes, but only need to ensure that the node hash ring established based on the target node associated with the resource domain name It is sufficient to save the resource in at least one node in, and the current node device can obtain the resource corresponding to the domain name of the resource to be accessed through the hash ring of the node, which improves the hit rate of the resource obtained by the edge node in the process of returning to the source.
  • the waste of CDN network bandwidth is reduced, and the storage resources of the CDN network are saved at the same time.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请提供了一种资源获取方法、装置及CDN网络中的节点设备;当从节点设备中查询不到用户待访问的资源域名对应的资源时,获取与资源域名相关联的节点哈希环;根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点,进而从目标虚拟点对应的目标节点获取资源域名对应的资源。本申请仅需要保证基于与资源域名相关联的目标节点建立的节点哈希环中的至少一个节点中保存该资源,当前的节点设备即可以通过该节点哈希环获取到待访问的资源域名对应的资源,提高了在回源过程中获得资源的命中率,降低了CDN网络带宽的浪费,同时节省了CDN网络的存储资源。

Description

资源获取方法、装置及CDN网络中的节点设备
本申请要求于2019年12月31日提交中国专利局、申请号为201911425952.7、发明名称为“资源获取方法、装置及CDN网络中的节点设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及互联网技术领域,尤其是涉及一种资源获取方法、装置及CDN网络中的节点设备。
背景技术
内容分发网络(Content Delivery Network,简称CDN)中通常设置有边缘节点、中层节点、上层节点和源站;如果边缘节点中没有存储用户想要访问的资源,则需要回源至中层节点、上层节点或源站获取资源。相关技术中,对于一个资源来说,该资源通常存储在很多中层节点或上层节点上,重复存储的方式会浪费较多的CDN网络存储资源;另外,边缘节点在选择回源的节点时,通常仅考虑各个节点的网络状况和带宽状况,很可能导致选择的节点中没有存储用户想要访问的资源,这时还需要继续选择节点以获取资源,因此获得资源的命中率低,易造成CDN网络带宽的浪费。
发明内容
本申请的目的在于提供一种资源获取方法、装置及CDN网络中的节点设备,以提高边缘节点在回源过程中获得资源的命中率,降低CDN网络带宽的浪费,并节省CDN网络的存储资源。
第一方面,本申请实施例提供了一种资源获取方法,应用于CDN网络中的节点设备;该方法包括:如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点;从目标虚拟点对应的目标节点获取资源域名对应的资源。
第二方面,本申请实施例还提供一种资源获取装置,设置于CDN网络中的节点设备;该装置包括:节点哈希环获取模块,设置为如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;目标虚拟点确定模块,设置为根据资源域名对应的资源,从 节点哈希环中的虚拟点中确定目标虚拟点;资源获取模块,设置为从目标虚拟点对应的目标节点获取资源域名对应的资源。
第三方面,本申请实施例还提供一种CDN网络中的节点设备,包括处理器和存储器,存储器存储有能够被处理器执行的机器可执行指令,处理器执行机器可执行指令以实现上述方法。
第四方面,本申请实施例还提供一种机器可读存储介质,该机器可读存储介质存储有机器可执行指令,机器可执行指令在被处理器调用和执行时,机器可执行指令促使处理器实现上述方法。
上述一种资源获取方法、装置及CDN网络中的节点设备,应用于CDN网络中的节点设备;在从节点设备中查询不到用户待访问的资源域名对应的资源时,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点,进而从目标虚拟点对应的目标节点获取资源域名对应的资源。该方式中,无需在多个中层及上层节点中缓存待访问的资源域名对应的资源,仅需要保证在基于与资源域名相关联的目标节点建立的节点哈希环中的至少一个节点中保存该资源即可,当前的节点设备即可以通过该节点哈希环获取到待访问的资源域名对应的资源,提高了边缘节点在回源过程中获得资源的命中率,降低了CDN网络带宽的浪费,同时节省了CDN网络的存储资源。
本申请的其他特征和优点将在随后的说明书中阐述,或者,部分特征和优点可以从说明书推知或毫无疑义地确定,或者通过实施本申请的上述技术即可得知。
为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施方式,并配合所附附图,作详细说明如下。
附图说明
为了更清楚地说明本申请具体实施方式中的技术方案,下面将对具体实施方式描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种资源获取方法的应用场景的示意图;
图2为本申请实施例提供的一种资源获取方法的流程图;
图3为本申请实施例提供的一种资源获取方法中,建立节点哈希环过程的流程图;
图4为本申请实施例提供的另一种资源获取方法的流程图;
图5为本申请实施例提供的另一种资源获取方法中,建立节点哈希环过程的流程图;
图6为本申请实施例提供的另一种资源获取方法的流程图;
图7为本申请实施例提供的一种节点设备的架构图;
图8为本申请实施例提供的一种节点哈希环的示意图;
图9为本申请实施例提供的一种资源获取装置的结构示意图;
图10为本申请实施例提供的一种CDN网络中的节点设备的结构示意图。
具体实施方式
下面将结合实施例对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为了便于理解,首先示出一种资源获取方法的应用场景,如图1所示,该场景包含用户终端、域名系统(Domain Name System,DNS)、CDN节点设备及源站服务器。
上述用户终端可以为移动终端(如平板电脑、手机等)、计算机或专用终端设备,用户终端上安装有客户端或浏览器;用户可以通过该用户终端发出资源访问请求,该资源访问请求中包括待访问资源的网址信息;用户终端通常将该资源访问请求发送至域名系统中的本地递归域名服务器。
上述域名系统通常包括本地递归域名服务器、根域名服务器、顶级域名服务器及各级域名服务器等。在接收到用户终端发送的资源访问请求后,域名系统基于常见的DNS解析的方式获取待访问资源的网址信息对应的网页服务器的IP(Internet Protocol,网际互连协议)地址:即通过本地递归域名服务器、根域名服务器、待访问资源的网址信息所属的顶级域名服务器及各级域名服务器进行层层解析,得到可以获取到待访问资源的某个服务器的访问地址;并将该服务器的访问地址发送至用户终端。用户终端在接收到可以获取到待访问资源的服务器的访问地址后,向该服务器发送资源访问请求。
上述可以获取到待访问资源的服务器可以为CDN网络的节点设备中的边缘节点。CDN网络的节点设备包括边缘节点、中层节点及上层节点。边缘节点的个数最多,直接服务于网络用户(也称为网民);中层节点主要是汇聚边缘节点回源请求,不直接服务于网络用户,个数较少;上层节点主要是汇聚中层节点回源请求,不直接服务于网络用户,个数最少;通常情况下,一般的网络用户不会为中层或上层节点产生的带宽付费。
CDN网络的节点设备及源站属于内容分发网络;内容分发网络的源站中保存有网站资源,源站中的网站资源通过上层节点、中层节点分发至边缘节点;边缘节点为用户终端直接访问并获取待访问资源的CDN网络的节点设备。当接收到资源访问请求后,如果边缘节点中没有存储该资源访问请求对应的待访问资源中,边缘节点可以向中层节点获取该待访问资源;如果中层节点也没有该待访问资源,可以向上层节点获取该待访问资源;如果上层节点没有该待访问资源,可以向源站获取该待访问资源;上述向上一级节点设备获取待访问资源的过程可称为回源拉取(即上述回源请求)。
相关技术中,CDN节点设备的内部回源过程主要以择优的方式为主;在一实施方式中,1个中层节点覆盖周边的若干个边缘节点,这些边缘节点在回源时均向该中层节点获取资源;1个上层节点覆盖周边的若干个中层节点,这些中层节点在回源时,均向该上层 节点获取资源。在内部回源的过程中,选择上一级节点设备时主要考虑网络状况(如是否能与该上一级节点设备通信)及上一级节点设备的带宽情况(也称为水位),但没有考虑要获取的资源是否在该上一级节点设备(中层节点或上层节点)中存在,造成获取资源的命中率低,易造成CDN网络带宽的浪费。此外,如果通过不同的上一级节点设备进行回源,需要在不同的上一级节点设备中均存储要获取的资源,重复存储的方式浪费了较多的CDN网络存储资源。
基于此,本申请实施例提供了一种资源获取方法、装置以及CDN网络中的节点设备,可以应用于各种分布式系统的资源读取过程中。
首先,参见图2所示的一种资源获取方法,该方法应用于CDN网络的节点设备;该方法包括如下步骤:
步骤S200,如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联。
上述节点设备可以为边缘节点或中层节点。如果该节点设备为边缘节点,边缘节点在接收到用户终端发送的资源访问请求后,从内部的存储磁盘中查询是否存储有该资源访问请求对应的待访问资源;上述资源访问请求中包括待访问资源对应的资源域名,该资源域名通常为存储该待访问资源的网站的域名;域名(Domain Name),是由一串用点分隔的名字组成的互联网上某一台计算机或计算机组的名称,用于在数据传输时标识计算机的电子方位,域名的表示形式可以为xyz.com等。如果该节点设备为中层节点,中层节点在接收到边缘节点的回源请求后,从内部的存储磁盘中查询是否存储有该回源请求对应的待访问资源;上述回源请求中包括存储待访问资源的资源域名,该资源域名可以为待访问网址。
当节点设备中查询不到用户待访问的资源域名对应的资源时,则确定该节点设备中没有存储该资源,需要从上一级节点设备中回源拉取获得该资源。在一实施方式中,首先需要确定从哪个上一级节点设备中进行回源拉取;该上一节点设备中需要存储待访问的资源域名对应的资源。
在CDN网络中对某个网站资源进行分布式存储时,CDN网络的中心平台可以根据一定的规则将将该网站资源存储在一些上层节点及中层节点中;这些上层节点及中层节点可以视为与该网站资源对应的资源域名相关联的目标节点。根据中层节点或上层节点的可承受的带宽情况,可以为各个节点分配权重;通常情况下,该节点可承受的带宽越大,其对应的权重越高。上述优先级可以与当前的节点和节点组合中的各个节点之间的物理距离相关;通常来说两个节点设备之间的物理距离越近,通信速度也就越快,可以为距离当前的节点设备较近的目标节点设置较高优先级。
上述资源域名相关联的节点哈希环可以根据上述资源域名相关联的目标节点建立;在一实施方式中,可以选择节点组合中相同优先级的节点建立节点哈希环;当节点组合中的 节点有多个优先级时,可以建立多个节点哈希环。
通常情况下,节点设备可承受的带宽越大,为该节点设备设置的权重越高,对该节点设备的访问量应该越高;针对于一个回源请求,响应该请求的几率应该越高。为了增加权重较大的目标节点的对回源请求的响应几率,可以为各个目标节点设置与其权重成比例的虚拟节点;如权重为1的目标节点,为其设置10个虚拟节点;权重为3的目标节点,为其设置30个虚拟节点。为了区分各个虚拟节点,可以为同一个目标节点对应的虚拟节点分配不同的标号,以虚拟节点对应的目标节点的节点域名及其标号作为该虚拟节点的标识。
在建立节点哈希环的过程中,可以首先根据目标节点对应的各个虚拟节点的标识计算该虚拟节点的哈希值,并采用一致性哈希算法将各个虚拟节点映射在哈希环上,生成节点哈希环。在该哈希环上各个虚拟节点被访问的几率是相同的,而目标节点的虚拟节点个数与其权重相关,各个目标节点的被访问几率与其权重相关;根据该节点哈希环选取相应回源请求的目标节点,可以使有能力承受较大带宽款的节点设备的访问量较大。
步骤S202,根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点。
在一实施方式中,可以计算该资源域名对应的资源的哈希值;在计算过程中,资源域名对应的资源也可以理解为该资源的URL(Uniform Resource Locator,统一资源定位符)地址,然后将该资源的URL地址作为计算哈希值的关键字,从而得到资源域名对应的资源的哈希值;上述统一资源定位符表示形式可以为http://mail.xyz.com/index.html。在计算得到资源域名对应的资源的哈希值后,可以根据一致性哈希算法将该哈希值映射到建立的节点哈希环上,可以按照一定规律选择与该资源域名对应的资源的哈希值相匹配的虚拟点,如找到第一个比资源的哈希值大的虚拟点,将该虚拟点作为目标虚拟节点。
步骤S204,从目标虚拟点对应的目标节点获取资源域名对应的资源。
在确定了目标虚拟点后,可以将该目标虚拟点对应的目标节点作为响应当前节点设备的回源请求的上一级节点设备;该节点设备可能为中层节点,也可能为上层节点。在一实施方式中,可以向CDN网络内的DNS服务器发送目标虚拟点对应的节点的节点域名,当接收到DNS服务器解析该节点域名后返回节点域名对应的IP地址后,向该IP地址发送待访问资源的回源请求,以使该目标虚拟点对应的目标节点将待访问资源返回至当前的节点设备。
在一些情况下,选择的目标虚拟节点对应的目标节点无法响应当前设备的回源请求;该情况可以记录在该目标节点的历史使用记录中;此时,删除该目标节点在节点哈希环上的所有虚拟节点,并重新选择目标虚拟节点。当在上述步骤中获取到了多个优先级不同的节点哈希环时,可以从其他节点哈希环中选取目标虚拟节点;通常遵循优先级从高到低的顺序从不同的节点哈希环中选取目标虚拟节点。
上述一种资源获取方法,在从节点设备中查询不到用户待访问的资源域名对应的资源时,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节 点权重相关联;根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点,进而从目标虚拟点对应的目标节点获取资源域名对应的资源。该方式中,无需在多个中层及上层节点中缓存待访问的资源域名对应的资源,仅需要保证在基于与资源域名相关联的目标节点建立的节点哈希环中的至少一个节点中保存该资源,当前的节点设备即可以通过该节点哈希环获取到待访问的资源域名对应的资源,提高了边缘节点在回源过程中获取资源的命中率,降低了CDN网络带宽的浪费,同时节省了CDN网络的存储资源。
本申请实施例还提供另一种资源获取方法,该方法在上述实施例方法的基础上实现;该方法基于预先建立的节点哈希环实现;该方法重点描述当获取到多个优先级不同的节点哈希环时,从节点哈希环中的虚拟点中确定目标虚拟点的实现过程(通过下述步骤S402-S412实现),以及从目标虚拟点对应的节点上获取资源域名对应的资源在一实施方式中的实现过程(通过下述步骤S414-S416实现)。
在此之前,首先描述上述节点哈希环的建立方式,如图3所示,在一实施方式中,包括如下步骤:
步骤S300,获取与资源域名相关联的节点组合;其中,节点组合中包括CDN网络中的多个节点、以及每个节点的优先级。
上述节点组合,包括目标节点、以及每个目标节点的权重和优先级等信息,可以保存在设定的设备中;当当前节点设备进行回源拉取时,可以首先向设定设备发送请求;该请求中包括待访问的资源域名,以使该设定设备将与资源域名相关联的节点组合发送给当前的节点设备。由于该过程与常见的DNS解析方式有相似之处,可以将该设定设备视为CDN网络中的内部DNS服务器。
步骤S302,根据每个节点的优先级,从节点组合中选择目标节点,根据目标节点建立节点哈希环。
当节点组合中的节点的优先级为多级优先级时,可以针对每级优先级,从节点组合中选择当前优先级对应的节点,根据当前优先级对应的节点建立当前优先级对应的节点哈希环。在一实施方式中,当节点组合中的节点的优先级为多级优先级时,可以将相同优先级的节点作为一组,分别生成节点哈希环,最后得到多个节点哈希环。同时还可以将节点哈希环中节点的优先级设置为节点哈希环的优先级;每级优先级对应一个节点哈希环。
假设节点组合中包括第一优先级的5个节点,第二优先级的6个节点,第三优先级的4个节点,首先可以将第一优先级的5个节点作为目标节点,并根据第一优先级的5个节点对应的各个虚拟节点的标识计算其哈希值,并采用一致性哈希算法将各个虚拟节点映射在哈希环上,生成第一优先级的节点哈希环。以此类推,再依次建立第二优先级的节点哈希环及第三优先级的节点哈希环,该建立顺序可以由根据需求设定。
基于上述节点哈希环,如图4所示,上述资源获取方法包括如下步骤:
步骤S400,如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标 节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联。
步骤S402,按照优先级从高到低的顺序,根据资源域名对应的资源,从最高优先级对应的节点哈希环中确定目标虚拟点。
在一实施方式中,可以计算资源域名对应的资源的资源哈希值后,根据一致性哈希算法将该资源哈希值映射到最高优先级对应的节点哈希环上,可以选取该节点哈希环上与资源哈希值距离最近的虚拟点作为目标虚拟点。
步骤S404,查询目标虚拟点对应的节点的历史使用记录;在一实施方式中,该历史使用记录可以为目标虚拟节点对应的节点响应回源请求的历史结果;如成功响应上一次其他节点设备向该节点发送的回源请求,可以将历史使用记录设置为using,代表该节点能正常使用;如果没有成功响应,可以该历史使用记录设置为down,代表该节点无法使用;该历史响应记录可以作为该节点的相关信息保存在DNS解析记录中。
步骤S406,如果历史使用记录指示目标虚拟点对应的节点不可用,执行步骤S408;如果可用,执行步骤S412;在查询到历史使用记录后,可以根据该历史使用记录确定目标虚拟点是否可用;如历史使用记录为up时,可以确定目标虚拟点可用,历史使用记录为down时,可以确定目标虚拟点可不用。
步骤S408,将目标虚拟点对应的节点哈希环中,节点不可用的虚拟点删除;实际上,如果目标虚拟点对应的实际节点不可用,在该节点哈希环上,通常还有多个虚拟点对应该实际节点;在该节点哈希环还会可能再次选取到与该实际节点对应的虚拟点,仍然不可用,使得整个方法变得冗余;因此,当确定一个实际节点不可用时,需要将对应的节点哈希环上,该实际节点对应的虚拟点都删除。
步骤S410,如果当前的节点哈希环为最后一级优先级的节点哈希环,执行步骤S402;如果当前的节点哈希环不是最后一级优先级的节点哈希环,执行步骤S412;在实际情况中,当针对于该资源域名建立了多个不同优先级的节点哈希环时,可以通过查看当前的节点哈希环的优先级的方式确定当前的节点哈希环是否为最后一级优先级的节点哈希环,即优先级最低的节点哈希环。
步骤S412,根据资源域名对应的资源,从下一优先级的节点哈希环中确定更新的目标虚拟点,执行步骤S404;如果当前的节点哈希环不是优先级最低的节点哈希环,可以在优先级比当前的节点哈希环低一级的节点哈希环中,根据资源域名对应的资源的哈希值确定在该节点哈希环中的目标虚拟点;该确定目标虚拟点的过程与从最高优先级对应的节点哈希环中确定目标虚拟点的过程类似,均采用一致性哈希原理。接下来,还需要通过历史使用记录确定更新后的目标虚拟点是否可用,如步骤S306所述。
步骤S414,向CDN网络内的DNS服务器发送目标虚拟点对应的节点的节点域名,以使CDN网络内的DNS服务器解析节点域名,得到并返回节点域名对应的IP地址列表。
如果确定该目标虚拟节点是可用的,此时虽然当前的节点设备已经获取到对应的实际节点的节点域名,但无法访问该节点。此时,需要向CDN网络内的DNS服务器发送目标虚拟点对应的节点的节点域名;CDN网络内的DNS服务器在接收到该节点域名后,对其 进行域名解析,得到节点域名对应的IP地址列表,并把IP地址列表返回至当前的节点设备中。
步骤S416,从IP地址列表中选择目标IP地址,通过目标IP地址获取资源域名对应的资源。
在实际中,一个节点可能对应于多个服务器;当前的节点设备接收到的IP地址列表中列出了目标虚拟点对应的节点的多个IP地址;可以随机在该IP地址列表中选取一个IP地址作为目标IP地址,并访问该目标IP地址获取到资源域名对应的资源。
上述一种资源获取方法,在从节点设备中查询不到用户待访问的资源域名对应的资源时,获取与资源域名相关联的节点哈希环;当获取到的节点哈希环为多个,且优先级不同时,按照优先级从高到低的顺序,根据资源域名对应的资源,从最高优先级对应的节点哈希环中确定目标虚拟点,并查询目标虚拟点对应的节点的历史使用记录,以确定该节点是否可用,如果该节点不可用,从下一优先级的节点哈希环中确定目标虚拟点,直至获取可用的目标虚拟节点;如果可用,通过CND网络中的DNS进行域名解析,以获取该节点的IP地址,从而访问该节点获取到资源域名对应的资源。该方式中,可以依照优先级的顺序从与该资源域名相关联的多个节点哈希环中选取可用的节点,从而获取该资源域名对应的资源,提高了边缘节点在回源过程中获取资源的命中率,降低了CDN网络带宽的浪费。
本申请实施例还提供另一种资源获取方法,该方法在上述实施例方法的基础上实现;该方法基于预先建立的节点哈希环实现;该方法重点描述当节点组合中的节点的优先级包括第一先级和第二优先级,且第一优先级高于第二优先级时,从节点哈希环中确定目标虚拟节点在一实施方式中的实现过程(通过下述步骤S402-S416实现)。如图5所示,上述节点哈希环通过以下方式建立:
步骤S500,向CDN网络内的DNS服务器发送资源域名,以使CDN网络内的DNS服务器解析资源域名,得到并返回与资源域名相关联的节点组合的SRV格式的DNS解析记录;其中,DNS解析记录中包括节点组合中的多个节点、以及每个节点的节点权重和优先级。
上述节点组合以及与节点组合相关联的资源域名,可以保存在CDN网络内的DNS服务器中;在一实施方式中,可以在CDN网络内部设置DNS服务器,并将节点组合以及与节点组合相关联的资源域名,保存在CDN网络内的DNS服务器中。在建立与设定的资源域名相关的节点哈希环时,可以向该DNS服务器发送资源域名;该DNS服务器用于对接收到的资源域名进行解析,得到与该资源域名相关联的节点组合的相关信息,并将其作为该资源域名的DNS解析记录返回至当前的节点设备中;该DNS解析记录中可以包括节点组合中的多个节点、以及每个节点的权重和优先级。该DNS解析记录可以以SRV格式存储在DNS服务器中,SRV记录是DNS服务器的数据库中支持的一种资源记录的类型。步骤S502,从节点组合中选择第一优先级对应的节点,根据第一优先级对应的节点建立主用节点哈希环。
步骤S504,从节点组合中选择第二优先级对应的节点,根据第二优先级对应的节点 建立备用节点哈希环。
上述主用节点哈希环和备用节点哈希环均由多个虚拟点组成;在主用节点哈希环中,每个第一优先级的节点对应至少一个虚拟点,该节点对应的虚拟点的数量与该目标节点的权重相关联;在备用节点哈希环中,每个第二优先级的节点对应至少一个虚拟点,该节点对应的虚拟点的数量与该目标节点的权重相关联。
在实际实现过程中,节点哈希环中,每个目标节点对应的虚拟点的数量可以为:该目标节点的权重乘以预设倍数,如该预设倍数可以为10;节点哈希环中的每个虚拟点设置有虚拟点哈希值;在一实施方式中,可以根据该虚拟点对应的节点域名和为该虚拟点设定的下标计算出此虚拟点的哈希值。
基于上述节点哈希环,如图6所示,上述资源获取方法包括如下步骤:
步骤S600,如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联。
步骤S602,计算资源域名对应的资源的资源哈希值;在一实施方式中,采用哈希算法计算资源域名的哈希值,作为该资源域名对应的资源的资源哈希值。
步骤S604,采用一致性哈希算法,从主用节点哈希环中的各个虚拟点中选择虚拟点哈希值与资源哈希值相匹配的虚拟点,将选择出的虚拟点确定为目标虚拟点;在一实施方式中,可以采用一致性哈希算法将资源哈希值映射到主用节点哈希环,并依据一定的规则选择对应的虚拟点,如选用主用节点哈希环上,虚拟点哈希值比资源哈希值大且距离资源哈希值最近的虚拟点哈希值与该资源哈希值匹配,将该虚拟点哈希值对应的虚拟点作为目标虚拟点。
步骤S606,查询主用节点的目标虚拟点对应的节点的历史使用记录。
步骤S608,如果历史使用记录指示主用节点的目标虚拟点对应的节点不可用,执行步骤S610;如果可用,执行步骤S620。
步骤S610,将主用节点哈希环中,节点不可用的虚拟点删除;
步骤S612,采用一致性哈希算法,从备用节点哈希环中的各个虚拟点中选择虚拟点哈希值与资源哈希值相匹配的虚拟点,将选择出的虚拟点确定更新的目标虚拟点;该过程与从主用节点哈希环中确定目标虚拟点的过程相似,不再赘述。
步骤S614,查询备用节点的目标虚拟点对应的节点的历史使用记录。
步骤S616,如果历史使用记录指示备用节点的目标虚拟点对应的节点不可用,执行步骤S618;如果可用,执行步骤S620。
步骤S618,将备用节点哈希环中,节点不可用的虚拟点删除;执行步骤S604;当选中的备用节点哈希环的目标虚拟点对应的节点不可用时,将备用节点哈希环中,该不可用节点对应的虚拟点均删除,并再次从主备用节点哈希环中选取目标虚拟节点,其过程如步骤S604所述。
步骤S620,从目标虚拟点对应的节点获取资源域名对应的资源。
上述一种资源获取方法,在从节点设备中查询不到用户待访问的资源域名对应的资源时,获取该资源域名对应的节点哈希环;当节点哈希环包括朱勇节点哈希环及备用节点哈希环时,首先从主用节点哈希环中根据资源域名对应的资源选取目标虚拟点,并通过历史使用记录确定该目标虚拟点是否可用,如果不可用,再从备用节点哈希环中根据资源域名对应的资源选用目标虚拟点,直至获得可用的目标虚拟节点,并从目标虚拟点对应的节点获取资源域名对应的资源。该方式中,可以通过从主用节点哈希环或备用节点哈希环中选取目标虚拟点的方式,从与该资源域名相关联的多个节点中选取可用的节点,从而获取该资源域名对应的资源,提高了边缘节点在回源过程中获取资源的命中率,降低了CDN网络带宽的浪费。
本申请实施例还提供另一种资源获取方法,该方法在上述实施例方法的基础上实现。该方法应用于CND的节点设备;如图7所示,CND的节点设备包括Linux虚拟服务器(LVS)及多个缓存设备(图7中以包括两个缓存设备为例);每个缓存设备中包括Nginx(一种高性能的HTTP(HyperText Transfer Protocol,超文本传输协议)和反向代理web服务器)及缓存磁盘(cache)。其中,Linux虚拟服务器可以接收用户发送的资源访问请求;通过Nginx的作用最终从缓存磁盘中输出资源访问请求对应的待访问资源;在缓存设备中运行cache软件,以对存储磁盘进行管理。
相关技术中,如果从当前节点设备(边缘节点或中层节点)中无法获取到资源访问请求对应的待访问资源,向上一级节点设备(中层节点或上层节点)进行回源拉取时,在选择上一级节点设备的过程中,只考虑了上一级节点设备网络状况和水位情况,没有考虑资源在该上一级节点中是否有存储,造成对上一级节点设备的回源命中率低,同时也造成了上层节点和用户源站带宽的浪费;此外,基于上述方式,同一个资源会在所有的中层和上层节点重复存储,存储资源没有被充分利用,对存储资源造成了浪费。
本申请实施例提供的方法通过将中层和上层节点组建为若干个哈希(hash)环,在节点设备进行回源拉取(边缘节点向中层节点回源、边缘节点向上层节点回源或中层节点向上层节点回源)的过程,使用一致性哈希算法,使得对固定资源(对应于同一资源域名的资源)选择固定的中层或上层,从而提升中层节点或上层节点的命中率,缩短了中层节点和上层节点的回源请求处理时间,从而提升服务质量,降低回源带宽;同时使得中层节点和上层存储资源的重复率下降,相当于扩大了中层和上层节点的存储空间;并降低了回用户源站的带宽,相较于同一个资源,回源用户源站的次数与上层节点的个数相同,采用上述方式只会回源用户源站一次。
该方法包括以下步骤:
步骤(1),当前的节点设备中的cache软件在发起回源时,通过CDN网络内部的DNS发送的DNS SRV解析记录来获取与待获取资源对应的节点哈希环的信息;该信息中包括节点哈希环中的节点、各个节点的权重及优先级等信息。
步骤(2),将中层和上层节点组成若干个hash环,hash环中每个节点具有节点域名, 权重及优先级;如将mid1,mid2,mid3,mid4,mid5,mid6这6个节点组建一个节点哈希环,该节点哈希环的名字为md5.cdn-node.com;其中,md5为通过则6个节点的节点域名+权重+优先级计算出的一个md5值,该md5值具有唯一性。各个节点的信息在一实施方式中如下述表1所示:
表1
节点 域名 权重 优先级
mid1 mid1.cdn-node.com 80 0
mid2 mid2.cdn-node.com 80 0
mid3 mid3.cdn-node.com 100 0
mid4 mid4cdn-node.com 80 1
mid5 mid5.cdn-node.com 90 1
mid6 mid6.cdn-node.com 80 1
在建立哈希环的过程中,使用节点域名而不是直接使用节点IP;主要考虑节点IP的变化对缓存产生影响,而节点域名不会发生变化,所以选择节点域名作为关键字(key)。上述权重根据节点出口带宽确定,主要考虑节点出口带宽以及负载情况,可以动态调整,权重越大,被使用到的概率越大。上述优先级表明主备关系,优先级为0的是主用节点哈希环(也称为主环),其他的为备用节点哈希环(也称为备环),优先级越小表明优先级越高,同一个优先级的节点组成一个哈希环。
该节点哈希环与当前节点设备待获取资源的资源域名相关联;如将md5.cdn-node.com与www.ksyun.com相关联上,即www.ksyun.com边缘节点回源中层节点或中层节点回上层节点均可以使用md5.cdn-node.com做解析,并生成对应的DNS解析记录,结果如下:
www.ksyun.com 30 IN CNAME md5.cdn-node.com;
md5.cdn-node.com 30 IN SRV 0 80 80 mid1.cdn-node.com;
md5.cdn-node.com 30 IN SRV 0 80 80 mid2.cdn-node.com;
md5.cdn-node.com 30 IN SRV 0 100 80 mid3.cdn-node.com;
md5.cdn-node.com 30 IN SRV 1 80 80 mid4.cdn-node.com;
md5.cdn-node.com 30 IN SRV 1 90 80 mid5.cdn-node.com;
md5.cdn-node.com 30 IN SRV 1 80 80 mid6.cdn-node.com;
其中,SRV格式为:domain ttl IN SRV proirity weight port host。
在组成节点哈希环的过程中,遵循以下规则:首先,同一个优先级的节点组成1个hash环;然后,节点权重体现为hash环上虚拟点(也称为虚拟节点)个数,虚拟点个数等于权重乘以10,10为认为设置的倍数;其中,根据节点域名+虚拟点下标计算出此虚拟节点的哈希值。
根据该规则建立的节点哈希环示意图如图8所示,mid1’1、mid1’2、mid1’3、mid1’4 分别为mid1的虚拟点;mid2’1、mid2’2、mid2’3、mid2’4分别为mid2的虚拟点;mid3’1、mid3’2、mid3’3、mid3’4、mid3’5分别为mid3的虚拟点;由于该图中位置有限,图上仅显示了部分虚拟节点,没有全部显示。
步骤(3),hash环创建完成后,cache软件会根据本次回源请求的URL(相当于资源域名对应的资源)计算一个哈希值,根据一致性哈希值,在步骤(2)创建的哈希环上寻找1个节点,如选择mid2。
步骤(4),如果历史使用记录指示mid2节点不可用,则去备用节点哈希环上查找节点,如mid4。
步骤(5),如果历史使用记录指示mid4节点也不可用,则按照一致性哈希算法,摘掉不可用的节点,直至选择出一个可用节点位置。
步骤(6),cache软件再次向指定DNS服务器发起DNS解析,获取所选节点对应的IP列表,并随机选择一个可用IP进行回源。
上述资源获取方法,选择节点域名作为哈希算法的关键词,可以解决一个节点有多个IP或节点IP变化的问题,节点IP发生变化不影响hash结果;并使用SRV记录的方式传递哈希环信息;在节点哈希环不发生变化时,同一个资源可以只在节点哈希环的一个节点上存储,此节点哈希环的所有边缘节点都会访问此节点,提升命中率;并且在节点哈希环发生变化时,根据一致性哈希算法,只有发生变化的部分会受到影响,其他未变化部分不受影响,提高了服务的稳定性。
上述方式提高了边缘节点向中层或上层节点获得资源的命中率;由于使用了哈希(hash)回源,不同的边缘节点回源获取同一个资源时,都会回到同一个中层或上层节点,所以提升了中层或上层节点获取资源的命中率;同时,这种方法导致不同的资源只在同一个节点存储,相当于扩充了中上层的存储空间。
对应于上述资源获取方法实施例,本申请实施例还提供一种资源获取装置,设置于CDN网络的节点设备;如图9所示,该装置包括:
节点哈希环获取模块700,设置为如果从节点设备中查询不到用户待访问的资源域名对应的资源,获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;
目标虚拟点确定模块702,设置为根据资源域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点;
资源获取模块704,设置为从目标虚拟点对应的目标节点获取资源域名对应的资源。
上述一种资源获取装置,应设置为CDN网络中的节点设备;获取与资源域名相关联的节点哈希环;其中,节点哈希环预先根据CDN网络中与资源域名相关联的目标节点建立;目标节点预设有节点权重;节点哈希环由多个虚拟点组成,每个目标节点对应至少一个虚拟点,每个目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;根据资源 域名对应的资源,从节点哈希环中的虚拟点中确定目标虚拟点,进而从目标虚拟点对应的目标节点获取资源域名对应的资源。该方式中,无需在多个中层及上层节点中缓存待访问的资源域名对应的资源,仅需要保证在基于与资源域名相关联的目标节点建立的节点哈希环中的至少一个节点中保存该资源,当前的节点设备即可以通过该节点哈希环获取到待访问的资源域名对应的资源,提高了边缘节点在回源过程中获取资源的命中率,降低了CDN网络带宽的浪费,同时节省了CDN网络的存储资源。
在一实施方式中,上述装置还包括:节点组合获取模块,设置为获取与资源域名相关联的节点组合;其中,节点组合中包括CDN网络中的多个节点、以及每个节点的优先级;哈希环建立模块,设置为根据每个节点的优先级,从节点组合中选择目标节点,根据目标节点建立节点哈希环。
上述节点组合以及与上述节点组合相关联的资源域名,可以保存在上述CDN网络内的DNS服务器中;在一实施方式中,上述节点组合获取模块还设置为:向CDN网络内的DNS服务器发送资源域名,以使CDN网络内的DNS服务器解析资源域名,得到并返回与资源域名相关联的节点组合的SRV格式的DNS解析记录;其中,DNS解析记录中包括节点组合中的多个节点、以及每个节点的节点权重和优先级。
上述节点组合中的节点的优先级可以为多级优先级;在一实施方式中,上述哈希环建立模块还设置为:针对每级优先级,从节点组合中选择当前优先级对应的节点,根据当前优先级对应的节点建立当前优先级对应的节点哈希环。
在一实施方式中,上述节点组合中的节点的优先级可以包括第一先级和第二优先级;其中,第一优先级高于第二优先级;上述哈希环建立模块还设置为:从节点组合中选择第一优先级对应的节点,根据第一优先级对应的节点建立主用节点哈希环;从节点组合中选择第二优先级对应的节点,根据第二优先级对应的节点建立备用节点哈希环。
在上述节点组合中的节点的优先级为多级优先级,每级优先级对应一个节点哈希环时,上述资源获取模块还设置为:按照优先级从高到低的顺序,从最高优先级对应的节点哈希环中确定目标虚拟点;查询目标虚拟点对应的节点的历史使用记录,如果历史使用记录指示目标虚拟点对应的节点不可用,从下一优先级的节点哈希环中确定更新的目标虚拟点,继续执行查询目标虚拟点对应的节点的历史使用记录的步骤,直至确定出的目标虚拟点对应的节点可用。
在一实施方式中,上述装置还包括:第一节点删除模块,设置为如果历史使用记录指示目标虚拟点对应的节点不可用,将目标虚拟点对应的节点哈希环中,节点不可用的虚拟点删除;如果直至最后一级优先级的节点哈希环中确定更新的目标虚拟点后,目标虚拟点的历史使用记录指示目标虚拟点对应的节点不可用,继续执行从最高优先级对应的节点哈希环中确定目标虚拟点的步骤,直至确定出的目标虚拟点对应的节点可用。
在一实施方式中,上述节点组合中的节点的优先级包括第一优先级和第二优先级;第一优先级对应主用节点哈希环;第二优先级对应备用节点哈希环;其中,第一优先级高于第二优先级;上述资源获取模块还设置为:从主用节点哈希环中确定目标虚拟点;查询目标虚拟点对应的节点的历史使用记录,如果历史使用记录指示目标虚拟点对应的节点不可 用,从备用节点哈希环中确定更新的目标虚拟点。
在一实施方式中,上述装置还包括:第二节点删除模块,设置为如果从主用节点哈希环中确定的目标虚拟点对应的节点不可用,将主用节点哈希环中,节点不可用的虚拟点删除;第三节点删除模块,设置为如果从备用节点哈希环中确定更新的目标虚拟点对应的节点不可用,将备用节点哈希环中,节点不可用的虚拟点删除;继续执行从主用节点哈希环中确定目标虚拟点的步骤,直至确定出的目标虚拟点对应的节点可用。
在一实施方式中,上述节点哈希环中,每个目标节点对应的虚拟点的数量为:该目标节点的节点权重乘以预设倍数;节点哈希环中的每个虚拟点设置有虚拟点哈希值;上述资源获取模块还设置为:计算资源域名对应的资源的资源哈希值;采用一致性哈希算法,从节点哈希环中的各个虚拟点中选择虚拟点哈希值与资源哈希值相匹配的虚拟点,将选择出的虚拟点确定为目标虚拟点。
在一实施方式中,上述资源获取模块还设置为:向CDN网络内的DNS服务器发送目标虚拟点对应的节点的节点域名,以使CDN网络内的DNS服务器解析节点域名,得到并返回节点域名对应的IP地址列表;从IP地址列表中选择目标IP地址,通过目标IP地址获取资源域名对应的资源。
本申请实施例所提供的资源获取装置,其实现原理及产生的技术效果和前述资源获取方法实施例相同,为简要描述,资源获取装置实施例部分未提及之处,可参考前述资源获取方法实施例中相应内容。
本申请实施例还提供了一种CDN网络中的节点设备,参见图10所示,该CDN网络中的节点设备包括处理器130和存储器131,该存储器131存储有能够被处理器130执行的机器可执行指令,该处理器130执行机器可执行指令以实现资源获取方法。
在一实施方式中,图10所示的CDN网络中的节点设备还包括总线132和通信接口133,处理器130、通信接口133和存储器131通过总线132连接。
其中,存储器131可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个通信接口133(可以是有线或者无线)实现该系统网元与至少一个其他网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。总线132可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图10中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。
处理器130可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器130中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器130可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processing,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现成可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的 各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器131,处理器130读取存储器131中的信息,结合其硬件完成前述实施例的方法的步骤。
本申请实施例还提供了一种机器可读存储介质,该机器可读存储介质存储有机器可执行指令,该机器可执行指令在被处理器调用和执行时,该机器可执行指令促使处理器实现上述资源获取方法,具体实现可参见方法实施例,在此不再赘述。
本申请实施例所提供的资源获取方法及装置和CDN网络中的节点设备的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可设置为执行前面方法实施例中所述的方法,具体实现可参见方法实施例,在此不再赘述。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的精神和范围,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。
工业实用性
相关技术中,对于一个资源来说,该资源通常存储在很多中层节点或上层节点上,重复存储的方式会浪费较多的CDN网络存储资源;另外,边缘节点在选择回源的节点时,通常仅考虑各个节点的网络状况和带宽状况,很可能导致选择的节点中没有存储用户想要访问的资源,这时还需要继续选择节点以获取资源,因此获得资源的命中率低,易造成CDN网络带宽的浪费。
针对相关技术存在的问题,本申请实施例,无需在多个中层及上层节点中缓存待访问的资源域名对应的资源,仅需要保证在基于与资源域名相关联的目标节点建立的节点哈希环中的至少一个节点中保存该资源即可,当前的节点设备即可以通过该节点哈希环获取到待访问的资源域名对应的资源,提高了边缘节点在回源过程中获得资源的命中率,降低了 CDN网络带宽的浪费,同时节省了CDN网络的存储资源。

Claims (15)

  1. 一种资源获取方法,应用于CDN网络中的节点设备;所述方法包括:
    如果从所述节点设备中查询不到用户待访问的资源域名对应的资源,获取与所述资源域名相关联的节点哈希环;
    其中,所述节点哈希环预先根据CDN网络中与所述资源域名相关联的目标节点建立;所述目标节点预设有节点权重;所述节点哈希环由多个虚拟点组成,每个所述目标节点对应至少一个虚拟点,每个所述目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;
    根据所述资源域名对应的资源,从所述节点哈希环中的虚拟点中确定目标虚拟点;
    从所述目标虚拟点对应的目标节点获取所述资源域名对应的资源。
  2. 根据权利要求1所述的方法,其中,所述节点哈希环,通过下述方式建立:
    获取与所述资源域名相关联的节点组合;其中,所述节点组合中包括CDN网络中的多个节点、以及每个所述节点的优先级;
    根据每个所述节点的优先级,从所述节点组合中选择目标节点,根据所述目标节点建立节点哈希环。
  3. 根据权利要求2所述的方法,其中,所述节点组合以及与所述节点组合相关联的资源域名,保存在所述CDN网络内的DNS服务器中;
    所述获取与所述资源域名相关联的节点组合的步骤,包括:
    向所述CDN网络内的DNS服务器发送所述资源域名,以使所述CDN网络内的DNS服务器解析所述资源域名,得到并返回与所述资源域名相关联的节点组合的SRV格式的DNS解析记录;其中,所述DNS解析记录中包括所述节点组合中的多个节点、以及每个所述节点的节点权重和优先级。
  4. 根据权利要求2所述的方法,其中,所述节点组合中的节点的优先级为多级优先级;
    所述根据每个所述节点的优先级,从所述节点组合中选择目标节点,根据所述目标节点建立节点哈希环的步骤,包括:针对每级优先级,从所述节点组合中选择当前优先级对应的节点,根据所述当前优先级对应的节点建立所述当前优先级对应的节点哈希环。
  5. 根据权利要求4所述的方法,其中,所述节点组合中的节点的优先级包括第一先级和第二优先级;其中,所述第一优先级高于所述第二优先级;
    所述针对每级优先级,从所述节点组合中选择当前优先级对应的节点,根据所述当前优先级对应的节点建立所述当前优先级对应的节点哈希环的步骤,包括:
    从所述节点组合中选择所述第一优先级对应的节点,根据所述第一优先级对应的节点建立主用节点哈希环;
    从所述节点组合中选择所述第二优先级对应的节点,根据所述第二优先级对应的节点建立备用节点哈希环。
  6. 根据权利要求1所述的方法,其中,所述节点组合中的节点的优先级为多级优先级;每级优先级对应一个节点哈希环;
    从所述节点哈希环中的虚拟点中确定目标虚拟点的步骤,包括:
    按照所述优先级从高到低的顺序,从最高优先级对应的节点哈希环中确定目标虚拟点;
    查询所述目标虚拟点对应的节点的历史使用记录,如果所述历史使用记录指示所述目标虚拟点对应的节点不可用,从下一优先级的节点哈希环中确定更新的目标虚拟点,继续执行查询所述目标虚拟点对应的节点的历史使用记录的步骤,直至确定出的目标虚拟点对应的节点可用。
  7. 根据权利要求6所述的方法,其中,所述方法还包括:
    如果所述历史使用记录指示所述目标虚拟点对应的节点不可用,将所述目标虚拟点对应的节点哈希环中,节点不可用的虚拟点删除;
    如果直至最后一级优先级的节点哈希环中确定更新的目标虚拟点后,所述目标虚拟点的历史使用记录指示所述目标虚拟点对应的节点不可用,继续执行从最高优先级对应的节点哈希环中确定目标虚拟点的步骤,直至确定出的目标虚拟点对应的节点可用。
  8. 根据权利要求2所述的方法,其中,所述节点组合中的节点的优先级包括第一优先级和第二优先级;所述第一优先级对应主用节点哈希环;所述第二优先级对应备用节点哈希环;其中,所述第一优先级高于所述第二优先级;
    从所述节点哈希环中的虚拟点中确定目标虚拟点的步骤,包括:
    从所述主用节点哈希环中确定目标虚拟点;
    查询所述目标虚拟点对应的节点的历史使用记录,如果所述历史使用记录指示所述目标虚拟点对应的节点不可用,从所述备用节点哈希环中确定更新的目标虚拟点。
  9. 根据权利要求8所述的方法,其中,所述方法还包括:
    如果从所述主用节点哈希环中确定的目标虚拟点对应的节点不可用,将所述主用节点哈希环中,节点不可用的虚拟点删除;
    如果从所述备用节点哈希环中确定更新的目标虚拟点对应的节点不可用,将所述备用节点哈希环中,节点不可用的虚拟点删除;继续执行从所述主用节点哈希环中确定目标虚拟点的步骤,直至确定出的目标虚拟点对应的节点可用。
  10. 根据权利要求1所述的方法,其中,所述节点哈希环中,每个所述目标节点对应的虚拟点的数量为:该目标节点的节点权重乘以预设倍数;所述节点哈希环中的每个虚拟点设置有虚拟点哈希值;
    所述根据所述资源域名对应的资源,从所述节点哈希环中的虚拟点中确定目标虚拟点的步骤,包括:
    计算所述资源域名对应的资源的资源哈希值;
    采用一致性哈希算法,从所述节点哈希环中的各个虚拟点中选择虚拟点哈希值与所述资源哈希值相匹配的虚拟点,将选择出的虚拟点确定为目标虚拟点。
  11. 根据权利要求1所述的方法,其中,从所述目标虚拟点对应的节点上获取所述资源域名对应的资源的步骤,包括:
    向所述CDN网络内的DNS服务器发送所述目标虚拟点对应的节点的节点域名,以使 所述CDN网络内的DNS服务器解析所述节点域名,得到并返回所述节点域名对应的IP地址列表;
    从所述IP地址列表中选择目标IP地址,通过所述目标IP地址获取所述资源域名对应的资源。
  12. 一种资源获取装置,设置于CDN网络中的节点设备;所述装置包括:
    节点哈希环获取模块,设置为如果从所述节点设备中查询不到用户待访问的资源域名对应的资源,获取与所述资源域名相关联的节点哈希环;
    其中,所述节点哈希环预先根据CDN网络中与所述资源域名相关联的目标节点建立;所述目标节点预设有节点权重;所述节点哈希环由多个虚拟点组成,每个所述目标节点对应至少一个虚拟点,每个所述目标节点对应的虚拟点的数量与该目标节点的节点权重相关联;
    目标虚拟点确定模块,设置为根据所述资源域名对应的资源,从所述节点哈希环中的虚拟点中确定目标虚拟点;
    资源获取模块,设置为从所述目标虚拟点对应的目标节点获取所述资源域名对应的资源。
  13. 根据权利要求12所述的装置,其中,所述节点哈希环,通过下述方式建立:
    获取与所述资源域名相关联的节点组合;其中,所述节点组合中包括CDN网络中的多个节点、以及每个所述节点的优先级;
    根据每个所述节点的优先级,从所述节点组合中选择目标节点,根据所述目标节点建立节点哈希环。
  14. 一种CDN网络中的节点设备,包括处理器和存储器,所述存储器存储有能够被所述处理器执行的机器可执行指令,所述处理器执行所述机器可执行指令以实现权利要求1至11任一项所述的方法。
  15. 一种机器可读存储介质,所述机器可读存储介质存储有机器可执行指令,所述机器可执行指令在被处理器调用和执行时,所述机器可执行指令促使所述处理器实现权利要求1至11任一项所述的方法。
PCT/CN2020/134229 2019-12-31 2020-12-07 资源获取方法、装置及cdn网络中的节点设备 WO2021135835A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911425952.7 2019-12-31
CN201911425952.7A CN113132443B (zh) 2019-12-31 2019-12-31 资源获取方法、装置及cdn网络中的节点设备

Publications (1)

Publication Number Publication Date
WO2021135835A1 true WO2021135835A1 (zh) 2021-07-08

Family

ID=76686424

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/134229 WO2021135835A1 (zh) 2019-12-31 2020-12-07 资源获取方法、装置及cdn网络中的节点设备

Country Status (2)

Country Link
CN (1) CN113132443B (zh)
WO (1) WO2021135835A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113676514A (zh) * 2021-07-19 2021-11-19 北京奇艺世纪科技有限公司 一种文件回源方法及装置
CN113873302A (zh) * 2021-09-29 2021-12-31 北京金山云网络技术有限公司 内容分发方法、装置、存储介质和电子设备
CN114006915A (zh) * 2022-01-04 2022-02-01 北京金山云网络技术有限公司 资源请求方法、装置、设备及计算机可读存储介质
CN114025023A (zh) * 2022-01-04 2022-02-08 北京金山云网络技术有限公司 回源方法、装置、设备及计算机可读存储介质
CN114501053A (zh) * 2022-02-07 2022-05-13 上海哔哩哔哩科技有限公司 直播流获取方法及装置
CN114900562A (zh) * 2022-05-09 2022-08-12 北京百度网讯科技有限公司 一种资源获取方法、装置、电子设备和存储介质
CN115022177A (zh) * 2022-06-08 2022-09-06 阿里巴巴(中国)有限公司 Cdn系统、回源方法、cdn节点及存储介质
CN116090803A (zh) * 2023-04-13 2023-05-09 北京徐工汉云技术有限公司 矿车调度方法、装置、电子设备和存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500459B (zh) * 2021-12-27 2023-10-10 天翼云科技有限公司 一种基于dns协议的数据调度方法、装置及电子设备
CN115473857B (zh) * 2022-09-14 2023-12-15 北京奇艺世纪科技有限公司 一种资源分发方法、装置、系统、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012065549A1 (zh) * 2010-11-17 2012-05-24 中兴通讯股份有限公司 内容管理方法及系统
CN103078804A (zh) * 2012-12-28 2013-05-01 福建星网锐捷网络有限公司 等价多路径表处理方法、装置及网络设备
CN104202362A (zh) * 2014-08-14 2014-12-10 上海帝联信息科技股份有限公司 负载均衡系统及其内容分发方法和装置、负载均衡器
CN106502784A (zh) * 2016-09-28 2017-03-15 杭州电子科技大学 一种cdn网络内容评价模型及系统
CN110401657A (zh) * 2019-07-24 2019-11-01 网宿科技股份有限公司 一种访问日志的处理方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10091111B2 (en) * 2014-12-31 2018-10-02 Vidscale Services, Inc. Methods and systems for an end-to-end solution to deliver content in a network
CN106790324B (zh) * 2015-11-20 2020-06-16 华为技术有限公司 内容分发方法、虚拟服务器管理方法、云平台和系统
CN110290196B (zh) * 2019-06-20 2021-08-27 网宿科技股份有限公司 一种内容分发方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012065549A1 (zh) * 2010-11-17 2012-05-24 中兴通讯股份有限公司 内容管理方法及系统
CN103078804A (zh) * 2012-12-28 2013-05-01 福建星网锐捷网络有限公司 等价多路径表处理方法、装置及网络设备
CN104202362A (zh) * 2014-08-14 2014-12-10 上海帝联信息科技股份有限公司 负载均衡系统及其内容分发方法和装置、负载均衡器
CN106502784A (zh) * 2016-09-28 2017-03-15 杭州电子科技大学 一种cdn网络内容评价模型及系统
CN110401657A (zh) * 2019-07-24 2019-11-01 网宿科技股份有限公司 一种访问日志的处理方法及装置

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113676514A (zh) * 2021-07-19 2021-11-19 北京奇艺世纪科技有限公司 一种文件回源方法及装置
CN113873302A (zh) * 2021-09-29 2021-12-31 北京金山云网络技术有限公司 内容分发方法、装置、存储介质和电子设备
CN113873302B (zh) * 2021-09-29 2024-04-26 北京金山云网络技术有限公司 内容分发方法、装置、存储介质和电子设备
CN114006915A (zh) * 2022-01-04 2022-02-01 北京金山云网络技术有限公司 资源请求方法、装置、设备及计算机可读存储介质
CN114025023A (zh) * 2022-01-04 2022-02-08 北京金山云网络技术有限公司 回源方法、装置、设备及计算机可读存储介质
CN114025023B (zh) * 2022-01-04 2022-05-10 北京金山云网络技术有限公司 回源方法、装置、设备及计算机可读存储介质
CN114501053A (zh) * 2022-02-07 2022-05-13 上海哔哩哔哩科技有限公司 直播流获取方法及装置
CN114501053B (zh) * 2022-02-07 2023-10-20 上海哔哩哔哩科技有限公司 直播流获取方法及装置
CN114900562A (zh) * 2022-05-09 2022-08-12 北京百度网讯科技有限公司 一种资源获取方法、装置、电子设备和存储介质
CN115022177A (zh) * 2022-06-08 2022-09-06 阿里巴巴(中国)有限公司 Cdn系统、回源方法、cdn节点及存储介质
CN115022177B (zh) * 2022-06-08 2023-10-24 阿里巴巴(中国)有限公司 Cdn系统、回源方法、cdn节点及存储介质
CN116090803A (zh) * 2023-04-13 2023-05-09 北京徐工汉云技术有限公司 矿车调度方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN113132443B (zh) 2022-06-07
CN113132443A (zh) 2021-07-16

Similar Documents

Publication Publication Date Title
WO2021135835A1 (zh) 资源获取方法、装置及cdn网络中的节点设备
WO2019165665A1 (zh) 一种域名解析方法、服务器及系统
US20180205697A1 (en) Managing content delivery network service providers by a content broker
JP5893034B2 (ja) ネットワーク環境における要求ルーティング
US9444759B2 (en) Service provider registration by a content broker
US7991910B2 (en) Updating routing information based on client location
US20110289126A1 (en) Content delivery network
US11778068B2 (en) Systems and methods for processing requests for content of a content distribution network
WO2010057192A1 (en) Request routing and updating routing information utilizing client location information
JP2011519447A (ja) キャッシュを最適化するための方法とシステム
US11805093B2 (en) Systems and methods for processing requests for content of a content distribution network
CN113497817A (zh) 流量调度方法、装置、cdn网络的边缘节点及服务器
CN105337786A (zh) 一种服务器性能检测方法、装置及设备
CN111367672A (zh) 数据缓存方法、装置、电子设备及计算机存储介质
CN116405460A (zh) 用于内容分发网络的域名解析方法、装置、电子设备及存储介质
CN115297085B (zh) 一种域名解析的更新方法、装置、电子设备及存储介质
CN113411364B (zh) 资源获取方法、装置及服务器
WO2020199029A1 (zh) 一种数据处理方法及其装置
US20160085830A1 (en) Reputation-based discovery of content objects
US20150154610A1 (en) Detecting potentially false business listings based on an anomaly detection threshold
CN114996241A (zh) 存储方法、迁移方法、下载方法、存储系统、电子设备、以及介质
KR20200140650A (ko) 계층화된 블록체인을 이용한 도메인 네임 제공 시스템

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

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

Country of ref document: EP

Kind code of ref document: A1