Domain name resolution method, system, device and medium
By introducing a multi-level shared cache module into the domain name resolution system, priority is given to the client's domain name resolution request, the problem of excessive load on the public network server under high concurrent requests in the existing technology is solved, and more efficient domain name resolution and better user experience is achieved.
Patent Information
- Application Number
- CN202411763954.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-28
AI Technical Summary
The existing domain name resolution method cannot effectively respond to high concurrent requests, resulting in high load pressure on the public domain name resolution server, tight system resources, reduced query efficiency, and affecting user experience.
The multi-level shared cache module is adopted. The client sends domain name resolution requests to the multi-level shared cache module. If there is a cache result, it will be returned. Otherwise, it will be forwarded to the public domain name resolution server for iterative query, reducing the pressure on the public server and improving the cache hit rate.
Through multi-level shared cache, domain name resolution requests are preferred, so as to reduce dependence on public network servers, reduce system resource consumption, and improve query efficiency and user experience.
Smart Images

Figure CN119728640A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of domain name resolution, and in particular to a domain name resolution method, a domain name resolution system, an electronic device and a computer-readable storage medium. Background Art
[0002] With the development of the Internet, more and more computers and network devices need to communicate through the network. In order to facilitate users' memory and use, the Domain Name System (DNS) was introduced. DNS maps complex IP addresses to easy-to-remember domain names, making it easier for users to access Internet resources.
[0003] The existing domain name resolution method usually requires the client to send a request to a public network server to obtain the domain name resolution result. The public network domain name resolution server may face huge load pressure, and the existing method is based on the system memory to directly store the correspondence between the domain name and the IP address, which consumes a large amount of system memory to store tens of thousands of domain name data, occupies a large amount of system memory, and causes system resource tension. In addition, as the cached data increases, the query efficiency will gradually decrease, seriously affecting the user experience. Summary of the invention
[0004] The embodiments of the present invention provide a domain name resolution method, system, device and medium to solve or partially solve the problem that the existing domain name resolution method cannot effectively cope with high concurrent requests.
[0005] The embodiment of the present invention discloses a domain name resolution method, which is applied to a domain name resolution system. The system includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module. The method includes:
[0006] Sending a domain name resolution request to the multi-level shared cache module through the client;
[0007] Receiving the domain name resolution request through the multi-level shared cache module, and querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request;
[0008] If the domain name resolution result corresponding to the domain name resolution request exists in the multi-level shared cache module, the domain name resolution result is sent to the client through the multi-level shared cache module;
[0009] If the multi-level shared cache module does not have the domain name resolution result corresponding to the domain name resolution request, the multi-level shared cache module sends the domain name resolution request to the public network domain name resolution server for iterative query, obtains the domain name resolution result of the domain name resolution request, and sends the domain name resolution result to the client.
[0010] In some feasible implementations, the multi-level shared cache module includes at least a tenant domain name module, a shared domain name module, a first-level cache module, and a recursive module, the recursive module includes at least a second-level cache submodule and an iterative query submodule, and querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request includes:
[0011] The domain name resolution request is received through the tenant domain name module, and whether the domain name information corresponding to the domain name resolution request is found in the tenant domain name module, if so, a domain name resolution result including the domain name information is returned to the client, if not, the domain name resolution request is forwarded to the shared domain name module;
[0012] The shared domain name module receives the domain name resolution request, and searches the shared domain name module for domain name information corresponding to the domain name resolution request; if yes, returns a domain name resolution result including the domain name information to the client; if no, forwards the domain name resolution request to the primary cache module;
[0013] The first-level cache module receives the domain name resolution request and searches for domain name information corresponding to the domain name resolution request. If yes, the domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the second-level cache submodule.
[0014] The secondary cache submodule receives the domain name resolution request and checks whether there is domain name information corresponding to the domain name resolution request. If yes, a domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is sent to the iterative query submodule.
[0015] The domain name resolution request is received through the iterative query submodule, and the domain name resolution request is sent to the public network domain name resolution server for iterative query to obtain the domain name resolution result of the domain name resolution request.
[0016] In some feasible implementations, the first-level cache module includes at least a record set and a negative cache, and the method further includes:
[0017] Sending the domain name resolution result to the first-level cache through the second-level cache submodule;
[0018] Receiving the domain name resolution result sent by the secondary cache submodule through the primary cache module, and analyzing the domain name resolution result;
[0019] If the domain name resolution result is an abnormal response, the domain name resolution result is stored in the negative cache, and the first expiration time of the domain name resolution result is recorded;
[0020] If the domain name resolution result is the public domain name information corresponding to the domain name resolution request, the public domain name information is stored through the record set, and the second lifetime of the public domain name information is recorded.
[0021] In some feasible implementations, receiving the domain name resolution request through the first-level cache module and searching for public domain name information corresponding to the domain name resolution request includes:
[0022] The domain name resolution request is received through the first-level cache module, and the public domain name information corresponding to the domain name resolution request is searched in the record set; if the public domain name information exists in the record set and the second lifetime corresponding to the public domain name information has not expired, a domain name resolution result including the public domain name information is sent to the client; if the second lifetime corresponding to the public domain name information has expired, the domain name resolution request is forwarded to the second-level cache submodule;
[0023] If the public network domain name information does not exist in the record set, searching the abnormal sound result corresponding to the domain name resolution request through the negative cache, and if the abnormal sound result exists in the negative cache and the first survival time corresponding to the abnormal sound result has not expired, sending the abnormal sound result to the client;
[0024] If the abnormal sound result does not exist in the negative cache or the second survival time corresponding to the abnormal sound result expires, the domain name resolution request is forwarded to the second-level cache submodule through the first-level cache module.
[0025] In some feasible implementations, the recursive module further includes a request determination submodule, and before the secondary cache submodule receives the domain name resolution request, further includes:
[0026] The domain name resolution request is identified by the request determination submodule, the port information of the domain name resolution request is obtained, and it is determined whether the domain name resolution request is forwarded to the secondary cache submodule through the primary cache module according to the port information. If not, the domain name resolution request is discarded. If so, the domain name resolution request is received through the secondary cache submodule.
[0027] In some feasible implementations, the method further includes:
[0028] In response to the client receiving the domain name resolution result, sending a reverse domain name resolution request through the client, and sending the reverse domain name resolution request to the multi-level shared cache module;
[0029] In response to the secondary cache submodule receiving the reverse domain name resolution request, the secondary cache submodule identifies the request address of the reverse domain name resolution request, and if the request address is a public network address, the secondary cache submodule sends the reverse domain name resolution request to the public network domain name resolution server, and if the reverse domain name resolution request is a private network address, the secondary cache submodule returns a response result indicating that the domain name does not exist to the client;
[0030] In response to the public network domain name resolution server receiving the reverse domain name resolution request, the reverse domain name resolution request is queried through the public network domain name resolution server to obtain a reverse domain name resolution result of the reverse domain name resolution request, and the reverse domain name resolution result is sent to the client.
[0031] In some feasible implementations, the first-level cache module includes several first-level cache modules, and forwarding the domain name resolution request to the first-level cache module through the shared domain name module includes:
[0032] The domain name resolution request is forwarded to the first-level cache module corresponding to the client through the shared domain name module according to the hash algorithm.
[0033] The embodiment of the present invention also discloses a domain name resolution system, which includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module; wherein:
[0034] The client is used to send a domain name resolution request to the multi-level shared cache module;
[0035] The multi-level shared cache module is used to receive the domain name resolution request, and query whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request; if there is a domain name resolution result corresponding to the domain name resolution request, the domain name resolution result is sent to the client; if there is no domain name resolution result corresponding to the domain name resolution request, the domain name resolution request is sent to the public network domain name resolution server for iterative query, to obtain the domain name resolution result of the domain name resolution request, and the domain name resolution result is sent to the client.
[0036] The embodiment of the present invention further discloses an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0037] The memory is used to store computer programs;
[0038] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0039] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0040] The embodiments of the present invention include the following advantages:
[0041] In an embodiment of the present invention, the domain name resolution system is applied, and the domain name resolution system includes at least several clients, a multi-level shared cache module connected to the client, and a public network domain name resolution server connected to the multi-level shared cache module. The multi-level shared cache module receives the domain name resolution request sent by the client, and queries whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module; if there is, the domain name resolution result is sent to the client; if not, the domain name resolution request is sent to the public network domain name resolution server for iterative query, and the domain name resolution result is obtained and returned to the client, so that the domain name resolution request sent by the client is preferentially resolved in the multi-level shared cache of the system. If the required domain name resolution result is not in the multi-level shared cache, the domain name resolution request is forwarded to the public network server for query to obtain the final domain name resolution result, which reduces the pressure on the public network server, and the cache hit rate can be improved through the multi-level shared cache, and the efficiency and performance of domain name resolution can be optimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flowchart of the steps of a domain name resolution method provided in an embodiment of the present invention;
[0043] Figure 2 is a flow chart of a multi-level shared cache module provided in an embodiment of the present invention;
[0044] Figure 3 It is a flow chart of a domain name resolution request processing provided in an embodiment of the present invention;
[0045] Figure 4 It is a schematic diagram of the process of request processing of the first-level cache module provided in an embodiment of the present invention;
[0046] Figure 5is a schematic diagram of a flow chart of a first-level cache module response process provided in an embodiment of the present invention;
[0047] Figure 6 It is a schematic diagram of the process of request processing of the secondary cache submodule provided in an embodiment of the present invention;
[0048] Figure 7 is a schematic diagram of a flow chart of a secondary cache submodule response process provided in an embodiment of the present invention;
[0049] Figure 8 is a structural block diagram of a domain name resolution system provided in an embodiment of the present invention;
[0050] Fig. 9 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0051] Fig.10 is a schematic diagram of a computer-readable storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0053] As an example, the existing domain name resolution method is usually that the client sends a request to a public network server to obtain the domain name resolution result. The public network domain name resolution server may face huge load pressure, and the existing method is based on system memory to directly store the correspondence between the domain name and the IP address, which requires a large amount of system memory to store tens of thousands of domain name data, occupies a large amount of system memory, and causes system resource tension. In addition, as the cached data increases, the query efficiency will gradually decrease, seriously affecting the user experience.
[0054] In this regard, in the present invention, it is applied to a domain name resolution system, and the domain name resolution system includes at least several clients, a multi-level shared cache module connected to the client, and a public network domain name resolution server connected to the multi-level shared cache module. The multi-level shared cache module receives the domain name resolution request sent by the client, and queries whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module; if there is, the domain name resolution result is sent to the client; if not, the domain name resolution request is sent to the public network domain name resolution server for iterative query, and the domain name resolution result is obtained and returned to the client, so that the domain name resolution request sent by the client is preferentially resolved in the multi-level shared cache of the system. If the required domain name resolution result is not in the multi-level shared cache, the domain name resolution request is forwarded to the public network server for query to obtain the final domain name resolution result, which reduces the pressure on the public network server, and the cache hit rate can be improved through the multi-level shared cache, and the efficiency and performance of the domain name resolution can be optimized.
[0055] Reference Figure 1 , shows a flowchart of the steps of a domain name resolution method provided in an embodiment of the present invention, which is applied to a domain name resolution system, wherein the system includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module, and specifically may include the following steps:
[0056] Step 101: Send a domain name resolution request to the multi-level shared cache module through the client;
[0057] The domain name resolution system includes at least several clients, multi-level shared cache modules and public domain name resolution servers. Specifically, the clients and the multi-level shared cache modules are located in the internal network, and the public domain name resolution server is located in the public Internet. The client is used to send a domain name resolution request containing the domain name to be resolved to convert the domain name into the corresponding IP address, so that the client can communicate with the server corresponding to the IP address; the multi-level shared cache module is a shared cache in the internal network, which is responsible for storing and managing previously resolved domain names and the corresponding domain name resolution results; the public domain name resolver is a server specifically used to process domain name resolution requests and can be accessed by any device connected to the Internet.
[0058] During the domain name resolution process, when a client needs to access a domain name, a domain name resolution request containing the domain name to be resolved will be generated. The generated domain name resolution request will be sent to the multi-level shared cache module in the internal network through the network, reducing dependence on the public network domain name resolution server.
[0059] Step 102: receiving the domain name resolution request through the multi-level shared cache module, and querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request;
[0060] In the embodiment of the present invention, after receiving the domain name resolution request sent by the client, the multi-level shared cache module will query whether there is a corresponding domain name resolution result in the internal cache of the multi-level shared cache module.
[0061] In some feasible implementations, the multi-level shared cache module includes at least a tenant domain name module, a shared domain name module, a first-level cache module, and a recursive module, the recursive module includes at least a second-level cache submodule and an iterative query submodule, and querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request includes:
[0062] The domain name resolution request is received through the tenant domain name module, and whether the domain name information corresponding to the domain name resolution request is found in the tenant domain name module, if so, a domain name resolution result including the domain name information is returned to the client, if not, the domain name resolution request is forwarded to the shared domain name module;
[0063] The shared domain name module receives the domain name resolution request, and searches the shared domain name module for domain name information corresponding to the domain name resolution request; if yes, returns a domain name resolution result including the domain name information to the client; if no, forwards the domain name resolution request to the primary cache module;
[0064] The domain name resolution request is received through the first-level cache module, and the domain name information corresponding to the domain name resolution request is searched in the first-level cache module. If yes, a domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the second-level cache submodule.
[0065] The domain name resolution request is received through the secondary cache submodule, and whether the secondary cache submodule has the domain name information corresponding to the domain name resolution request, if yes, then the domain name resolution result including the domain name information is returned to the client, if no, then the domain name resolution request is sent to the iterative query submodule;
[0066] The domain name resolution request is received through the iterative query submodule, and the domain name resolution request is sent to the public network domain name resolution server for iterative query to obtain the domain name resolution result of the domain name resolution request.
[0067] In the embodiment of the present application, the multi-level shared cache module includes a tenant domain name module, a shared domain name module, a first-level cache module, and a recursive module. The recursive module also includes a second-level cache submodule and an iterative query submodule. The tenant domain name module, the shared domain name module, and the second-level cache submodule are global cache memories, and the first-level cache module has multiple corresponding domain name resolution requests sent by different clients.
[0068] The tenant domain name module uses a hierarchical directory structure to store the regional configuration information and VPC (Virtual Private Cloud) configuration information corresponding to multiple clients. The regional configuration information is used to manage the domain name resolution corresponding to the client, and to achieve independent management of the domain name resolution configuration of each tenant, ensuring that the domain name resolution of different tenants does not interfere with each other and improves security. The VPC configuration information is used to create an isolated environment corresponding to the client to ensure that the network resources of different clients are isolated from each other.
[0069] The shared tenant domain name module is based on the OSS (object storage service) intranet domain name storage logic. It uses FQDN (Fully Qualified Domain Name) to explicitly record the regional configuration information and VPC configuration information of each client, and distinguishes their respective services through subdomains or paths to adapt to the needs of multi-tenant environments, while ensuring that the domain name resolution logic of internal and external systems is consistent.
[0070] The first-level cache module caches the public domain name information of the corresponding client, and uses a domain name tree structure to store and manage domain name information. Specifically, the root domain name, top-level domain name, second-level domain name, and third-level domain name are recorded level by level according to the data structure of hash bucket + binary tree. For example, the root domain name or top-level domain name is mapped to different buckets through a hash function, such as bucket 1: .com, bucket 2: .org, and a binary tree is used in each bucket to record specific domain name data level by level, such as top-level domain name (.com, .net)-second-level domain name (example.com)-third-level domain name (www.example.com, blog.example.com), to ensure the orderliness and efficient access of data in the bucket.
[0071] The recursive module is built using BIND9 (Berkeley Internet Name Domain), and includes at least a secondary cache submodule and an iterative query submodule. The secondary cache submodule stores a large amount of public domain name information for all clients' domain name resolution requests to match, and the iterative query submodule is used to recursively forward the domain name resolution request to the public domain name resolution server to obtain the final domain name resolution result when the secondary cache submodule does not hit the domain name resolution result.
[0072] Specifically, the secondary cache submodule is executed through the following command:
[0073]
[0074]
[0075] In the specific implementation process, combined with Figure 2A flow chart of a multi-level shared cache module provided in an embodiment of the present invention is shown, in which a client sends a domain name resolution request, which is preferentially processed by a tenant domain name module, and the tenant domain name module searches for internally stored configuration information to find a DNS record related to the requested domain name, and if a corresponding DNS record is found, a domain name resolution result containing the DNS record is returned to the client, and if not found, the domain name resolution request is forwarded to a shared domain name module; the shared domain name module receives the domain name resolution request, searches for corresponding configuration information according to a subdomain name of the domain name resolution request to find a DNS record related to the requested domain name, and if a corresponding DNS record is found, a domain name resolution result containing the DNS record is returned to the client, and if not found, the domain name resolution request is forwarded to a first-level cache module; the first-level cache module searches for a domain name resolution result according to the domain name resolution request The public domain name information stored internally, if the corresponding public domain name information is found, the domain name resolution result containing the public domain name information is returned to the client, if not found, the domain name resolution request is forwarded to the secondary cache sub-module; the secondary cache sub-module searches for the public domain name information stored internally according to the domain name resolution request, if the corresponding public domain name information is found, the domain name resolution result containing the public domain name information is returned to the client, if not found, the domain name resolution request is forwarded to the iterative query sub-module; the iterative query sub-module forwards the domain name resolution request to the public domain name resolution server for iterative query, and returns the domain name resolution result received from the public domain name resolution server to the secondary cache sub-module; the public domain name resolution server processes the domain name resolution request, obtains the domain name resolution result and sends it to the client and the iterative query sub-module.
[0076] In some feasible implementations, the first-level cache module includes several first-level cache modules, and forwarding the domain name resolution request to the first-level cache module through the shared domain name module includes:
[0077] The domain name resolution request is forwarded to the first-level cache module corresponding to the client through the shared domain name module according to the hash algorithm.
[0078] In the embodiment of the present invention, the shared domain name module determines the specific first-level cache module corresponding to the client according to the hash algorithm, so that the domain name resolution request of the same client is always forwarded to the same first-level cache module, ensuring the consistency and effectiveness of the cache, reducing repeated queries, and improving the hit rate of the first-level cache. Specifically, the source IP of the domain name resolution request is hashed using a hash function and the hash value is mapped to a fixed first-level cache module.
[0079] In some feasible implementations, the first-level cache module includes at least a record set and a negative cache, and the method further includes:
[0080] Sending the domain name resolution result to the first-level cache module through the second-level cache submodule;
[0081] Receiving the domain name resolution result sent by the secondary cache submodule through the primary cache module, and analyzing the domain name resolution result;
[0082] If the domain name resolution result is an abnormal response, the domain name resolution result is stored in the negative cache, and the first expiration time of the domain name resolution result is recorded;
[0083] If the domain name resolution result is the public domain name information corresponding to the domain name resolution request, the public domain name information is stored through the record set, and the second lifetime of the public domain name information is recorded.
[0084] In an embodiment of the present invention, the first-level cache module may include a record set and a negative cache, the record set is used to store the public domain name information returned by the second-level cache submodule and determine the second life span of the public domain name information according to the TTL value (Time ToLive, life span) in the result returned by the second-level cache submodule, and the negative cache is used to store the domain name resolution result as an abnormal result and a domain name resolution request that has not been responded to due to a timeout, such as the response result corresponding to the domain name resolution request is serverfail (server failure), refuse (request rejected), nxdomain (domain name does not exist) and other abnormal results, then the domain name resolution result corresponding to the domain name resolution request is uniformly converted into a domain name does not exist and stored in the negative cache and the first life span of the domain name resolution result is determined according to the TTL value corresponding to the first-level cache module. Through the interaction of the first-level cache module and the second-level cache submodule, the domain name resolution system can efficiently process and store the domain name resolution result, and the first-level cache module stores normal and abnormal resolution results respectively through the record set and the negative cache, and records their respective life spans to ensure the validity and timely update of the cache.
[0085] In some feasible implementations, receiving the domain name resolution request through the first-level cache module and searching for public domain name information corresponding to the domain name resolution request includes:
[0086] The domain name resolution request is received through the first-level cache module, and the public domain name information corresponding to the domain name resolution request is searched in the record set; if the public domain name information exists in the record set and the second lifetime corresponding to the public domain name information has not expired, a domain name resolution result including the public domain name information is sent to the client; if the second lifetime corresponding to the public domain name information has expired, the domain name resolution request is forwarded to the second-level cache submodule;
[0087] If the public network domain name information does not exist in the record set, searching the abnormal sound result corresponding to the domain name resolution request through the negative cache, and if the abnormal sound result exists in the negative cache and the first survival time corresponding to the abnormal sound result has not expired, sending the abnormal sound result to the client;
[0088] If the abnormal sound result does not exist in the negative cache or the second survival time corresponding to the abnormal sound result expires, the domain name resolution request is forwarded to the second-level cache submodule through the first-level cache module.
[0089] Specifically, after receiving the domain name resolution request, the first-level cache module will search for the corresponding public domain name information in the record set. If it exists and the corresponding TTL value has not expired, the resolution result will be directly returned. If the TTL value has expired, the request will be forwarded to the second-level cache submodule for further query; if the record set does not have the corresponding public domain name information, the negative cache will be queried. If there is no abnormal result in the negative cache or the TTL has expired, the request will be forwarded to the second-level cache submodule for further processing. Through the negative cache mechanism, known abnormal results can be responded to quickly, and repeated queries for invalid domain names can be avoided, which improves the fault tolerance of the system. And through the management of TTL values, it is ensured that the records in the cache can be updated in time after expiration, avoiding the use of expired resolution results, and improving the reliability and accuracy of the system.
[0090] In some feasible implementations, the recursive module further includes a request determination submodule, and before the domain name resolution request is received through the secondary cache submodule, further includes:
[0091] The domain name resolution request is identified by the request determination submodule, the port information of the domain name resolution request is obtained, and it is determined whether the domain name resolution request is forwarded to the secondary cache submodule through the primary cache module according to the port information. If not, the domain name resolution request is discarded. If so, the domain name resolution request is received through the secondary cache submodule.
[0092] In the embodiment of the present application, the recursive module may further include a request determination submodule. Before the secondary cache submodule receives the domain name resolution request, the request determination submodule will also identify the port information of the request, determine whether the request is forwarded by the first buffer module, and decide whether to discard the request or allow the request to enter the secondary cache submodule based on the determination result. Implementing the secondary cache submodule to only accept request messages forwarded from the primary cache module can more effectively reduce attack messages from the outside, including the public network and the intranet.
[0093] Step 103: If the domain name resolution result corresponding to the domain name resolution request exists in the multi-level shared cache module, the domain name resolution result is sent to the client through the multi-level shared cache module;
[0094] In the embodiment of the present invention, if the corresponding domain name resolution result exists in the multi-level shared cache module, the multi-level shared cache module will mark it as a cache hit and return the domain name resolution result to the client.
[0095] Step 104: If the multi-level shared cache module does not have the domain name resolution result corresponding to the domain name resolution request, the domain name resolution request is sent to the public network domain name resolution server through the multi-level shared cache module for iterative query, the domain name resolution result of the domain name resolution request is obtained, and the domain name resolution result is sent to the client.
[0096] In an embodiment of the present invention, if the corresponding domain name resolution result does not exist in the multi-level shared cache module, the multi-level shared cache module will be marked as a cache miss, and the domain name resolution request will be forwarded to the public network domain name resolution server for iterative query, ensuring that the client can obtain the latest domain name resolution result, avoiding resolution failures caused by cache misses. Through the collaborative work of the multi-level shared cache module and the public network domain name resolution server, the reliability and stability of the domain name resolution system are ensured, and resolution failures caused by the failure of the multi-level shared cache module are avoided. In addition, by forwarding some requests to the public network domain name resolution server, the load can be dispersed, avoiding overload of a single cache module, and improving the load balancing capability of the system.
[0097] In some feasible implementations, the method further includes:
[0098] In response to the client receiving the domain name resolution result, sending a reverse domain name resolution request through the client, and sending the reverse domain name resolution request to the multi-level shared cache module;
[0099] In response to the secondary cache submodule receiving the reverse domain name resolution request, the secondary cache submodule identifies the request address of the reverse domain name resolution request, and if the request address is a public network address, the secondary cache submodule sends the reverse domain name resolution request to the public network domain name resolution server, and if the reverse domain name resolution request is a private network address, the secondary cache submodule returns a response result indicating that the domain name does not exist to the client;
[0100] In response to the public network domain name resolution server receiving the reverse domain name resolution request, the reverse domain name resolution request is queried through the public network domain name resolution server to obtain a reverse domain name resolution result of the reverse domain name resolution request, and the reverse domain name resolution result is sent to the client.
[0101] In an embodiment of the present invention, after receiving the domain name resolution request result of the A record, most clients will automatically initiate a PTR (Pointer Record) record request, that is, a reverse domain name resolution request. The reverse domain name resolution request is also sent to the multi-level shared memory module for processing, and is processed in turn according to the tenant domain name module, shared domain name module, first-level cache module and second-level cache sub-module to find the corresponding reverse domain name resolution result. When the tenant domain name module, shared domain name module and first-level cache module all fail to hit the reverse domain name resolution result, it is processed by the second-level cache sub-module. Specifically, the secondary cache submodule identifies the request address of the reverse domain name resolution request. If the request address is a public network address, that is, within the public IP address range, the secondary cache submodule first searches the internal storage for corresponding reverse domain name information. If not, the reverse domain name resolution request is sent to the public domain name resolution server for search. If the request address is a private network address, that is, within the private IP address range, such as 192.168.0.0 / 24, 172.16.0.0 / 12, 10.0.0.0 / 8, etc., the secondary cache submodule returns a response result indicating that the domain name does not exist to the client, because the private network address usually does not correspond to the public network domain name, and effective reverse domain name resolution cannot be performed to avoid affecting the resources of the public network domain name resolution server.
[0102] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:
[0103] Reference Figure 3 , shows a domain name resolution request processing flow chart provided in an embodiment of the present invention. In the domain name resolution request processing process, the domain name resolution request sent by the client is received by the underlying DPDK (Data Plane Development Kit) and sent to the user-state freeBSD (FreeBSD Operating System Network Stack) protocol stack for processing, and further sent from the freeBSD protocol stack to the multi-level shared cache module in the application layer for processing, and the domain name resolution result is searched. If the corresponding domain name resolution result does not exist in the multi-level shared cache module, the domain name resolution request is forwarded to the public network domain name resolution processor in the Internet through the kernel-state Linux protocol stack via the KNI (Kernel NIC Interface) interface for processing.
[0104] Reference Figure 4 , shows a schematic diagram of the process of request processing of the first-level cache module provided in an embodiment of the present invention. After receiving the domain name resolution request, the first-level cache module first determines the legality of the request. If it is illegal, it is directly discarded and statistics are made at the same time. The cached domain name node is queried for legal messages. The domain name node is used to indicate whether there is a domain name resolution result corresponding to the request in the first-level cache module. If there is no domain name node, a forwarding node is created, and the request is sent to the recursive module through the forwarding node. If there is a domain name node, the record set is continued to be queried. If there is a record set, after judging that the record set has not expired, the domain name information of the record set is encapsulated as a response message and returned to the client. If there is no record set, the negative cache is queried. If there is a negative cache, after judging that it has not expired, the domain name does not exist response message is directly encapsulated and returned to the client. For expired record sets or negative caches, a forwarding node is directly created to send the request to the recursive module.
[0105] Reference Figure 5 , showing a schematic flow chart of the response processing of the first-level cache module provided in an embodiment of the present invention, the first-level cache periodically checks whether the forwarding node is expired, and for the expired forwarding node, it is considered that the domain name resolution request has timed out and has not received a response. At this time, a corresponding negative cache is created for the next time the domain name resolution request is received, and an abnormal response of the non-existence of the domain name is directly returned, and the forwarding node is deleted. For the response message from the recursive module, that is, the domain name resolution result, first check whether the forwarding node exists, if not, it is directly discarded; if the forwarding node exists, further analyze the message response field in depth, if the message is illegal, it is directly discarded, if it is a legal message and the response code is correct, then create a record set and delete the forwarding node at the same time, and encapsulate the response message containing the corresponding domain name information and return it to the client. For response code errors, such as refuse, nxdomain, serverfail and other abnormal response codes, a negative cache is created, and the forwarding node is deleted at the same time, and the response message of the non-existence of the encapsulated domain name is returned to the client.
[0106] Reference Figure 6 , showing a schematic diagram of the process of request processing of the secondary cache submodule provided in an embodiment of the present invention. The secondary cache submodule records a log and discards the illegal message, i.e., the received illegal request. If the message is legal, the record set is queried. If the record set has corresponding domain name information, a response message containing the domain name information is encapsulated and returned to the client. If the record set does not hit, an iteration node is created to send the request to the iteration query submodule, and the public network domain name resolution server is queried through the iteration query submodule to obtain the final domain name resolution result.
[0107] Reference Figure 7, showing a schematic flow chart of the response processing of the secondary cache submodule provided in an embodiment of the present invention. After the secondary cache submodule receives the domain name resolution result returned by the iterative query submodule, it queries the iteration node. If the corresponding iteration node does not exist, it is directly discarded. If the corresponding iteration node exists, a corresponding record set is created and the corresponding request node is queried. The request node is the corresponding request node created when the secondary cache submodule receives the domain name resolution request. If the domain name resolution result matches the request node, the encapsulated response is returned to the client. If the request node does not match, the iteration continues until the final domain name resolution result is obtained or the domain name resolution request is regarded as timed out and not responded.
[0108] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0109] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0110] Reference Figure 8 , shows a structural block diagram of a domain name resolution system provided in an embodiment of the present invention, which is applied to a domain name resolution system, wherein the system includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module; wherein:
[0111] The client is used to send a domain name resolution request to the multi-level shared cache module;
[0112] The multi-level shared cache module is used to receive the domain name resolution request, and query whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request; if there is a domain name resolution result corresponding to the domain name resolution request, the domain name resolution result is sent to the client; if there is no domain name resolution result corresponding to the domain name resolution request, the domain name resolution request is sent to the public network domain name resolution server for iterative query, to obtain the domain name resolution result of the domain name resolution request, and the domain name resolution result is sent to the client.
[0113] In some feasible implementations, the multi-level shared cache module includes at least a tenant domain name module, a shared domain name module, a first-level cache module, and a recursive module, and the recursive module includes at least a second-level cache submodule and an iterative query submodule, and the multi-level shared cache module is queried according to the domain name resolution request to see whether there is a domain name resolution result corresponding to the domain name resolution request; wherein,
[0114] The tenant domain name module is used to receive the domain name resolution request and search whether there is domain name information corresponding to the domain name resolution request in the tenant domain name module. If yes, the domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the shared domain name module.
[0115] The shared domain name module is used to receive the domain name resolution request and search whether there is domain name information corresponding to the domain name resolution request in the shared domain name module. If yes, the domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the first-level cache module.
[0116] The first-level cache module is used to receive the domain name resolution request and search whether there is domain name information corresponding to the domain name resolution request in the first-level cache module. If yes, the domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the second-level cache submodule.
[0117] The secondary cache submodule is used to receive the domain name resolution request and search whether there is domain name information corresponding to the domain name resolution request in the secondary cache submodule, if yes, return the domain name resolution result including the domain name information to the client, if no, send the domain name resolution request to the iterative query submodule;
[0118] The iterative query submodule is used to receive the domain name resolution request, and send the domain name resolution request to the public network domain name resolution server for iterative query to obtain the domain name resolution result of the domain name resolution request.
[0119] In some feasible implementations, the first-level cache module includes at least a record set and a negative cache; wherein,
[0120] The secondary cache submodule is also used to send the domain name resolution result to the primary cache module;
[0121] The first-level cache module is also used to receive the domain name resolution result sent by the second-level cache submodule, and analyze the domain name resolution result. If the domain name resolution result is an abnormal response, the domain name resolution result is stored through the negative cache, and the first lifetime of the domain name resolution result is recorded. If the domain name resolution result is the public domain name information corresponding to the domain name resolution request, the public domain name information is stored through the record set, and the second lifetime of the public domain name information is recorded.
[0122] In some feasible implementations, the first-level cache module is further used for:
[0123] Receive the domain name resolution request, and search the record set for public network domain name information corresponding to the domain name resolution request;
[0124] If the public domain name information exists in the record set and the second lifetime corresponding to the public domain name information has not expired, the domain name resolution result including the public domain name information is sent to the client; if the second lifetime corresponding to the public domain name information has expired, the domain name resolution request is forwarded to the secondary cache submodule;
[0125] If the public network domain name information does not exist in the record set, searching the abnormal sound result corresponding to the domain name resolution request through the negative cache;
[0126] If the abnormal sound result exists in the negative cache and the first life span corresponding to the abnormal sound result has not expired, sending the abnormal sound result to the client;
[0127] If the abnormal sound result does not exist in the negative cache or the second survival time corresponding to the abnormal sound result expires, the domain name resolution request is forwarded to the second-level cache submodule through the first-level cache module.
[0128] In some feasible implementations, the recursive module further includes a request determination submodule; wherein the request determination submodule is used to:
[0129] Identify the domain name resolution request and obtain port information of the domain name resolution request;
[0130] Determine, according to the port information, whether the domain name resolution request is forwarded to the secondary cache submodule through the primary cache module;
[0131] If not, discard the domain name resolution request;
[0132] If so, the domain name resolution request is received through the secondary cache submodule.
[0133] In some possible implementations,
[0134] The client sends a reverse domain name resolution request in response to receiving the domain name resolution result, and sends the reverse domain name resolution request to the multi-level shared cache module;
[0135] The secondary cache submodule, in response to receiving the reverse domain name resolution request, identifies the request address of the reverse domain name resolution request, and if the request address is a public network address, sends the reverse domain name resolution request to the public network domain name resolution server; if the reverse domain name resolution request is a private network address, returns a response result indicating that the domain name does not exist to the client;
[0136] In response to receiving the reverse domain name resolution request, the public network domain name resolution server queries the reverse domain name resolution request, obtains a reverse domain name resolution result of the reverse domain name resolution request, and sends the reverse domain name resolution result to the client.
[0137] In some feasible implementations, the first-level cache module includes several; wherein,
[0138] The shared domain name module is also used to forward the domain name resolution request to the first-level cache module corresponding to the client according to a hash algorithm.
[0139] As for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the system embodiment.
[0140] In addition, the present application also provides an electronic device, such as Fig. 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0141] Memory 903, used for storing computer programs;
[0142] The processor 901 is used to execute the program stored in the memory 903 to implement the various processes of the above method embodiment and achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0143] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0144] The communication interface is used for communication between the above terminal and other devices.
[0145] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0146] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0147] like Fig.10 As shown, in another embodiment provided in the present application, a computer-readable storage medium 1001 is also provided, in which instructions are stored. When executed by one or more processors, the processors execute the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, they are not repeated here.
[0148] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0149] In the embodiments provided in the present application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0153] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A domain name resolution method, characterized in that: Applied to a domain name resolution system, the system includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module, the method includes: Sending a domain name resolution request to the multi-level shared cache module through the client; Receiving the domain name resolution request through the multi-level shared cache module, and querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request; If the domain name resolution result corresponding to the domain name resolution request exists in the multi-level shared cache module, the domain name resolution result is sent to the client through the multi-level shared cache module; If the multi-level shared cache module does not have the domain name resolution result corresponding to the domain name resolution request, the multi-level shared cache module sends the domain name resolution request to the public network domain name resolution server for iterative query, obtains the domain name resolution result of the domain name resolution request, and sends the domain name resolution result to the client.
2. The method according to claim 1, characterized in that: The multi-level shared cache module at least includes a tenant domain name module, a shared domain name module, a first-level cache module and a recursive module, and the recursive module at least includes a second-level cache submodule and an iterative query submodule. The querying whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request includes: The domain name resolution request is received through the tenant domain name module, and whether the domain name information corresponding to the domain name resolution request is found in the tenant domain name module, if so, a domain name resolution result including the domain name information is returned to the client, if not, the domain name resolution request is forwarded to the shared domain name module; The shared domain name module receives the domain name resolution request, and searches the shared domain name module for domain name information corresponding to the domain name resolution request; if yes, returns a domain name resolution result including the domain name information to the client; if no, forwards the domain name resolution request to the primary cache module; The first-level cache module receives the domain name resolution request and searches for domain name information corresponding to the domain name resolution request. If yes, the domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is forwarded to the second-level cache submodule. The secondary cache submodule receives the domain name resolution request and checks whether there is domain name information corresponding to the domain name resolution request. If yes, a domain name resolution result including the domain name information is returned to the client. If no, the domain name resolution request is sent to the iterative query submodule. The domain name resolution request is received through the iterative query submodule, and the domain name resolution request is sent to the public network domain name resolution server for iterative query to obtain the domain name resolution result of the domain name resolution request.
3. The method according to claim 2, characterized in that: The first-level cache module includes at least a record set and a negative cache, and the method further includes: Sending the domain name resolution result to the first-level cache module through the second-level cache submodule; Receiving the domain name resolution result sent by the secondary cache submodule through the primary cache module, and analyzing the domain name resolution result; If the domain name resolution result is an abnormal response, the domain name resolution result is stored in the negative cache, and the first expiration time of the domain name resolution result is recorded; If the domain name resolution result is the public domain name information corresponding to the domain name resolution request, the public domain name information is stored through the record set, and the second lifetime of the public domain name information is recorded.
4. The method according to claim 3, characterized in that: The receiving the domain name resolution request through the first-level cache module and searching whether there is public network domain name information corresponding to the domain name resolution request includes: The domain name resolution request is received through the first-level cache module, and the public domain name information corresponding to the domain name resolution request is searched in the record set; if the public domain name information exists in the record set and the second lifetime corresponding to the public domain name information has not expired, a domain name resolution result including the public domain name information is sent to the client; if the second lifetime corresponding to the public domain name information has expired, the domain name resolution request is forwarded to the second-level cache submodule; If the public network domain name information does not exist in the record set, searching the abnormal sound result corresponding to the domain name resolution request through the negative cache, and if the abnormal sound result exists in the negative cache and the first survival time corresponding to the abnormal sound result has not expired, sending the abnormal sound result to the client; If the abnormal sound result does not exist in the negative cache or the second survival time corresponding to the abnormal sound result expires, the domain name resolution request is forwarded to the second-level cache submodule through the first-level cache module.
5. The method according to claim 2, characterized in that: The recursive module further includes a request determination submodule, and before receiving the domain name resolution request through the secondary cache submodule, further includes: The domain name resolution request is identified by the request determination submodule, the port information of the domain name resolution request is obtained, and it is determined whether the domain name resolution request is forwarded to the secondary cache submodule through the primary cache module according to the port information. If not, the domain name resolution request is discarded. If so, the domain name resolution request is received through the secondary cache submodule.
6. The method according to claim 2, characterized in that: The method further comprises: In response to the client receiving the domain name resolution result, sending a reverse domain name resolution request through the client, and sending the reverse domain name resolution request to the multi-level shared cache module; In response to the secondary cache submodule receiving the reverse domain name resolution request, the secondary cache submodule identifies the request address of the reverse domain name resolution request, and if the request address is a public network address, the secondary cache submodule sends the reverse domain name resolution request to the public network domain name resolution server, and if the reverse domain name resolution request is a private network address, the secondary cache submodule returns a response result indicating that the domain name does not exist to the client; In response to the public network domain name resolution server receiving the reverse domain name resolution request, the reverse domain name resolution request is queried through the public network domain name resolution server to obtain a reverse domain name resolution result of the reverse domain name resolution request, and the reverse domain name resolution result is sent to the client.
7. The method according to claim 2, characterized in that: The first-level cache module includes several first-level cache modules, and forwarding the domain name resolution request to the first-level cache module through the shared domain name module includes: The domain name resolution request is forwarded to the first-level cache module corresponding to the client through the shared domain name module according to the hash algorithm.
8. A domain name resolution system, characterized in that: The system includes a plurality of clients, a multi-level shared cache module connected to the clients, and a public network domain name resolution server connected to the multi-level shared cache module; wherein: The client is used to send a domain name resolution request to the multi-level shared cache module; The multi-level shared cache module is used to receive the domain name resolution request, and query whether there is a domain name resolution result corresponding to the domain name resolution request in the multi-level shared cache module according to the domain name resolution request; if there is a domain name resolution result corresponding to the domain name resolution request, the domain name resolution result is sent to the client; if there is no domain name resolution result corresponding to the domain name resolution request, the domain name resolution request is sent to the public network domain name resolution server for iterative query, to obtain the domain name resolution result of the domain name resolution request, and the domain name resolution result is sent to the client.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 7 when executing the program stored in the memory.
10. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Domain name server (DNS) recursive method and system thereof
CN103701957A
Recursive domain name service system and method of multi-level shared cache
CN104935680A
Domain name resolution method and device and network equipment
CN108881515A
Domain name resolution method and device and computer readable storage medium
CN114500450A
Domain name resolution system and method in cloud computing environment
CN115297088A