Patent Description:
In recent years, as the Internet rapidly develops, a user imposes an increasingly high requirement on a delay of accessing an origin-server site by a terminal device. To improve access experience of the user, an operator establishes a content delivery network (content delivery network, CDN) for acceleration.

However, in the conventional technology, scheduling of the content delivery network has a scheduling deviation problem, resulting in a longer access delay. <NPL>] discloses working with multiple CDN and content providers to ensure performance when delivering those services, for example by providing Client Subnet EDNS0 option information. <NPL>] discloses that if a DoHPE client does not include an edns-client-subnet EDNS0 option with SOURCE PREFIX-LENGTH set to <NUM> in a query, the DNS server may potentially leak client address information to the upstream authoritative DNS servers. <NPL>] introduces a way to tunnel DNS data over HTTP. <NPL>] discloses an Extension Mechanisms for DNS (EDNS0) option that is in active use to carry information about the network that originated a DNS query and the network for which the subsequent response can be cached.

To resolve the foregoing problem, this application provides a domain name query method and a related device, to avoid a scheduling deviation and schedule a terminal device to a truly optimal edge cache node.

According to a first aspect, a domain name query method is provided, including:.

An HTTPDNS server receives an HTTP request packet sent by a terminal device, where the HTTP request packet carries a to-be-accessed domain name and scheduling information of the terminal device;.

In some possible designs, that the HTTPDNS server constructs a DNS query packet based on the HTTP request packet includes:
The HTTPDNS server sets the scheduling information in a resource data field of the DNS query packet.

Further, the scheduling information of the HTTP request packet and the DNS query packet includes a geographical location of the terminal device, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from a plurality of edge cache nodes of the to-be-accessed domain name and that corresponds to the geographical location of the terminal device.

In some possible designs, the scheduling information of the HTTP request packet and the DNS query packet further includes information about an operator to which the terminal device belongs, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from the plurality of edge cache nodes of the to-be-accessed domain name and that is nearest to the geographical location among sites provided by the operator.

According to a second aspect, a domain name query method is provided, including:.

In some possible designs, the scheduling information is set in a resource data field of the DNS query packet.

Further, the scheduling information includes a geographical location of a terminal device, and
the authoritative domain name server selects an edge cache node nearest to the geographical location from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location.

In some possible designs, the scheduling information further includes information about an operator to which the terminal device belongs, and
the authoritative domain name server selects an edge cache node, nearest to the geographical location among edge cache nodes provided by the operator, from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location and the information about the operator.

According to a third aspect, an HTTPDNS server is provided, including a receiving module, a constructing module, and a sending module.

The receiving module is configured to receive an HTTP request packet sent by a terminal device, and the HTTP request packet carries a to-be-accessed domain name and scheduling information of the terminal device.

The constructing module is configured to construct a DNS query packet based on the HTTP request packet.

The sending module is configured to send the DNS query packet to an authoritative domain name server, and the DNS query packet carries the to-be-accessed domain name and the scheduling information.

The receiving module is configured to receive a DNS reply packet sent by the authoritative domain name server. The DNS reply packet carries an IP address of a to-be-accessed site, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from a plurality of edge cache nodes of the to-be-accessed domain name and that corresponds to the scheduling information.

The constructing module is configured to construct an HTTP reply packet based on the DNS reply packet.

The sending module is configured to send the HTTP reply packet to the terminal device, and the HTTP reply packet carries the IP address of the to-be-accessed site.

In some possible designs, the constructing module is configured to set the scheduling information in a resource data field of the DNS query packet.

Further, the scheduling information of the HTTP request packet and the DNS query packet includes a geographical location of the terminal device, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from the plurality of edge cache nodes of the to-be-accessed domain name and that corresponds to the geographical location of the terminal device.

According to a fourth aspect, an authoritative domain name server is provided, including a receiving module, a selection module, and a sending module.

The receiving module is configured to receive a DNS query packet sent by an HTTPDNS server, and the DNS query packet carries a to-be-accessed domain name and scheduling information.

The selection module is configured to select, based on the scheduling information, an edge cache node corresponding to the scheduling information from a plurality of edge cache nodes of the to-be-accessed domain name as a to-be-accessed site.

The sending module is configured to send a DNS reply packet to the HTTPDNS server, and the DNS reply packet carries an IP address of the to-be-accessed site.

Further, the scheduling information includes a geographical location of a terminal device.

The selection module is configured to select an edge cache node nearest to the geographical location from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location.

In some possible designs, the scheduling information further includes information about an operator to which the terminal device belongs.

The selection module is configured to select an edge cache node, nearest to the geographical location among edge cache nodes provided by the operator, from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location and the information about the operator.

According to a fifth aspect, a server is provided, including a memory and a processor. The processor executes a program in the memory to run a computing service and a storage service, to perform the method according to either the first aspect or the second aspect.

