DNS data storage optimization method and terminal
By counting the total number of domain names and storing domain names that exceed the threshold in the browser plug-in, combined with local DNS cache, the DNS access delay problem caused by short browser cache time is solved, and more efficient website access is achieved.
Patent Information
- Application Number
- CN202411155876.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-08-22
AI Technical Summary
The browser caches DNS for a short time, resulting in frequent access to the DNS server and increased request response delay. Existing methods such as increasing the cache time or cache amount can only alleviate the problem to a certain extent.
By counting the total number of domain names of the target website, when the threshold is exceeded, the domain names are stored in the browser plug-in's pending query file. Combined with the local DNS cache, domain name storage can be flexibly managed to reduce unnecessary DNS server access.
It improves website access efficiency, reduces the number of DNS server visits, avoids the elimination of old caches, and provides a flexible domain name management method.
Smart Images

Figure CN119202425B_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, server access is primarily achieved through front-end and back-end separation, with the back-end and front-end being developed and deployed independently. The front-end primarily accesses back-end interfaces through various browsers. To meet diverse requirements, the back-end adopts a microservices architecture for service deployment. Different microservices require multiple domain names for access.
[0003] To prevent repeated access to the domain name server (DNS), browsers use a certain amount of cache to store the IP list information returned from the DNS. However, the browser's DNS cache 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, ultimately increasing the response delay of the request. Temporarily increasing the browser cache time or increasing the browser cache size may alleviate the above problem, but only 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 includes the following steps:
[0007] S1. Obtain all domain names associated with the target website and count the total number of all 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 file to be queried that is used by a browser plug-in to provide domain names. Otherwise, store all the domain names in the 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] A DNS data storage optimization terminal 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 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 file to be queried that is used by a browser plug-in to provide domain names. Otherwise, store all the domain names in the 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 the browser plug-in, and the local DNS cache and the to-be-queried file will be used in combination to avoid the old cache from being eliminated, reduce the number of unnecessary DNS server visits, 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 This is a system block diagram of a DNS data storage optimization terminal of 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] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.
[0019] Please refer to Figure 1 , a method for optimizing DNS data storage, comprising the following steps:
[0020] S1. Obtain all domain names associated with the target website and count the total number of all 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 file to be queried that is used by a browser plug-in to provide domain names. Otherwise, store all the domain names in the 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 the 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 old cache from being eliminated, reduce the number of unnecessary DNS server visits, 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. Determine 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.
[0026] S5. Determine whether the local DNS cache has the 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.
[0027] From the above description, it can be seen that after receiving the user's access request, the corresponding domain name is determined from the to-be-queried file or the local DNS cache based on the number of domain names associated with the website to be accessed 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 file to be queried, 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 realize customized storage configuration and flexible changes to meet different usage needs.
[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 a 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 accessed, the preset threshold can be increased to ensure that more well-known websites are retained in the local DNS cache, fully utilizing 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 expired domain names are cleaned up and storage space is optimized. After cleaning, the domain names of websites whose current total number of domain names is less than or equal to a preset threshold are transferred from the to-be-queried file to the local DNS cache. While providing flexible storage, it helps users find domain names from the local DNS cache as much as possible, thereby improving website access efficiency.
[0037] Please refer to Figure 2 A DNS data storage optimization terminal 1 includes a memory 2, a processor 3, and a computer program stored in the memory and executable on the processor. When the processor 3 executes the computer program, the following steps are implemented:
[0038] S1. Obtain all domain names associated with the target website and count the total number of all 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 file to be queried that is used by a browser plug-in to provide domain names. Otherwise, store all the domain names in the 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 the 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 old cache from being eliminated, reduce the number of unnecessary DNS server visits, 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. Determine 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.
[0044] S5. Determine whether the local DNS cache has the 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.
[0045] From the above description, it can be seen that after receiving the user's access request, the corresponding domain name is determined from the to-be-queried file or the local DNS cache based on the number of domain names associated with the website to be accessed 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 file to be queried, 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 realize customized storage configuration and flexible changes to meet different usage needs.
[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 a 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 accessed, the preset threshold can be increased to ensure that more well-known websites are retained in the local DNS cache, fully utilizing 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 expired domain names in the local DNS cache and the file to be queried, and determine whether the 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 expired domain names are cleaned up and storage space is optimized. After cleaning, the domain names of websites whose current total number of domain names is less than or equal to a preset threshold are transferred from the to-be-queried file to the local DNS cache. While providing flexible storage, it helps users find domain names from the local DNS cache as much as possible, 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 includes 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 achieved by installing a plug-in on the browser. As the browser is running, the plug-in counts the number of domain names for a single website address, that is, counts the number of different domain names requested on each single website. For websites where the number of different domain names requested 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 from 4 to 7, preferably 5. At the same time, a list of well-known websites is preset. 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 based on 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 provided by a browser plug-in for providing domain names. Otherwise, store all domain names in the local DNS cache of the browser.
[0060] In this embodiment, for some target websites, the total number of domain names is generally less than a preset threshold at the beginning, so they can be stored in the browser's local DNS cache. Later, when the existing domain names have not expired or become invalid, and new associated domain names are added, and the total number of domain names exceeds the preset threshold, all domain names are stored in the browser plug-in's pending query file, 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 using 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 address 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 browser's local DNS cache, and can be customized according to user needs, URL access can be made more flexible and efficient. For example, the above-mentioned map structure can be used to quickly query IP information based on a single web page address + the domain name to be visited.
[0062] S3. Obtain the website to be visited requested by the user, and determine whether the total number of all domain names associated with the website to be visited exceeds a preset threshold. If so, execute step S4; otherwise, execute step S5.
[0063] In this embodiment, corresponding to the statistical function performed by the above-mentioned plug-in, when a user visits a website, the number of domain names associated with the website can be determined based on previous statistical results. Based on this, it is determined whether to query the local DNS cache for domain name information or the pending query file. For a new website, it is assumed that the total number of domain names associated with the website is less than a preset threshold, and the domain name of the website to be visited needs to be obtained from the DNS server.
[0064] S4. Determine whether the file to be queried contains 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 file to be queried, and access the domain name of the website to be visited.
[0065] In this embodiment, when querying the domain name of the website to be visited, it is possible that for some reason, 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 the 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 website domain names in the file to be queried is less than or equal to a preset threshold, the relevant information of the website domain name 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 stored website domain names are synchronously updated so that the transferred data can be found.
[0069] Please refer to Figure 2 , the second embodiment 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 according to 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 is counted. When the total number of domain names is less than or equal to a preset threshold, the website's domain name is stored in the local DNS cache in accordance with the browser's normal storage method. When the total number of domain names exceeds the preset threshold, that is, the website has many domain names, occupies a large amount of storage space, and takes a long time to store, the domain name is stored in a to-be-queried file provided by a browser plug-in. At the same time, a map structure is used in the to-be-queried file, which can quickly query IP information based on a single web page address + the domain name being accessed. This allows the local DNS cache and the to-be-queried file to cooperate and interactively store domain name-related information. This allows for flexible changes, prevents the old cache from being eliminated, reduces unnecessary DNS server access times, and improves 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 description 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 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 the browser plug-in to provide domain names. Otherwise, store all the domain names in the browser's local DNS cache. 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. Determine 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. S5. Determine whether the local DNS cache contains the domain name corresponding to the website to be accessed. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be accessed from the DNS server, write all the domain names of the website to be accessed into the local DNS cache, and access the domain name of the website to be accessed. The step S2 further includes: Obtaining a user setting instruction, and obtaining 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; 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.
2. The method for optimizing DNS data storage according to claim 1, wherein: The step S1 further includes: Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as a first threshold and execute step S2.
3. A DNS data storage optimization terminal, 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 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 the browser plug-in to provide domain names. Otherwise, store all the domain names in the browser's local DNS cache. 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. Determine 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. S5. Determine whether the local DNS cache contains the domain name corresponding to the website to be accessed. If so, access the corresponding domain name. Otherwise, obtain the domain name of the website to be accessed from the DNS server, write all the domain names of the website to be accessed into the local DNS cache, and access the domain name of the website to be accessed. The step S2 further includes: Obtaining a user setting instruction, and obtaining 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; 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.
4. The DNS data storage optimization terminal according to claim 3, characterized in that: The step S1 further includes: Determine whether the target website belongs to a preset list of well-known websites. If so, set the preset threshold as a first threshold and execute step S2.
Citation Information
Patent Citations
Method, device and system for defending DNS recursive attack
CN105119906A
Domain name resolution method and device and network equipment
CN108881515A