Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium

文档序号:421240 发布日期:2021-12-21 浏览:9次 中文

阅读说明:本技术 域名解析缓存方法、dns服务器及计算机可读存储介质 (Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium ) 是由 吴万涛 李普 杨斌 于 2021-09-24 设计创作,主要内容包括:本发明涉及网络通信技术领域,具体地涉及一种域名解析缓存方法、DNS服务器及计算机可读存储介质。本发明提供的域名解析缓存方法能够大幅提高DNS域名解析的解析效率,上述方法具体包括:步骤S1,建立重点域名名单,将重点域名名单中的域名缓存到专用芯片的高速缓存区中,将不在重点域名名单中的域名缓存到专用芯片的低速缓存区中;步骤S2,接收到域名解析请求后,在高速缓存区中进行查询,若高速缓存区中缓存有域名解析请求中的域名,则跳过步骤S3并返回域名解析请求的应答结果;步骤S3,若高速缓存区中未缓存有域名解析请求中的域名,则在低速缓存区中进行查询,并返回域名解析请求的应答结果。(The present invention relates to the field of network communication technologies, and in particular, to a domain name resolution caching method, a DNS server, and a computer-readable storage medium. The domain name resolution caching method provided by the invention can greatly improve the resolution efficiency of DNS domain name resolution, and the method specifically comprises the following steps: step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip; step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, skipping step S3 and returning the response result of the domain name resolution request; in step S3, if the domain name in the domain name resolution request is not cached in the cache region, the query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.)

1. A domain name resolution caching method is characterized by comprising the following steps:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of a special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, skipping step S3 and returning the response result of the domain name resolution request;

step S3, if the domain name in the domain name resolution request is not cached in the cache region, query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

2. The domain name resolution caching method of claim 1, further comprising

Step S4, if the domain name in the domain name resolution request is not cached in the low-speed cache region, forwarding the domain name resolution request to a recursive server, and receiving and returning a response result of the domain name resolution request sent by the recursive server.

3. The domain name resolution caching method according to claim 1, wherein the step S1 further comprises

Step S11, the list of key domain names is updated periodically or aperiodically.

4. The domain name resolution caching method according to claim 3, wherein the key domain name list is a list of domain names that are N before the number of domain name resolution requests in the history resolution request record, wherein N is greater than or equal to 5000 and less than or equal to 50000.

5. The domain name resolution caching method according to claim 1, wherein the dedicated chip is a field programmable gate array chip.

6. The domain name resolution caching method according to claim 5, wherein the cache area is a static random access memory and the low-speed cache area is a block storage area.

7. A DNS server comprising a memory and one or more processors, at least a portion of the processors being dedicated chips, wherein when a program or instructions in the memory is executed by the processors, the DNS server when performing domain name cache resolution is capable of performing the steps of:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, calling step S3 and returning the response result of the domain name resolution request;

step S3, if the domain name in the domain name resolution request is not cached in the cache region, query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

8. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the domain name resolution caching method according to any one of claims 1 to 6.

Technical Field

The present invention relates to the field of network communication technologies, and in particular, to a domain name resolution caching method, a DNS server, and a computer-readable storage medium.

Background

The domain name resolution is a service that resolves a corresponding IP address by a domain name, so that people can conveniently access a website by a registered domain name. With the development of internet technology and the popularization of various intelligent devices, the demand for domain name resolution has also increased substantially, and accordingly, ultra-high speed domain name resolution services are required.

Domain name resolution services typically require a Central Processing Unit (CPU) to query memory for IP address data corresponding to a domain name. However, the speed of data access by the CPU is very fast, and can reach 1G/sec or more, and for the memory, it is fast to reach 10M/sec or more, and the speed of both is nearly hundreds of times.