According to a sixth aspect, a readable storage medium is provided, including instructions. When the instructions are run on a server, the server is enabled to perform the method according to either the first aspect or the second aspect.

According to a seventh aspect, a computer program product is provided. When the computer program product is read and executed by a computer, the method according to either the first aspect or the second aspect is to be performed.

In the foregoing solution, the terminal device adds the geographical location to the HTTP request packet, and sends the HTTP request packet to the HTTPDNS server. Then, the HTTPDNS server adds the geographical location to the DNS query packet, and sends the DNS query packet to the authoritative domain name server. The authoritative domain name server selects the edge cache node nearest to the geographical location from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location, and enables the terminal device to access the to-be-accessed site. The geographical location is a real geographical location of the terminal device. Therefore, when the authoritative domain name server performs scheduling based on the geographical location, no scheduling deviation occurs, and the terminal device can be scheduled to a truly optimal edge cache node.

To describe the technical solutions in embodiments of this application or in the background more clearly, the following describes the accompanying drawings used to describe the embodiments of this application or the background.

<FIG> is a schematic diagram of a structure of a delivery system according to this application. As shown in <FIG>, the delivery system includes an origin-server node <NUM>, a content delivery network (content delivery network, CDN) <NUM>, and terminal devices <NUM>. The CDN includes central cache nodes <NUM> and edge cache nodes <NUM>.

The terminal device <NUM> is usually a device having a network communication function, and is configured to be used by a user to access content data of the origin-server node <NUM>. The terminal device may be a computer, a network computer, a tablet computer, a network computer, a desktop computer, a thin terminal, a cloud terminal, a dumb terminal, or the like. Alternatively, the terminal device may be a smartphone, a smart home device, a vehicle-mounted device, a wearable device, or the like that uses the IPv4 or IPv6 protocol in the Internet protocol. The wearable device may also be referred to as a wearable intelligent device, and is a general term for wearable devices such as glasses, gloves, watches, clothes, and shoes that are developed by applying wearable technologies to intelligent designs of daily wear. The wearable device is a portable device that is directly worn on a body or integrated into clothes or an accessory of a user. The wearable device is not only a hardware device, but also implements a powerful function through software support, data exchange, and cloud interaction. Generalized wearable intelligent devices include full-featured and large-size devices that can implement complete or partial functions without depending on smartphones, for example, smartwatches or smart glasses, and devices that focus on only one type of application function and need to work with other devices such as smartphones, for example, various smart bands or smart jewelry for monitoring physical signs.

The origin-server node <NUM> is usually disposed in a data center far from the terminal device <NUM>, and is configured to store a large amount of content data. For example, the origin-server node <NUM> may be a node of a website that provides watching or downloading of an entertainment video, a sports video, a news video, a movie, or another video, may be a node of a website that provides audio playing of music, a book, or the like, or may be a node of a website that provides text reading of news, an article, a book, or the like. This is not specifically limited herein.

The central cache node <NUM> is an upper-level node of the edge cache node <NUM>, and the central cache node <NUM> is also a lower-level node of the origin-server node <NUM>. In other words, the central cache node <NUM> may serve as a link between the origin-server node <NUM> and the edge cache node <NUM>.

The edge cache node <NUM> may also be referred to as a surrogate (surrogate), is only "single hop" (single hop) away from the terminal device <NUM>, and is configured to cache content data delivered by the origin-server node <NUM> to the edge cache node <NUM>, so as to implement nearby access of the terminal device <NUM>. Specifically, the edge cache node <NUM> stores an image of the origin-server node <NUM>, and the edge cache node <NUM> is usually disposed on a network edge. In this way, the edge cache node <NUM> may provide content data to the terminal device <NUM> instead of the origin-server node <NUM>, to implement edge storage and propagation of the content data, resolve a network congestion situation, and improve a response speed of accessing the origin-server node <NUM> by the terminal device <NUM>.

The following separately describes in detail principles of disposing the origin-server node <NUM>, the central cache node <NUM>, the edge cache node <NUM>, and the terminal device <NUM>.

The origin-server node <NUM> may be independently disposed in a single server, or may be disposed in a data center. When the origin-server node <NUM> is disposed in a single server, the server may be disposed in any area in the world. When the origin-server node <NUM> is disposed in a data center, the origin-server node <NUM> may be disposed in an area with sufficient power supply, a low land price, and a relatively good cooling condition. Certainly, when factors such as costs are not considered, the origin-server node <NUM> may also be disposed in any area in the world.

The central cache node <NUM> may be independently disposed in a single server, or may be disposed in a data center. When the central cache node <NUM> is disposed in a single server, the server may be disposed in any area in the world. When the central cache node <NUM> is disposed in a data center, the central cache node <NUM> may be disposed in an area with sufficient power supply, a low land price, and a relatively good cooling condition. Certainly, when factors such as costs are not considered, the central cache node <NUM> may also be disposed in any area in the world.

