Optimization method and terminal for DNS (Domain Name Server) data storage
By counting the total number of domain names of the target website and saving it into the file to be queryed by the browser plug-in, combined with the local DNS cache, the website access delay problem caused by the short browser DNS cache time is solved, and more efficient DNS data storage is achieved. access.
Patent Information
- Application Number
- CN202411155876.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-22
AI Technical Summary
Modern browsers have short DNS cache time, which leads to frequent access to DNS servers, increasing website access latency, especially when the old cache is removed in the case of multiple domain names, it cannot be effectively alleviated.
By counting the total number of domain names of the target website, if the preset threshold is exceeded, the domain name is stored in the file to be queried provided by the browser plug-in, combined with the local DNS cache, avoid unnecessary DNS server access and improve website access efficiency.
It effectively reduces the number of DNS server access times, improves website access efficiency, avoids the elimination of old caches, and meets the high access needs of well-known websites.
Smart Images

Figure CN119202425A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular to a DNS data storage optimization method and terminal. Background Art
[0002] In modern systems, the main way to implement server access is to separate the front-end and back-end, that is, the back-end is independently developed and deployed, and the front-end is also independently developed and deployed. The front-end mainly accesses various interfaces of the back-end through various browsers. In order to meet various requirements, the back-end will adopt a microservice architecture to deploy services. Different microservices require different domain names to access.
[0003] In order to prevent repeated access to the domain name server (DNS), the browser itself will use a certain cache to store the IP list information returned from the DNS. However, the browser's cache DNS time is relatively short, usually only 1 minute or less. When the browser accesses a URL with many domain names, the old cached domain names will be removed, and the DNS server will need to be accessed again, which will eventually increase the response delay of the request. Temporarily increasing the browser cache time or increasing the browser cache amount may alleviate the above problems, but it can only alleviate them to a certain extent. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a DNS data storage optimization method and terminal, which can flexibly cache a large amount of DNS domain name data and improve website access efficiency.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A method for optimizing DNS data storage comprises the following steps:
[0007] S1. Obtain all domain names associated with the target website and count the total number of all the domain names;
[0008] S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
[0009] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0010] An optimization terminal for DNS data storage includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0011] S1. Obtain all domain names associated with the target website and count the total number of all the domain names;
[0012] S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
[0013] The beneficial effects of the present invention are: providing a DNS data storage optimization method and terminal, for a single website, the total number of domain names it has will be counted, when the total number of domain names is less than or equal to a preset threshold, the domain name of the website will be stored in the local DNS cache according to the normal storage method of the browser, and when the total number of domain names exceeds the preset threshold, that is, the website has many domain names, occupies a large storage space, and takes a long time to store, then it will be stored in a to-be-queried file provided by a browser plug-in, the local DNS cache and the to-be-queried file are used in combination to avoid the old cache from being eliminated, reduce the number of unnecessary DNS server accesses, and improve website access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A schematic diagram of the steps of a DNS data storage optimization method of the present invention;
[0015] Figure 2 A system block diagram of an optimization terminal for DNS data storage according to the present invention.
[0016] Description of labels:
[0017] 1. An optimized terminal for DNS data storage; 2. A memory; 3. A processor. DETAILED DESCRIPTION
[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0019] Please refer to Figure 1 , a DNS data storage optimization method, comprising the following steps:
[0020] S1. Obtain all domain names associated with the target website and count the total number of all the domain names;
[0021] S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
[0022] From the above description, it can be seen that the beneficial effect of the present invention is that: for a single website, the total number of domain names it has will be counted. When the total number of domain names is less than or equal to a preset threshold, the domain name of the website will be stored in the local DNS cache according to the normal storage method of the browser. When the total number of domain names exceeds the preset threshold, that is, the website has many domain names, occupies a large storage space, and takes a long time to store, they will be stored in a to-be-queried file provided by the browser plug-in. The local DNS cache and the to-be-queried file are used in combination to avoid the elimination of the old cache, reduce unnecessary DNS server access times, and improve website access efficiency.
[0023] Furthermore, the method further comprises the steps of:
[0024] S3, obtaining the website to be visited requested by the user, and determining whether the total number of all domain names associated with the website to be visited exceeds a preset threshold, if so, executing step S4, otherwise executing step S5;
[0025] S4, determining whether the to-be-queried file contains a domain name corresponding to the to-be-visited website; if so, accessing the corresponding domain name; otherwise, obtaining the domain name of the to-be-visited website from the DNS server, writing all the domain names of the to-be-visited website into the to-be-queried file, and accessing the domain name of the to-be-visited website;
[0026] S5. Determine whether the local DNS cache has a domain name corresponding to the website to be visited. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be visited from the DNS server, write all domain names of the website to be visited into the local DNS cache, and access the domain name of the website to be visited.
[0027] From the above description, it can be seen that after receiving the user's access request, the corresponding domain name is searched from the to-be-queried file or the local DNS cache according to the number of domain names associated with the to-be-accessed website corresponding to the request. During the query process, if the domain name of the website is not found, it is obtained from the DNS server and accessed after the domain name is stored. In this way, the old domain name query process is changed, and the local DNS cache and the to-be-queried file are used closely together, making the acquisition of domain names more flexible and changeable.
[0028] Furthermore, the step S2 further includes:
[0029] Obtain a user setting instruction, and obtain the data storage structure of the to-be-queried file, the address query method, and the data expiration condition corresponding to the domain name of each target website from the user setting instruction.
[0030] From the above description, it can be seen that after the domain name is stored in the file to be queried on the browser plug-in, the user can set the data storage structure, address query method and data expiration conditions of the file to be queried, and the domain name of each target website, so as to realize customized storage configuration and flexible change to meet different usage requirements.
[0031] Furthermore, the step S1 further includes:
[0032] Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as the first threshold and execute step S2.
[0033] From the above description, it can be seen that when the target website is a well-known website, that is, it has a large number of associated domain names and is frequently visited, the preset threshold can be increased to ensure that more well-known websites are retained in the local DNS cache, making full use of the faster access speed of the local DNS cache to provide users with a more efficient access experience.
[0034] Furthermore, the method further comprises the following steps:
[0035] S6. Eliminate expired domain names in the local DNS cache and the file to be queried, and determine whether the current total number of domain names of websites in the file to be queried is less than or equal to the preset threshold. If so, transfer all domain names of the website to the local DNS cache.
[0036] From the above description, it can be seen that the expired domain names are cleaned up and the storage space is optimized. After the cleaning, the domain names of websites whose current total number of domain names is less than or equal to the preset threshold are transferred from the to-be-queried file to the local DNS cache, which helps users find domain names from the local DNS cache as much as possible while flexibly storing them, thereby improving website access efficiency.
[0037] Please refer to Figure 2 , a DNS data storage optimization terminal 1, including a memory 2, a processor 3 and a computer program stored in the memory and executable on the processor, the processor 3 implements the following steps when executing the computer program:
[0038] S1. Obtain all domain names associated with the target website and count the total number of all the domain names;
[0039] S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
[0040] From the above description, it can be seen that the beneficial effect of the present invention is that: for a single website, the total number of domain names it has will be counted. When the total number of domain names is less than or equal to a preset threshold, the domain name of the website will be stored in the local DNS cache according to the normal storage method of the browser. When the total number of domain names exceeds the preset threshold, that is, the website has many domain names, occupies a large storage space, and takes a long time to store, they will be stored in a to-be-queried file provided by the browser plug-in. The local DNS cache and the to-be-queried file are used in combination to avoid the elimination of the old cache, reduce unnecessary DNS server access times, and improve website access efficiency.
[0041] Furthermore, the method further comprises the steps of:
[0042] S3, obtaining the website to be visited requested by the user, and determining whether the total number of all domain names associated with the website to be visited exceeds a preset threshold, if so, executing step S4, otherwise executing step S5;
[0043] S4, determining whether the to-be-queried file contains a domain name corresponding to the to-be-visited website; if so, accessing the corresponding domain name; otherwise, obtaining the domain name of the to-be-visited website from the DNS server, writing all the domain names of the to-be-visited website into the to-be-queried file, and accessing the domain name of the to-be-visited website;
[0044] S5. Determine whether the local DNS cache has a domain name corresponding to the website to be visited. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be visited from the DNS server, write all domain names of the website to be visited into the local DNS cache, and access the domain name of the website to be visited.
[0045] From the above description, it can be seen that after receiving the user's access request, the corresponding domain name is searched from the to-be-queried file or the local DNS cache according to the number of domain names associated with the to-be-accessed website corresponding to the request. During the query process, if the domain name of the website is not found, it is obtained from the DNS server and accessed after the domain name is stored. In this way, the old domain name query process is changed, and the local DNS cache and the to-be-queried file are used closely together, making the acquisition of domain names more flexible and changeable.
[0046] Furthermore, the step S2 further includes:
[0047] Obtain a user setting instruction, and obtain the data storage structure of the to-be-queried file, the address query method, and the data expiration condition corresponding to the domain name of each target website from the user setting instruction.
[0048] From the above description, it can be seen that after the domain name is stored in the file to be queried on the browser plug-in, the user can set the data storage structure, address query method and data expiration conditions of the file to be queried, and the domain name of each target website, so as to realize customized storage configuration and flexible change to meet different usage requirements.
[0049] Furthermore, the step S1 further includes:
[0050] Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as the first threshold and execute step S2.
[0051] From the above description, it can be seen that when the target website is a well-known website, that is, it has a large number of associated domain names and is frequently visited, the preset threshold can be increased to ensure that more well-known websites are retained in the local DNS cache, making full use of the faster access speed of the local DNS cache to provide users with a more efficient access experience.
[0052] Furthermore, the method further comprises the following steps:
[0053] S6: Eliminate the expired domain names in the local DNS cache and the file to be queried, and determine whether the current total number of domain names of websites in the file to be queried is less than or equal to the preset threshold. If so, transfer all domain names of the website to the local DNS cache.
[0054] From the above description, it can be seen that the expired domain names are cleaned up and the storage space is optimized. After the cleaning, the domain names of websites whose current total number of domain names is less than or equal to the preset threshold are transferred from the to-be-queried file to the local DNS cache, which helps users find domain names from the local DNS cache as much as possible while flexibly storing them, thereby improving website access efficiency.
[0055] Please refer to Figure 1 , Embodiment 1 of the present invention is:
[0056] A method for optimizing DNS data storage comprises the following steps:
[0057] S1. Obtain all domain names associated with the target website and count the total number of all domain names;
[0058] In this embodiment, the above functions are realized by installing a plug-in on the browser. As the browser is running, the plug-in performs statistics on the number of domain names for a single website address, that is, the number of different domain names requested on each single website is counted; for websites where the number of different domain names requested on the website is greater than a preset threshold, it is considered that the total amount of data related to the domain name required is large, and storing it in the local DNS with limited capacity will affect the cache of other websites with fewer domain names. The preset threshold can generally be selected as 4 to 7, preferably 5; at the same time, a list of well-known websites is preset, and when storing, it is determined whether the target website belongs to the preset list of well-known websites. If so, the preset threshold is set as the first threshold and step S2 is executed. The numerical value of the first threshold is greater than the preset threshold by default, and can be determined specifically according to the number of domain names of each website on the preset list of well-known websites and user needs.
[0059] S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all domain names in a local DNS cache of the browser.
[0060] In this embodiment, for some target websites, the total number of domain names at the beginning is generally less than the preset threshold, so they can be stored in the local DNS cache of the browser. Later, when the existing domain names are not expired or invalid, and new associated domain names are added, the total number of domain names is greater than the preset threshold. At this time, all domain names are stored in the to-be-queried file of the browser plug-in, and the domain names originally stored in the local DNS cache are deleted.
[0061] Moreover, in the file to be queried, the domain name is stored in a map data structure; the key is the address of a single website, field_1 is count, and value_1 is the number of domain names associated with it. Field_2 is the corresponding associated domain name, and value_2 is the IP of the associated domain name. Similarly, the address information of other domain names such as field_3, 4, and 5 will be recorded. On this basis, the user setting instructions are obtained, and the data storage structure, address query method, and data expiration conditions corresponding to the domain name of each target website of the file to be queried are obtained from the user setting instructions. Since the file to be queried does not have the capacity limit of the local DNS cache of the browser, and can be customized according to user needs, the URL access can be made more flexible and efficient. For example, the map structure used above can quickly query the IP information based on a single web page address + the domain name visited.
[0062] S3, obtaining the website to be visited requested by the user, and determining whether the total number of all domain names associated with the website to be visited exceeds a preset threshold, if so, executing step S4, otherwise executing step S5;
[0063] In this embodiment, corresponding to the statistical function performed by the above plug-in, when a user visits a website, the number of domain names associated with the website can be known based on the previous statistical results, and then it can be determined whether to query the relevant information of the domain name from the local DNS cache or from the to-be-queried file. For a new website, it is assumed that the total number of domain names associated with it at the beginning is less than the preset threshold, and the domain name of the website to be visited needs to be obtained from the DNS server.
[0064] S4, determining whether the to-be-queried file contains a domain name corresponding to the to-be-visited website. If so, access the corresponding domain name. Otherwise, obtain the domain name of the to-be-visited website from the DNS server, write all the domain names of the to-be-visited website into the to-be-queried file, and access the domain name of the to-be-visited website.
[0065] In this embodiment, when querying the domain name of the website to be visited, it is possible that due to some reasons, no relevant information about the domain name of the website is found in the file to be queried. In this case, it is necessary to obtain the domain name of the website to be visited from the DNS server and rewrite it. A similar approach is used when querying in the local DNS cache to ensure that the user's access is completed as much as possible.
[0066] S5. Determine whether the local DNS cache has a domain name corresponding to the website to be visited. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be visited from the DNS server, write all the domain names of the website to be visited into the local DNS cache, and access the domain name of the website to be visited.
[0067] S6. Eliminate expired domain names in the local DNS cache and the file to be queried, and determine whether the current total number of domain names of the website in the file to be queried is less than or equal to a preset threshold. If so, transfer all domain names of the website to the local DNS cache.
[0068] In this embodiment, since the browser's access speed to the local DNS cache is faster than the access speed to the query plug-in, after the current total number of domain names of websites in the file to be queried is less than or equal to a preset threshold, the relevant information of the domain name of the website can be transferred to the local DNS cache; at the same time, when the expired domain names in the local DNS cache and the file to be queried are eliminated, the statistical results of the total number of domain names of stored websites are synchronously updated to facilitate the finding of the transferred data.
[0069] Please refer to Figure 2 , Embodiment 2 of the present invention is:
[0070] A DNS data storage optimization terminal 1 includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, a DNS data storage optimization method of embodiment 1 is implemented.
[0071] In summary, the present invention provides a method and terminal for optimizing DNS data storage. For a single website, the total number of domain names it has will be counted. When the total number of domain names is less than or equal to a preset threshold, the domain name of the website will be stored in the local DNS cache according to the normal storage method of the browser. When the total number of domain names exceeds the preset threshold, that is, the website has many domain names, occupies a large storage space, and takes a long time to store, it will be stored in the to-be-queried file provided by the browser plug-in. At the same time, a map structure is used in the to-be-queried file, and the IP information can be quickly queried based on a single web page address + the domain name visited, so that the local DNS cache and the to-be-queried file cooperate, and the relevant information of the domain name is interactively stored, and the change is flexible, so as to avoid the elimination of the old cache, reduce the number of unnecessary DNS server visits, and improve the website access efficiency.
[0072] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for optimizing DNS data storage, characterized in that: The steps include: S1. Obtain all domain names associated with the target website and count the total number of all the domain names; S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
2. A DNS data storage optimization method according to claim 1, characterized in that: Also includes the steps: S3, obtaining the website to be visited requested by the user, and determining whether the total number of all domain names associated with the website to be visited exceeds a preset threshold, if so, executing step S4, otherwise executing step S5; S4, determining whether the to-be-queried file contains a domain name corresponding to the to-be-visited website; if so, accessing the corresponding domain name; otherwise, obtaining the domain name of the to-be-visited website from the DNS server, writing all the domain names of the to-be-visited website into the to-be-queried file, and accessing the domain name of the to-be-visited website; S5. Determine whether the local DNS cache has a domain name corresponding to the website to be visited. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be visited from the DNS server, write all domain names of the website to be visited into the local DNS cache, and access the domain name of the website to be visited.
3. The method for optimizing DNS data storage according to claim 1, characterized in that: The step S2 further comprises: Obtain a user setting instruction, and obtain the data storage structure of the to-be-queried file, the address query method, and the data expiration condition corresponding to the domain name of each target website from the user setting instruction.
4. The method for optimizing DNS data storage according to claim 1, characterized in that: The step S1 further comprises: Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as the first threshold and execute step S2.
5. The method for optimizing DNS data storage according to claim 1, characterized in that: The following steps are also included: S6. Eliminate expired domain names in the local DNS cache and the file to be queried, and determine whether the current total number of domain names of websites in the file to be queried is less than or equal to the preset threshold. If so, transfer all domain names of the website to the local DNS cache.
6. An optimization terminal for DNS data storage, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: S1. Obtain all domain names associated with the target website and count the total number of all the domain names; S2. Determine whether the total number of domain names of the target website is greater than a preset threshold. If so, store all the domain names in a to-be-queried file used by a browser plug-in to provide domain names. Otherwise, store all the domain names in a local DNS cache of the browser.
7. The DNS data storage optimization terminal according to claim 6, characterized in that: Also includes the steps: S3, obtaining the website to be visited requested by the user, and determining whether the total number of all domain names associated with the website to be visited exceeds a preset threshold, if so, executing step S4, otherwise executing step S5; S4, determining whether the to-be-queried file contains a domain name corresponding to the to-be-visited website; if so, accessing the corresponding domain name; otherwise, obtaining the domain name of the to-be-visited website from the DNS server, writing all the domain names of the to-be-visited website into the to-be-queried file, and accessing the domain name of the to-be-visited website; S5. Determine whether the local DNS cache has a domain name corresponding to the website to be visited. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be visited from the DNS server, write all domain names of the website to be visited into the local DNS cache, and access the domain name of the website to be visited.
8. The DNS data storage optimization terminal according to claim 6, characterized in that: The step S2 further comprises: Obtain a user setting instruction, and obtain the data storage structure of the to-be-queried file, the address query method, and the data expiration condition corresponding to the domain name of each target website from the user setting instruction.
9. The DNS data storage optimization terminal according to claim 6, characterized in that: The step S1 further comprises: Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as the first threshold and execute step S2.
10. The DNS data storage optimization terminal according to claim 6, characterized in that: The following steps are also included: S6. Eliminate expired domain names in the local DNS cache and the file to be queried, and determine whether the current total number of domain names of websites in the file to be queried is less than or equal to the preset threshold. If so, transfer all domain names of the website to the local DNS cache.
Citation Information
Patent Citations
Method, device and system for defending DNS recursive attack
CN105119906A
Domain name resolution method and device and network equipment
CN108881515A
Domain name caching method, device and system, storage medium and computer equipment
CN114124893A
Resolving Domain Name System (DNS) Requests Via Proxy Mechanisms
US20180131665A1