In the prior art, in order to solve the problem of speed difference between the CPU speed and the memory speed, a multi-level Cache (Cache) of a computer is established, and when domain name resolution is required, required data is first searched from the Cache (Cache), and if the required data cannot be found from the Cache (Cache), the required data is searched from the memory. The running speed of the Cache (Cache) is much higher than that of the memory, and even can reach 1G/sec which is the same as that of the CPU, so that the Cache (Cache) can greatly improve the domain name resolution speed. However, although the resolution speed of the Cache (Cache) is high, the Cache space is small, only a part of domain names can be stored, and the domain names stored in the Cache (Cache) are difficult for users to freely select. In practical application, the request of the domain name is very random, which brings about the consequence that the multi-level Cache (Cache) of the general-purpose computer can often not find the IP address data corresponding to the requested domain name, i.e. Cache miss (CacheMiss) occurs, but the CPU spends more time on searching and reading the memory, which causes the performance loss of the CPU and reduces the resolution speed of the domain name.

Therefore, a technical solution is needed to provide efficient and stable domain name resolution service.

Disclosure of Invention

In view of the above problems, the present invention provides a domain name resolution caching method, a DNS server, and a computer-readable storage medium, which can stably and greatly improve the resolution speed of domain name resolution.

The domain name resolution caching method provided by the invention comprises the following steps:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, skipping step S3 and returning the response result of the domain name resolution request;

in step S3, if the domain name in the domain name resolution request is not cached in the cache region, the query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

In the domain name resolution caching method provided by the invention, the domain name in the pre-established key domain name list is cached in the cache region of the special chip, and the cache region has a speed far higher than the data access speed of a memory, so that resolution requests aiming at the domain name in the key domain name list can be responded at a high speed, and the speed of the whole domain name resolution service is improved. Moreover, the domain name in the key domain name list can be specified by the user, that is, the domain name which needs high-speed response or is frequently accessed can be stored in the key domain name list to obtain the corresponding high-speed domain name resolution service.

In the preferred technical solution of the present invention, the domain name resolution caching method further includes

Step S4, if the domain name in the domain name resolution request is not cached in the low-speed cache region, forwarding the domain name resolution request to the recursive server, and receiving and returning a response result of the domain name resolution request sent by the recursive server.

The data stored in the high-speed cache region and the low-speed cache region of the special chip can cover most domain name resolution requests, and for domain names of which response results cannot be inquired in the high-speed cache region and the low-speed cache region, the domain name resolution requests are forwarded to the recursive server, the recursive server carries out domain name resolution, and the response results are inquired from the recursive server or other DNS servers and returned to the user.

In a preferred embodiment of the present invention, the step S1 of the domain name resolution caching method further includes a step S11 of updating the key domain name list periodically or aperiodically.

Because the high probability of the domain name needing high-speed resolution is not fixed, the domain name needing high-speed resolution can be added into the key domain name list by regularly or irregularly updating the key domain name list, and the domain name which does not need high-speed resolution any more is deleted from the key domain name list. The regular or irregular updating can be automatically updated by a program according to a preset rule, and the user can also automatically add or delete the domain name.

Preferably, in the technical solution of the present invention, the key domain name list in the domain name resolution caching method is a list of domain names of N names before the number of domain name resolution requests in the history resolution request record, where N is greater than or equal to 5000 and less than or equal to 50000. The domain names with N names before the number of domain name resolution requests in the history resolution request record, namely the N domain names with the most accessed times, basically occupy more than 90% of the total number of the domain name resolution requests, so that the domain names with N names before the number of the domain name resolution requests in the history resolution request record can be resolved at high speed, and the efficiency of the whole domain name resolution service can be greatly improved.

In a preferred technical scheme of the invention, a special chip adopted in the domain name resolution caching method is a Field Programmable Gate Array (FPGA) chip. The FPGA is composed of hardware resources such as a logic unit, a random access memory, a multiplier and the like, hardware circuits such as the multiplier, a register, an address generator and the like can be realized by reasonably organizing the hardware resources, all functions of the FPGA can be realized by hardware, a production line is parallel to each other, data is parallel to each other, and the data processing speed is extremely high.