The edge cache nodes <NUM> may be separately disposed in a plurality of different areas. For example, an edge cache node <NUM> may be disposed in South China, an edge cache node <NUM> is disposed in Central China, an edge cache node <NUM> is disposed in West China, an edge cache node <NUM> is disposed in North China, an edge cache node <NUM> is disposed in East China, and the like. This is not specifically limited herein.

The terminal devices <NUM> may be separately disposed in a plurality of different regions. For example, a terminal device <NUM> may be disposed in South China, a terminal device <NUM> is disposed in Central China, a terminal device <NUM> is disposed in West China, a terminal device <NUM> is disposed in North China, a terminal device <NUM> is disposed in East China, and the like. This is not specifically limited herein.

In other words, the edge cache node <NUM> is located in South China, and the terminal device <NUM> is located in South China. Therefore, the terminal device <NUM> and the edge cache node <NUM> are located in a same area, and are nearest. The edge cache node <NUM> is located in Central China, and the terminal device <NUM> is located in South China. Therefore, the terminal device <NUM> and the edge cache node <NUM> are located in a same area, and are nearest. The edge cache node <NUM> is located in West China, and the terminal device <NUM> is located in South China. Therefore, the terminal device <NUM> and the edge cache node <NUM> are located in a same area, and are nearest. The edge cache node <NUM> is located in North China, and the terminal device <NUM> is located in South China. Therefore, the terminal device <NUM> and the edge cache node <NUM> are located in a same area, and are nearest. The edge cache node <NUM> is located in East China, and the terminal device <NUM> is located in South China. Therefore, the terminal device <NUM> and the edge cache node <NUM> are located in a same area, and are nearest.

To ensure that the terminal device <NUM> can obtain the content data of the origin-server node <NUM> as soon as possible, the content data of the origin-server node <NUM> may be separately sent to each edge cache node <NUM> in advance through the central cache node <NUM>. Then, when the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> is scheduled to an edge cache node <NUM> "nearest" to the terminal device <NUM>. Then, the edge cache node <NUM> "nearest" to the terminal device <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>. For example, the origin-server node <NUM> may separately send the content data to edge ecaches1 to <NUM> in advance through the central cache node <NUM>. When the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> and the edge cache node <NUM> are nearest. Therefore, the terminal device <NUM> may be scheduled to the edge cache node <NUM> "nearest" to the terminal device <NUM>, and the edge cache node <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>. When the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> and the edge cache node <NUM> are nearest. Therefore, the terminal device <NUM> may be scheduled to the edge cache node <NUM> "nearest" to the terminal device <NUM>, and the edge cache node <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>. When the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> and the edge cache node <NUM> are nearest. Therefore, the terminal device <NUM> may be scheduled to the edge cache node <NUM> "nearest" to the terminal device <NUM>, and the edge cache node <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>. When the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> and the edge cache node <NUM> are nearest. Therefore, the terminal device <NUM> may be scheduled to the edge cache node <NUM> "nearest" to the terminal device <NUM>, and the edge cache node <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>. When the terminal device <NUM> requests the content data from the origin-server node <NUM>, the terminal device <NUM> and the edge cache node <NUM> are nearest. Therefore, the terminal device <NUM> may be scheduled to the edge cache node <NUM> "nearest" to the terminal device <NUM>, and the edge cache node <NUM> sends the content data to the terminal device <NUM> instead of the origin-server node <NUM>.

It can be learned that the CDN is used in the delivery system to accelerate the origin-server node. In another embodiment, a quantity of origin-server nodes is not limited to <NUM>, and may be another positive integer, a quantity of central cache nodes is not limited only to <NUM>, and may be another positive integer, and a quantity of the edge cache nodes is also not limited to <NUM>, and may be another positive integer. This is not specifically limited herein.

<FIG> is a schematic diagram of a structure of a transmission network according to this application. As shown in <FIG>, the transmission network includes an origin-server node <NUM>, a CDN <NUM>, a terminal device <NUM>, and a domain name system (Domain Name System, DNS) <NUM>. The origin-server site <NUM> is connected to the CDN <NUM>, the CDN <NUM> is connected to the terminal device <NUM>, and the terminal device <NUM> is connected to the DNS <NUM>.

The origin-server site <NUM>, the CDN <NUM>, and the terminal device <NUM> are respectively similar to the origin-server node <NUM>, the CDN <NUM>, and the terminal device <NUM> shown in <FIG>. For details, refer to the foregoing descriptions.

The DNS <NUM> is configured to perform domain name resolution, that is, resolve a domain name into a network address. The domain name is a name, including a string of characters separated by a dot, of a terminal device on the Internet, and is used to identify an electronic orientation of the terminal device during data transmission. The domain name may include a top-level domain name, a second-level domain name, a host name, or the like. For example, the domain name may be "www. In this case, the top-level domain name may be ". com", the second-level domain name may be ". xxxxx", and the host name is "www", or the like. The network address is a logical address allocated to an origin-server node on the Internet, to shield a difference in physical addresses. The network address may include an IPv4 address and an IPv6 address. For example, the IPv4 address may be "<NUM>. xxx", and the IPv6 address may be "<NUM>:DB8:<NUM>:<NUM>:<NUM>:xxxx:xxxx:xxxx". It may be understood that a user is used to memorizing the domain name, but the terminal device can identify only the network address. Therefore, a one-to-one correspondence needs to be made between the domain name and the network address, so that a domain name input by the user can be converted into a network address that can be identified by the terminal device, to reduce a burden of memorizing an address of the origin-server node by the user.

The DNS <NUM> includes a local domain name server <NUM>, a root name server (root name server) <NUM>, a top-level domain name server <NUM>, and an authoritative domain name server <NUM>. The local domain name server <NUM> is separately connected to the root name server <NUM>, the top-level domain name server <NUM>, and the authoritative domain name server <NUM>. The local domain name server <NUM> may be referred to as a recursive DNS server and a default domain name server, and is configured to cache a correspondence between some domain names and some network addresses (which are accessed before). In addition, a network address of each root name server <NUM> is set inside the local domain name server <NUM>. The root name server <NUM> stores a correspondence between all the top-level domain names and the domain name servers. In an IPv4 system, there are totally only <NUM> root name servers <NUM> in the world, which are one primary root name server and <NUM> secondary root name servers. In an IPv6 system, <NUM> root name servers <NUM> are already disposed in the world, which are three primary root name servers and <NUM> secondary root name servers. Usually, the root name server <NUM> is disposed away from the terminal device <NUM>. The top-level domain name server <NUM> stores a network address of the authoritative domain name server <NUM> subordinate to the top-level domain name server <NUM>. The authoritative domain name server <NUM> stores a mapping relationship between the domain name and the network address.

The terminal device <NUM> receives a domain name, entered and expected to be accessed by the user, of the origin-server node <NUM>, and then invokes a domain name resolution library to map the domain name, to obtain a canonical name (CNAME) record of the domain name in the CDN. The terminal device <NUM> first checks whether the terminal device <NUM> locally caches a mapping relationship between the canonical name record and a network address corresponding to the canonical name record. If the terminal device <NUM> does not cache the mapping relationship between the canonical name record and the network address corresponding to the canonical name record, the terminal device <NUM> sends a first query request to the local domain name server <NUM>. The first query request is used to query the network address corresponding to the canonical name record, and the first query request carries the canonical name record and a network address of the terminal device <NUM>. The local domain name server <NUM> locally queries whether the mapping relationship between the local domain name and the network address corresponding to the canonical name record is cached, and if the mapping relationship between the canonical name record and the network address corresponding to the canonical name record is not cached, the local domain name server <NUM> sends a second query request to the root name server <NUM>. The second query request is used to query the network address corresponding to the canonical name record, and the second query request carries the canonical name record and a network address of the local domain name server. The root name server <NUM> determines a network address of a corresponding top-level domain name server <NUM> based on a top-level domain name in the canonical name record in the second query request, and sends the network address of the top-level domain name server <NUM> to the local domain name server <NUM>. The local domain name server <NUM> sends the second query request to the top-level domain name server <NUM> based on the network address of the top-level domain name server <NUM>. If the top-level domain name server finds that the second query request cannot be processed, the top-level domain name server sends the network address of the authoritative domain name server <NUM> subordinate to the top-level domain name server to the local domain name server <NUM>. The local domain name server <NUM> sends the second query request to the authoritative domain name server <NUM> based on the network address of the authoritative domain name server <NUM>. The authoritative domain name server <NUM> locally queries whether a mapping relationship between the canonical name record and network addresses of a plurality of edge cache nodes corresponding to the canonical name record is stored; if the mapping relationship between the canonical name record and the network addresses of the plurality of edge cache nodes corresponding to the canonical name record is stored, selects, from the network addresses of the plurality of edge cache nodes based on the network address of the local domain name server <NUM> carried in the second query request, a network address of an edge cache node that is nearest to the network address of the local domain name server <NUM>; and sends the network address of the edge cache node to the local domain name server <NUM>. The local domain name server <NUM> sends the network address that corresponds to the canonical name record and that is of the nearest edge cache node to the terminal device <NUM>. The terminal device <NUM> establishes a connection between the terminal device <NUM> and the edge cache node based on the network address of the edge cache node, so that the edge cache node can provide content data to the terminal device <NUM> instead of the origin-server node <NUM>.