Specifically, in a preferred embodiment of the present invention, a Field Programmable Gate Array (FPGA) has a cache area of a static random access memory, and a low cache area of a block memory. The Static Random Access Memory (SRAM) has high data access speed and high cost, and is suitable for serving as a cache region of domain names in a key domain name list with less quantity and high access frequency; the block memory has a larger storage space and is a random access memory resource customized by the FPGA, and can store more domain name data although the speed of the block memory is not the same as that of a Static Random Access Memory (SRAM).

In the technical solution of the present invention, there is also provided a DNS server, where the DNS server includes a memory and one or more processors, at least a part of the processors are dedicated chips, and when a program or an instruction in the memory is executed by the processors, the DNS server can perform the following steps when performing domain name cache resolution:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, calling step S3 and returning the response result of the domain name resolution request;

in step S3, if the domain name in the domain name resolution request is not cached in the cache region, the query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

Through the steps, the DNS server provided by the technical scheme of the invention can stably and greatly improve the resolution speed of domain name resolution.

In the technical solution of the present invention, a computer-readable storage medium is further provided, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the domain name resolution caching method are implemented.

Drawings

Fig. 1 is a schematic flowchart of a domain name resolution caching method according to an embodiment of the present invention;

fig. 2 is a schematic flow chart of a preferred domain name resolution caching method according to an embodiment of the present invention;

fig. 3 is a system structure diagram of a domain name resolution caching method according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a DNS server in an embodiment of the present invention.

Reference numerals: 1-security policy subsystem, 2-DNS service subsystem, 3-cache region, 4-low-speed cache region, 5-recursive forwarding subsystem, 6-recursive server, 7-cache updating subsystem, 8-service management subsystem, 9-log subsystem, 10-DNS server, 11-memory, 12-processor.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative effort belong to the protection scope of the present invention.

As shown in fig. 1, an embodiment of the present invention provides a domain name resolution caching method, including:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, skipping step S3 and returning the response result of the domain name resolution request;

in step S3, if the domain name in the domain name resolution request is not cached in the cache region, the query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

In this embodiment, first, a key domain name list needs to be established, and the domain names in the key domain name list are cached in the cache region of the dedicated chip. When a domain name resolution request is received, for example, when the domain name is www.example.com, the cache region where the key domain name information is cached is first searched for whether the IP address information of the domain name www.example.com is cached. If the IP address information of the domain name www.example.com is cached in the cache region, the IP address information can be directly returned to the user as a response result of the domain name resolution request; if the IP address information of the domain name www.example.com is not cached in the cache region, the IP address information of the domain name www.example.com is searched in the low-speed cache region of the special chip.

Because the high-speed cache region has the speed far higher than the data access speed of a general memory, the resolution requests aiming at the domain names in the key domain name list can be responded at high speed, and the speed of the whole domain name resolution service can be improved. Moreover, the domain name in the key domain name list can be specified by the user, that is, the domain name which needs high-speed response or is frequently accessed can be stored in the key domain name list to obtain the corresponding high-speed domain name resolution service.

As shown in fig. 2, in the embodiment of the present invention, the domain name resolution caching method further includes step S4, if the domain name in the domain name resolution request is not cached in the low-speed cache region, forwarding the domain name resolution request to the recursive server, and receiving and returning a response result of the domain name resolution request sent by the recursive server.

When domain name resolution is performed, if the IP address information of the domain name www.example.com is not found in both the high-speed cache region and the low-speed cache region of the dedicated chip, the domain name resolution request of the domain name www.example.com needs to be forwarded to the recursive server, and the recursive server sends a query request to the entire DNS domain name resolution network to obtain a query result and return the query result to the user. The query result here may be a normal resolution result such as IP address information of the domain name www.example.com, or may be an abnormal resolution result such as absence of a domain name (nxdomain).

Preferably, in the embodiment of the present invention, step S1 of the domain name resolution caching method further includes

In step S11, the list of key domain names is updated periodically or aperiodically.