All network addresses of edge cache nodes queried by the authoritative domain name server need to be sent to the local domain name server. Therefore, the network address in the query request sent by the local domain name server to the authoritative domain name server needs to be the network address of the local domain name server instead of the terminal device <NUM>. When the authoritative domain name server <NUM> performs scheduling, that is, selects a network address of an optimal edge cache node from the network addresses of the plurality of edge cache nodes, only the network address of the local domain name server <NUM> can be used. Therefore, a scheduling deviation may occur, and the terminal device <NUM> cannot be scheduled to a truly optimal edge cache node.

In the foregoing example, an application scenario of the CDN is used as an example for description. However, in actual application, the transmission network may further be applicable to a cross-region application scenario or an application scenario deployed by an operator. This is not specifically limited herein.

This application provides a domain name query method and a related device, to avoid a scheduling deviation and schedule a terminal device to a truly optimal edge cache node.

<FIG> is a schematic diagram of a structure of a domain name query system according to this application. The domain name query system in this implementation includes an origin-server node <NUM>, a CDN <NUM>, a terminal device <NUM>, a hypertext transfer protocol domain name system (HyperText Transfer Protocol Domain Name System, HTTPDNS) server <NUM>, and an authoritative server <NUM>. The origin-server site <NUM> is connected to the CDN <NUM>, the CDN <NUM> is connected to the terminal device <NUM>, and the terminal device <NUM> is connected to the DNS <NUM>. The DNS <NUM> includes an HTTPDNS server <NUM>, a root name server <NUM>, a top-level domain name server <NUM>, and an authoritative domain name server <NUM>.

<FIG> is an interaction flowchart of a domain name query method according to this application. The following describes the domain name query method in this implementation in detail with reference to the domain name query system shown in <FIG>. The domain name query method in this implementation includes the following steps.

S101: A terminal device sends a hypertext transfer protocol (HyperText Transfer Protocol, HTTP) request packet to an HTTPDNS server. Correspondingly, the HTTPDNS server receives the HTTP request packet sent by the terminal device.

In a specific implementation of this application, the HTTP request packet carries a to-be-accessed domain name and scheduling information of the terminal device. The scheduling information may be a geographical location, a combination of a geographical location and information about an operator, or the like. This is not specifically limited herein. The geographical location may be longitude and latitude, an administrative area, a street, or the like. This is not specifically limited herein.

In a specific implementation of this application, as shown in <FIG>, the HTTP request packet may include a request line (request line), a request header (header), an empty line, and request data. The request line includes a request method field, a URL field, and an HTTP protocol version field. The request header includes a keyword/value pair. Each line includes one pair. A keyword and a value are separated by using an English colon ":", and is used to notify the server of information about a client request. The blank line follows the last request header, may be a carriage return character or a newline character, and is used to notify the server that there is no request header anymore in the following. The request data may be used to carry the to-be-accessed domain name and the scheduling information of the terminal device. In a specific embodiment, the request data may include a domain (domain) name field and a scheduling (geo) field. The domain name field is used to carry the to-be-accessed domain name, and the scheduling field is used to carry the scheduling information of the terminal device.

In a specific implementation of this application, the terminal device <NUM> receives a to-be-accessed domain name, entered and expected to be accessed by a user, of the origin-server node <NUM>, and then invokes a domain name resolution library to map the to-be-accessed domain name, to obtain a canonical name (CNAME) record of the to-be-accessed domain name in the CDN. The terminal device <NUM> first checks whether the terminal device <NUM> locally caches a mapping relationship between the canonical name record and a network address corresponding to the canonical name record. If the terminal device <NUM> does not store the mapping relationship between the canonical name record and the network address corresponding to the canonical name record, the terminal device <NUM> sends the HTTP request packet to the HTTPDNS server <NUM>.

S102: The HTTPDNS server constructs a DNS query packet based on the HTTP request packet.

In a specific implementation of this application, the DNS query packet carries the to-be-accessed domain name and the scheduling information of the terminal device.

In a specific implementation of this application, as shown in <FIG>, the DNS query packet may include a packet header, a query question, an answer, an authorization, and additional information. The packet header is used to describe a quantity of resource records of the answer, a quantity of resource records of the authorization, a quantity of resource records of the additional information, and the like.

In a specific implementation of this application, as shown in <FIG>, the additional information may include a variable-length or <NUM>-byte domain name, a <NUM>-byte type, a <NUM>-byte class, <NUM>-byte time to live, a <NUM>-byte resource length, and variable-length resource data. The domain name is used to carry the to-be-accessed domain name, and the query type is querying an IP address by using the to-be-accessed domain name, or querying the to-be-accessed domain name by using an IP address. The query class being <NUM> usually refers to Internet data. The time to live is an IP address obtained through query, or valid time of the to-be-accessed domain name obtained through query. The resource length is a length of a related resource record. The resource data is data of a related resource record returned based on a query requirement.

In a specific implementation of this application, as shown in <FIG>, the resource data may include a <NUM>-byte selection code, a <NUM>-byte selection length, a <NUM>-byte scheduling type, and a variable-length numeric field. The selection code is used to identify a meaning of content stored in the resource data, the selection length is used to identify a length of a numeric field, and the scheduling type is used to describe a type of the scheduling information. For example, the scheduling type being <NUM> is a geographical location, the scheduling type being <NUM> is an operator, and the scheduling type being <NUM> is longitude and latitude. The numeric field is used to store detailed scheduling information.

In a specific implementation of this application, the HTTPDNS server <NUM> locally queries whether the mapping relationship between the canonical name record and the network address corresponding to the canonical name record is cached. If the mapping relationship between the canonical name record and the network address corresponding to the canonical name record is not cached, the HTTPDNS server <NUM> constructs the DNS query packet based on the HTTP request packet.

In a specific implementation of this application, the to-be-accessed domain name may be carried in a resource data field of the DNS query packet, and the scheduling information of the terminal device may be carried in the resource data field of the DNS query packet.

S103: The HTTPDNS server sends the DNS query packet to an authoritative domain name server. Correspondingly, the authoritative domain name server receives the DNS query packet sent by the HTTPDNS server.

In a specific implementation of this application, the HTTPDNS server <NUM> sends the DNS query packet to the root name server <NUM>. The root name server <NUM> determines a network address of a corresponding top-level domain name server <NUM> based on a top-level domain name in the canonical name record in the DNS query packet, and sends the network address of the top-level domain name server <NUM> to the HTTPDNS server <NUM>. The HTTPDNS server <NUM> sends the DNS query packet to the top-level domain name server <NUM> based on the network address of the top-level domain name server <NUM>. If the top-level domain name server <NUM> finds that the DNS query packet cannot be processed, the top-level domain name server <NUM> sends a network address of the authoritative domain name server <NUM> subordinate to the top-level domain name server <NUM> to the HTTPDNS server <NUM>. The HTTPDNS server <NUM> sends the DNS query packet to the authoritative domain name server <NUM> based on the network address of the authoritative domain name server <NUM>.

S104: The authoritative domain name server selects an optimal edge cache node from a plurality of edge cache nodes of the to-be-accessed domain name as a to-be-accessed site based on the scheduling information.

In a specific implementation of this application, the authoritative domain name server <NUM> locally queries whether a mapping relationship between the canonical name record and network addresses of the plurality of edge cache nodes corresponding to the canonical name record is stored; and if the mapping relationship between the canonical name record and the network addresses of the plurality of edge cache nodes corresponding to the canonical name record is stored, selects the optimal edge cache node from the network addresses of the plurality of edge cache nodes as the to-be-accessed site based on scheduling information of the terminal device <NUM> carried in the DNS query packet. In a specific embodiment, the authoritative domain name server <NUM> selects, from the network addresses of the plurality of edge cache nodes, an edge cache node nearest to a geographical location of the terminal device <NUM> as the to-be-accessed site based on the geographical location of the terminal device <NUM> carried in the DNS query packet. In another specific embodiment, the authoritative domain name server <NUM> selects, as the to-be-accessed site from the plurality of edge cache nodes of the to-be-accessed domain name based on the geographic location of the terminal device <NUM> and the information of the operator that are carried in the DNS query packet, an edge cache node nearest to the geographical location among edge cache nodes provided by the operator.

S105: The authoritative domain name server constructs a DNS reply packet based on an IP address of the to-be-accessed site.

S106: The authoritative domain name server sends the DNS reply packet to the HTTPDNS server. Correspondingly, the HTTPDNS server receives the DNS reply packet sent by the authoritative domain name server.

S107: The HTTPDNS server constructs an HTTP response packet based on the DNS reply packet.

S108: The HTTPDNS server sends the HTTP response packet to the terminal device. Correspondingly, the terminal device receives the HTTP response packet sent by the HTTPDNS server.

S109: The terminal device establishes a connection to the to-be-accessed site.

In a specific implementation of this application, the terminal device <NUM> establishes a connection between the terminal device <NUM> and the to-be-accessed site based on the network address, returned by the HTTPDNS response packet and corresponding to the canonical name record, of the to-be-accessed site, so that the to-be-accessed site can provide content data to the terminal device <NUM> instead of the origin-server node <NUM>.

<FIG> is a schematic diagram of a structure of an HTTPDNS server according to this application. The HTTPDNS server in this embodiment includes a receiving module <NUM>, a constructing module <NUM>, and a sending module <NUM>.