The key domain name list is a domain name list capable of performing high-speed domain name resolution, but the domain name to be subjected to high-speed domain name resolution is not fixed with a high probability, and the key domain name list needs to be updated regularly or irregularly. In the updating step, the domain name which needs to be subjected to high-speed domain name resolution can be added into the key domain name list, and the domain name which does not need to be subjected to high-speed domain name resolution is deleted from the key domain name list. The regular or irregular updating can be automatically updated by a program according to a preset rule, and the user can also automatically add or delete the domain name.

Further, in this embodiment, the key domain name list in the domain name resolution caching method is a list of domain names of N names before the number of domain name resolution requests in the history resolution request record, where N is greater than or equal to 5000 and less than or equal to 50000. The domain names with N names before the number of domain name resolution requests in the history resolution request record, namely the N domain names with the most accessed times, basically occupy more than 90% of the total number of the domain name resolution requests, so that the domain names with N names before the number of the domain name resolution requests in the history resolution request record can be resolved at high speed, and the efficiency of the whole domain name resolution service can be greatly improved. Generally, when N is 10000, that is, the emphasized domain name list includes domain names which are 1000 names before the number of domain name resolution requests in the history resolution request record, the emphasized domain name list may cover more than 95% of the total number of domain name resolution requests.

It should be noted that the construction method of the key domain name list is not limited to the number of domain name resolution requests recorded by referring to the historical resolution requests, and the key domain name list can be constructed according to other feature data of the domain name, such as the access amount, the access duration, the number of the accessed persons, and the like. Similarly, domain name screening can also be performed manually, such as domain names containing specified fields, domain names requiring significant attention, and the like.

Preferably, in the embodiment of the present invention, a dedicated chip used in the domain name resolution caching method is a field programmable gate array chip (FPGA). The FPGA is used as a semi-custom circuit in the field of Application Specific Integrated Circuits (ASIC), not only overcomes the defects of the custom circuit, but also overcomes the defect that the number of gate circuits of the original programmable device is limited, and realizes higher parallelism and data access speed through pipeline parallel and data parallel.

Specifically, in the domain name resolution caching method provided by the embodiment of the invention, a cache area of a Field Programmable Gate Array (FPGA) chip is a static random access memory, and a low-speed cache area is a block storage area.

The Static Random Access Memory (SRAM) has high data access speed and high cost, and is suitable for serving as a cache region of domain names in a key domain name list with less quantity and high access frequency; the block memory has a larger storage space and is a random access memory resource customized by the FPGA, and can store more domain name data although the speed of the block memory is not the same as that of a Static Random Access Memory (SRAM).

In an embodiment of the present invention, a domain name resolution caching method is provided, and a system structure for implementing the domain name resolution caching method is shown in fig. 3. The system structure of the domain name resolution caching method comprises a security policy subsystem 1, a DNS service subsystem 2, a high-speed cache region 3, a low-speed cache region 4, a recursive forwarding subsystem 5, a recursive server 6, a cache updating subsystem 7, a service management subsystem 8 and a log subsystem 9.

The security policy subsystem 1 is configured to determine security of the incoming and outgoing data, that is, a data packet of the domain name resolution request and the domain name response result can pass through the security policy subsystem 1 without a security problem, so as to perform transmission or resolution in the next step. Information interaction exists between the security policy subsystem 1 and the service management subsystem 8, and the security policy subsystem 1 can store data packet information such as date, time, user and the like into the log subsystem 9 for later calling and querying.

The DNS service subsystem 2 is configured to resolve domain name resolution request information to be transmitted from the security policy subsystem 1, then transmit the domain name requested to be resolved into the cache region 3, and receive a response result returned from the cache region 3 and/or the low-speed cache region 4. In addition, the DNS service subsystem 2 can also return back-end return information, such as a response result, to a requesting end, such as a user, through the security policy subsystem 1.

The high-speed cache region 3 and the low-speed cache region 4 respectively cache a part of domain name information, the domain name request will sequentially inquire the response results of the domain name requests such as the corresponding IP address information in the high-speed cache region 3 and the low-speed cache region 4, and the high-speed cache region 3 and the low-speed cache region 4 will return the inquired response results to the DNS service subsystem 2.