The receiving module <NUM> is configured to receive an HTTP request packet sent by a terminal device, and the HTTP request packet carries a to-be-accessed domain name and a geographical location of the terminal device.

The constructing module <NUM> is configured to construct a DNS query packet based on the HTTP request packet.

The sending module <NUM> is configured to send the DNS query packet to an authoritative domain name server, and the DNS query packet carries the to-be-accessed domain name and the scheduling information.

The receiving module <NUM> is configured to receive a DNS reply packet sent by the authoritative domain name server. The DNS reply packet carries an IP address of a to-be-accessed site, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from a plurality of edge cache nodes of the to-be-accessed domain name and that corresponds to the scheduling information.

The constructing module <NUM> is configured to construct an HTTP reply packet based on the DNS reply packet.

The sending module <NUM> is configured to send the HTTP reply packet to the terminal device, and the HTTP reply packet carries the IP address of the to-be-accessed site.

The HTTPDNS server shown in <FIG> can perform steps performed by the HTTPDNS server in the foregoing domain name query method. For details, refer to <FIG> and related descriptions.

<FIG> is a schematic diagram of a structure of an authoritative domain name server according to this application. The authoritative domain name server includes a receiving module <NUM>, a selection module <NUM>, and a sending module <NUM>.

The receiving module <NUM> is configured to receive a DNS query packet sent by an HTTPDNS server, and the DNS query packet carries a to-be-accessed domain name and scheduling information.

The selection module <NUM> is configured to select, based on the scheduling information, an edge cache node corresponding to the scheduling information from a plurality of edge cache nodes of the to-be-accessed domain name as a to-be-accessed site.

The sending module <NUM> is configured to send a DNS reply packet to the HTTPDNS server, and the DNS reply packet carries an IP address of the to-be-accessed site.

The authoritative domain name server shown in <FIG> can perform steps performed by the authoritative domain name server in the foregoing domain name query method. For details, refer to <FIG> and related descriptions.

This application further provides a domain name query system, including an origin-server node, a CDN, a terminal device, an HTTPDNS server, and an authoritative server. The origin-server site is connected to the CDN, the CDN is connected to the terminal device, and the terminal device is connected to a DNS. The DNS includes an HTTPDNS server, a root name server, a top-level domain name server, and an authoritative domain name server.

Refer to <FIG>. The HTTPDNS server may usually include a first processor <NUM>, a first memory <NUM>, an intelligent network interface card <NUM>, and a bus <NUM>.

The first processor <NUM> may be one or more general-purpose processors. The general-purpose processor may be any type of device capable of processing an electronic instruction, including a central processing unit (Central Processing Unit, CPU), a microprocessor, a microcontroller, a main processor, a controller, an application-specific integrated circuit (Application-Specific Integrated Circuit, ASIC), or the like. The first processor <NUM> executes various types of digital storage instructions, for example, software or firmware programs stored in the first memory <NUM>. In a specific embodiment, the first processor <NUM> may be an x86 processor or the like. The first processor <NUM> sends a command to the first memory <NUM> through a physical interface, to complete a storage-related task. For example, commands that may be provided by the first processor <NUM> include a read command, a write command, a copy command, an erase command, and the like. The command may specify an operation related to a specific page and block of the first memory <NUM>.

The first memory <NUM> may be a random access memory (Random Access Memory, RAM), a flash memory (Flash Memory), or the like, or may be a RAM, a read-only memory (Read-Only Memory, ROM), a hard disk drive (Hard Disk Drive, HDD), or a solid-state drive (Solid-State Drive, SSD).

The intelligent network interface card <NUM> is also referred to as a network interface controller, a network interface card, or a local area network (Local Area Network, LAN) adapter. Each intelligent network interface card <NUM> has a unique MAC address, which is burned into a read-only memory chip by a manufacturer of the intelligent network interface card <NUM> during production. The intelligent network interface card <NUM> includes a second processor <NUM>, a second memory <NUM>, and a transceiver <NUM>. The second processor <NUM> is similar to the first processor <NUM>, but a performance requirement of the second processor <NUM> may be lower than a performance requirement of the first processor <NUM>. In a specific embodiment, the second processor <NUM> may be an ARM processor or the like. The second memory <NUM> may also be a flash memory, an HDD, or an SDD, and a storage capacity of the second memory <NUM> may be less than a storage capacity of the first memory <NUM>. The transceiver <NUM> may be configured to: receive and send packets, and upload the received packet to the second processor <NUM> for processing. The intelligent network interface card <NUM> may further include a plurality of ports, and the port may be any one or more of three types of interfaces: a thick-cable interface, a thin-cable interface, and a twisted pair interface.

The first processor <NUM> runs program code in the first memory <NUM>, to perform the following steps.

The intelligent network interface card <NUM> is configured to receive an HTTP request packet sent by a terminal device. The HTTP request packet carries a to-be-accessed domain name and scheduling information of the terminal device.

The first processor <NUM> is configured to construct a DNS query packet based on the HTTP request packet, and sends the DNS query packet to an authoritative domain name server. The DNS query packet carries the to-be-accessed domain name and the scheduling information.

The intelligent network interface card <NUM> is configured to receive a DNS reply packet sent by the authoritative domain name server. The DNS reply packet carries an IP address of a to-be-accessed site, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from a plurality of sites of the to-be-accessed domain name and that corresponds to the scheduling information.

The first processor <NUM> is configured to construct an HTTP reply packet based on the DNS reply packet, and sends the HTTP reply packet to the terminal device. The HTTP reply packet carries the IP address of the to-be-accessed site.

Refer to <FIG>. The authoritative domain name server may usually include a first processor <NUM>, a first memory <NUM>, an intelligent network interface card <NUM>, and a bus <NUM>.

The first processor <NUM> may be one or more general-purpose processors. The general-purpose processor may be any type of device capable of processing an electronic instruction, including a central processing unit (Central Processing Unit, CPU), a microprocessor, a microcontroller, a main processor, a controller, an application-specific integrated circuit (Application-Specific Integrated Circuit, ASIC), or the like. The first processor <NUM> executes various types of digital storage instructions, for example, software or firmware programs stored in the first memory <NUM>. In a specific embodiment, the first processor <NUM> may be an x86 processor or the like. The first processor <NUM> sends a command to the first memory <NUM> through a physical interface, to complete a storage-related task. For example, commands that may be provided by the first processor <NUM> include a read command, a write command, a copy command, an erase command, and the like. The command may specify an operation related to a specific page and block of the first memory <NUM>. In an example, a command may request to write data to a specific physical page, or another command may request to erase a specific physical block. A plurality of virtual machines may be virtualized in the first processor <NUM>, and a corresponding operating system may be installed on each virtual machine.

The first processor <NUM> runs program code in the first memory, to perform the following steps.

The intelligent network interface card <NUM> is configured to receive a DNS query packet sent by an HTTPDNS server, where the DNS query packet carries a to-be-accessed domain name and scheduling information.

The first processor <NUM> is configured to select, based on the scheduling information, an edge cache node corresponding to the scheduling information from a plurality of edge cache nodes of the to-be-accessed domain name as a to-be-accessed site.

The intelligent network interface card <NUM> is configured to send a DNS reply packet to the HTTPDNS server, where the DNS reply packet carries an IP address of the to-be-accessed site.

In the foregoing solution, the terminal device adds the geographical location to the HTTP request packet, and sends the HTTP request packet to the HTTPDNS server. Then, the HTTPDNS server adds the geographical location to the DNS query packet, and sends the DNS query packet to the authoritative domain name server. The authoritative domain name server selects the edge cache node nearest to the geographical location from the plurality of edge cache nodes of the to-be-accessed domain name as the to-be-accessed site based on the geographical location, and enables the terminal device to access the to-be-accessed site. The geographical location is a real geographical location of the terminal device. Therefore, when the authoritative domain name server performs scheduling based on the geographical location, no scheduling deviation occurs, and the terminal device can be scheduled to the truly optimal edge cache node.

Claim 1:
A domain name query method, comprising:
receiving (<NUM>), by a hypertext transfer protocol domain name system, HTTPDNS, server, a hypertext transfer protocol, HTTP, request packet sent by a terminal device, wherein the HTTP request packet carries a to-be-accessed domain name and scheduling information of the terminal device;
constructing (<NUM>), by the HTTPDNS server, a domain name system, DNS, query packet based on the HTTP request packet, and sending the DNS query packet to an authoritative domain name server, wherein the DNS query packet carries the to-be-accessed domain name and the scheduling information;
receiving (<NUM>), by the HTTPDNS server, a DNS reply packet sent by the authoritative domain name server, wherein the DNS reply packet carries an IP address of a to-be-accessed site, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from a plurality of sites of the to-be-accessed domain name and that corresponds to the scheduling information; and
constructing (<NUM>), by the HTTPDNS server, an HTTP reply packet based on the DNS reply packet, and sending the HTTP reply packet to the terminal device, wherein the HTTP reply packet carries the IP address of the to-be-accessed site,
wherein the scheduling information of the HTTP request packet and the DNS query packet comprises a geographical location of the terminal device, and the to-be-accessed site is an edge cache node that is selected by the authoritative domain name server from the plurality of edge cache nodes of the to-be-accessed domain name and that corresponds to the geographical location of the terminal device,
characterized by the geographical location comprising one of the following: longitude and latitude, an administrative area, a street.