The recursive forwarding sub-system 5 can recursively forward the domain name resolution request transmitted from the low-speed cache region 4 to the external recursive server 6, and can transmit the response result of the domain name request returned by the recursive server 6 to the DNS service sub-system 2.

The recursive server 6 may be located outside the system, and is used for recursive query when there is no local cache result, that is, the recursive query is performed after receiving a domain name resolution request transmitted from the recursive forwarding subsystem 5, if there is no response information, the query request is recursively forwarded to the next-stage recursive server 6 until a certain recursive server 6 transmits back a corresponding response result, and then the corresponding response result is transmitted back to the recursive forwarding subsystem 5, and then the recursive forwarding subsystem 5 transmits back to the DNS service subsystem 2.

The cache update subsystem 7 is used for updating the domain name information cached in the cache block 3 and the low-speed cache block 4 periodically or aperiodically.

The security policy subsystem 1, the DNS service subsystem 2 and the cache update subsystem 7 above the service management subsystem 8 all have information interaction, so that the service management subsystem 8 systematically manages and monitors each flow of the whole system implementing the domain name resolution cache method.

The log subsystem 9 maintains information interaction with the security policy subsystem 1, and is used for recording and storing system log information such as date, time, action and the like of data packets transmitted through the security policy subsystem 1.

As shown in fig. 4, in an embodiment of the present invention, there is also provided a DNS server 10, where the DNS server 10 includes a memory 11 and one or more processors 12, at least a part of the processors 12 are dedicated chips, and when a program or instructions in the memory 11 is executed by the processors 12, the DNS server 10 can perform the following steps when performing domain name cache resolution:

step S1, establishing a key domain name list, caching the domain names in the key domain name list into a high-speed cache region of the special chip, and caching the domain names not in the key domain name list into a low-speed cache region of the special chip;

step S2, after receiving the domain name resolution request, inquiring in the cache region, if the domain name in the domain name resolution request is cached in the cache region, calling step S3 and returning the response result of the domain name resolution request;

in step S3, if the domain name in the domain name resolution request is not cached in the cache region, the query is performed in the low-speed cache region, and a response result of the domain name resolution request is returned.

In addition, it should be noted that the memory 11 may comprise a non-volatile memory, such as a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a FLASH memory (FLASH), or any other device capable of storing program instructions or data with or without an application power. The memory 11 may also include volatile memory such as Random Access Memory (RAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), and Synchronous Dynamic Random Access Memory (SDRAM), although other types of RAM may also be used to implement the memory 11. Memory 11 may be implemented using a single memory module or multiple memory modules. While memory 11 is depicted as being locally interconnected with processor 12, those skilled in the art will recognize that memory 11 may be provided separately from processor 12 in a different computer without departing from the scope of the subject technology.

Processor 12 may also include a general purpose processor, a processor core, a multiprocessor, a reconfigurable processor, a microcontroller, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Graphics Processing Unit (GPU), a field programmable gate array chip (FPGA), a Programmable Logic Device (PLD), a controller, a state machine, gated logic, discrete hardware components, or any other processing unit or combination of one or more processors.

Through the above steps, the DNS server 10 provided in the embodiment of the present invention can stably and greatly improve the resolution speed of domain name resolution, and can avoid performance loss of the DNS server 10 due to too low cache hit rate in domain name resolution.

In an embodiment of the present invention, a computer-readable storage medium is further provided, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements the steps of the domain name resolution caching method.

So far, the technical scheme of the invention has been described with reference to the attached drawings. However, it will be readily appreciated by those skilled in the art that the scope of the present invention is obviously not limited to the specific embodiments described above. Without departing from the principle of the invention, one skilled in the art can make equivalent changes or substitutions on the related technical features, and the technical solutions after the changes or substitutions will fall into the protection scope of the invention.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:模拟MCU中断方法、装置、终端及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类