CN115967746A - Domain name cache replacement method and system based on time window - Google Patents

Domain name cache replacement method and system based on time window Download PDF

Info

Publication number
CN115967746A
CN115967746A CN202211705260.XA CN202211705260A CN115967746A CN 115967746 A CN115967746 A CN 115967746A CN 202211705260 A CN202211705260 A CN 202211705260A CN 115967746 A CN115967746 A CN 115967746A
Authority
CN
China
Prior art keywords
domain name
cache
time window
resource record
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211705260.XA
Other languages
Chinese (zh)
Inventor
张广兴
姜海洋
吴颖
夏可强
王伟
王嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Future Networks Innovation Institute
Original Assignee
Jiangsu Future Networks Innovation Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Future Networks Innovation Institute filed Critical Jiangsu Future Networks Innovation Institute
Priority to CN202211705260.XA priority Critical patent/CN115967746A/en
Publication of CN115967746A publication Critical patent/CN115967746A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a domain name cache replacement method and system based on a time window. The method comprises the steps of receiving a query request of a domain name in real time by responding to a DNS (domain name system), and classifying the received domain name into a disposable domain name or a non-disposable domain name by adopting a domain name classifier; if the received domain name is a non-disposable domain name, the current domain name directly enters the hierarchical cache processing; if the received domain name is a disposable domain name, the current domain name is processed in advance through a time window and then enters a hierarchical cache. Compared with the prior art, the invention has the following remarkable advantages: the method for judging the disposable domain name by adding the time window on the basis of the domain name characteristics is adopted, the problem that the existing domain name classification method is easy to misjudge is solved, negative effects caused by discarding the non-disposable domain name are avoided, and the accuracy of domain name identification is improved.

Description

一种基于时间窗的域名缓存替换方法和系统A method and system for replacing domain name cache based on time window

技术领域technical field

本发明涉及互联网信息技术领域,特别是一种基于时间窗的域名缓存替换方法和系统。The invention relates to the field of Internet information technology, in particular to a time window-based domain name cache replacement method and system.

背景技术Background technique

随着互联网技术的发展,DNS在常规将域名解析到IP的功能外,经常作为一个有效的渠道进行服务间的通信;然而随着DNS应用范围的扩展带也来了域名滥用问题,出现了出于临时用途,即具有“一次性”的使用模式和极高的数量域名。其主要特性是使得DNS缓存中充满了命中率接近零的条目,且多次访问域名被提前替换出缓存。因此,这种一次性域名使得缓存命中率降低,造成转发流量增多、服务器负载加重等问题。With the development of Internet technology, DNS is often used as an effective channel for communication between services in addition to the normal function of resolving domain names to IP; For temporary use, i.e. with a "one-shot" usage pattern and very high volume domain names. Its main feature is that the DNS cache is filled with entries with a hit rate close to zero, and domain names accessed many times are replaced out of the cache in advance. Therefore, this one-time domain name reduces the cache hit rate, causing problems such as increased forwarding traffic and increased server load.

同时,随着域名请求行为以及名称特征的复杂化,现有的一次性域名识别方法面临着精准度下降的问题,在一些场景下,比如与某云平台下载活动有关的域名请求,这类请求具有相同区域,该区域下域名结构完全一致,具有相同深度,请求数量庞大。虽然,此类域名名称特征具备一次性域名特点,但需要被再次访问,如不被保存则会造成一定缓存缺失,即这类被再次访问的“一次性”域名无法单纯凭借名称特征对其进行区分。同时,现有方法在一次性域名方法识别上不管是基于名称特征、语义特征还是名称结构等分析,都无法保证做到完全精确识别,且一次性域名中仍存在一些特例,造成缓存命中率降低,进而也对递归服务器和远端服务器之间流量负载和用户查询延迟造成影响。At the same time, with the complexity of domain name request behavior and name features, the existing one-time domain name identification methods are facing the problem of decreased accuracy. In some scenarios, such as domain name requests related to download activities on a cloud platform, such requests With the same area, the domain name structure under this area is exactly the same, with the same depth, and the number of requests is huge. Although this type of domain name has the characteristics of a one-time domain name, it needs to be accessed again. If it is not saved, it will cause a certain cache loss. distinguish. At the same time, the existing methods for the identification of one-time domain names, whether based on the analysis of name features, semantic features, or name structures, cannot guarantee complete and accurate identification, and there are still some special cases in one-time domain names, resulting in a decrease in the cache hit rate , which in turn affects the traffic load and user query delay between the recursive server and the remote server.

文献1:中国公开发明专利CN202111452686.4要求保护一种域名筛选方法、系统、装置及计算机可读存储介质,通过精简数据量来确保获取到的域名大概率是经常使用的,但是其作用在于利用DNS解析日志从所得到的域名中去除异常域名,得到有效域名;并不能解决一次性域名识别处理的问题。Document 1: Chinese published invention patent CN202111452686.4 claims to protect a domain name screening method, system, device, and computer-readable storage medium. It is often used to ensure that the obtained domain names are highly probable by reducing the amount of data, but its function is to use The DNS resolution log removes the abnormal domain name from the obtained domain name to obtain a valid domain name; it cannot solve the problem of one-time domain name identification and processing.

发明内容Contents of the invention

本发明的目的在于提供一种基于时间窗的域名缓存替换方法和系统,根据提取名称特征方式构建域名分类器,利用时间窗增加时间特征对域名进行二次识别,结合域名缓存替换功能,仅将被识别为非一次性域名的资源记录放入缓存,实现对一次性域名的有效去除。The purpose of the present invention is to provide a domain name cache replacement method and system based on time windows, construct a domain name classifier according to the method of extracting name features, use time windows to increase time features to perform secondary identification of domain names, combined with the domain name cache replacement function, only Resource records identified as non-disposable domain names are placed in the cache to effectively remove disposable domain names.

实现本发明目的的技术解决方案为:The technical solution that realizes the object of the present invention is:

一种基于时间窗的域名缓存替换方法,其特征在于:该方法包括:A method for replacing a domain name cache based on a time window, characterized in that: the method includes:

响应DNS实时接收域名的查询请求,通过域名分类器将接收到的域名分类为一次性域名或非一次性域名;Respond to the query request of the DNS to receive domain names in real time, and use the domain name classifier to classify the received domain names as one-time domain names or non-disposable domain names;

若接收到的域名为非一次性域名,则当前域名直接进入分级缓存处理;若接收到的域名为一次性域名,则预先对当前域名进行时间窗处理后进入分级缓存处理。If the received domain name is a non-disposable domain name, the current domain name will directly enter the hierarchical cache processing; if the received domain name is a one-time domain name, the current domain name will be processed in a time window before entering the hierarchical cache processing.

进一步的,域名的查询请求在DNS内形成对应的资源记录,其中,一次性域名表示在DNS内存在对应资源记录为一次的域名,非一次性域名表示在DNS内存在对应资源记录大于一次的域名。Further, the query request of the domain name forms a corresponding resource record in the DNS, wherein, the one-time domain name means that there is a domain name with a corresponding resource record in the DNS, and the non-one-time domain name means that there is a domain name with a corresponding resource record in the DNS more than once .

进一步的,时间窗处理为:Further, the time window processing is:

在预先设置时间周期内,当当前域名的查询次数达到阈值时,对当前域名的资源记录进行分级缓存处理;Within the preset time period, when the number of queries of the current domain name reaches the threshold, the resource records of the current domain name are cached hierarchically;

若当前域名的查询次数未达到阈值,则丢弃当前域名的资源记录,返回继续响应DNS实时接收域名的查询请求;If the number of queries of the current domain name does not reach the threshold, discard the resource record of the current domain name, and return to continue to respond to the query request of DNS to receive the domain name in real time;

其中,当前域名的查询次数是通过累计得到的,包括外来客户端的查询次数以及域名分类器发送的同一域名出现的次数。Wherein, the query times of the current domain name are obtained through accumulation, including the query times of external clients and the occurrence times of the same domain name sent by the domain name classifier.

进一步的,分级缓存包括低级缓存和高级缓存,具体处理步骤为:Further, hierarchical caching includes low-level caching and high-level caching, and the specific processing steps are:

判断当前域名的资源记录是否为第一次存放,若是,则将当前域名的资源记录放入低级缓存中;反之,将当前域名的资源记录放入高级缓存中,并累计当前域名的资源记录的缓存次数;Determine whether the resource records of the current domain name are stored for the first time, and if so, put the resource records of the current domain name into the low-level cache; otherwise, put the resource records of the current domain name into the high-level cache, and accumulate the resource records of the current domain name number of caches;

当高级缓存被填满时,累计所有缓存域名的资源记录缓存次数,并且将其中缓存次数最少的域名降级存放至低级缓存中;当低级缓存被填满时,累计所有缓存域名的资源记录缓存次数,并且并移除其中缓存次数最少的域名。When the high-level cache is full, accumulate the resource record cache times of all cached domain names, and downgrade the domain name with the least cache times to the low-level cache; when the low-level cache is full, accumulate the resource record cache times of all cached domain names , and remove the domain with the least number of caches.

本发明还提供了一种基于时间窗的域名缓存替换系统,包括域名分类单元、时间窗处理单元以及分级缓存单元,其中:The present invention also provides a domain name cache replacement system based on time windows, including a domain name classification unit, a time window processing unit and a hierarchical cache unit, wherein:

域名分类单元,用于获取DNS接收的域名查询请求,根据名称特征分类法对域名进行分类,并将分类结果发送至时间窗处理单元;The domain name classification unit is used to obtain the domain name query request received by the DNS, classify the domain name according to the name feature classification method, and send the classification result to the time window processing unit;

时间窗处理单元,用于基于分类结果对域名在预先设置时间周期内的查询次数进行记录;A time window processing unit, configured to record the number of queries of domain names within a preset time period based on classification results;

分级缓存单元,用于接收满足缓存阈值条件的域名进行分级缓存处理,并移除其中缓存次数最少的域名。The hierarchical caching unit is configured to receive domain names satisfying the caching threshold condition for hierarchical caching processing, and remove the domain name with the least number of caching times.

进一步的,域名的查询请求在DNS内形成对应的资源记录,分类结果为统计所述域名在DNS内存在对应的资源记录次数。Further, the domain name query request forms a corresponding resource record in the DNS, and the classification result is counting the number of times the domain name has a corresponding resource record in the DNS.

进一步的,时间窗处理单元包括若干个滑动时间窗,若干个滑动时间窗设置有不同的时间范围和查询阈值,每个滑动时间窗内置有过期缓存库,过期缓存库为带有过期自动刷新属性的有序字典。Further, the time window processing unit includes several sliding time windows, and several sliding time windows are set with different time ranges and query thresholds. Each sliding time window has a built-in expired cache library, and the expired cache library has an expired automatic refresh attribute An ordered dictionary of .

进一步的,时间窗处理单元的具体处理流程为:Further, the specific processing flow of the time window processing unit is:

选定任意一个滑动时间窗,判断在滑动时间窗的时间范围内,域名的查询次数是否达到查询阈值;若达到,则将域名的资源记录存放至分级缓存单元,反之,则丢弃域名;Select any sliding time window, and judge whether the number of domain name queries reaches the query threshold within the time range of the sliding time window; if so, store the resource records of the domain name in the hierarchical cache unit, otherwise, discard the domain name;

其中,域名的查询次数通过累计得到,包括外来客户端的查询次数以及域名分类单元发送的分析结果中同一域名出现的次数。Wherein, the number of queries of the domain name is accumulated, including the number of queries of external clients and the number of occurrences of the same domain name in the analysis results sent by the domain name classification unit.

进一步的,分级缓存单元包括低级缓存区和高级缓存区,具体操作步骤为:Further, the hierarchical cache unit includes a low-level cache area and a high-level cache area, and the specific operation steps are:

判断域名的资源记录是否是第一次存放,若是,则将域名的资源记录放入低级缓存区中;反之,将域名的资源记录放入高级缓存区中,并累计域名的资源记录的缓存次数;Determine whether the resource record of the domain name is stored for the first time, if so, put the resource record of the domain name into the low-level cache; otherwise, put the resource record of the domain name into the high-level cache, and accumulate the cache times of the resource record of the domain name ;

采用LRU算法对存放的所有域名的缓存次数进行统计排序,当高级缓存区被填满时,将缓存次数最少的域名降级移存到低级缓存区;当低级缓存区被填满时,将缓存次数最少的域名直接移除。The LRU algorithm is used to statistically sort the cache times of all stored domain names. When the high-level cache area is full, the domain name with the least cache times will be downgraded and moved to the low-level cache area; when the low-level cache area is full, the cache times will be reduced. Minimal domain names are removed directly.

本发明与现有技术相比,其显著优点是:采用了在域名名称特征基础上增加时间窗判断一次性域名的方法,解决了现有的域名分类方法容易误判的问题,避免丢弃非一次性域名造成的负面影响,提升域名识别的准确率。同时,通过对时间窗处理后的域名进行分级缓存,及时剔除查询使用次数较少的域名,减轻服务器的负载,减少用户查询延迟。Compared with the prior art, the present invention has the remarkable advantage that it adopts the method of judging one-time domain name by adding time window on the basis of domain name characteristics, which solves the problem that the existing domain name classification method is easy to misjudgment, and avoids discarding non-one-time domain names. negative impact caused by generic domain names, and improve the accuracy of domain name recognition. At the same time, through hierarchical caching of the domain names processed by the time window, domain names with less query times are eliminated in time, reducing the load on the server and reducing user query delays.

附图说明Description of drawings

图1为本发明的一种基于时间窗的域名缓存替换系统的结构示意图。FIG. 1 is a schematic structural diagram of a domain name cache replacement system based on time windows according to the present invention.

具体实施方式Detailed ways

以下结合附图,详细说明本发明的实施方式。Embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.

一种基于时间窗的域名缓存替换方法,其特征在于:该方法包括:A method for replacing a domain name cache based on a time window, characterized in that: the method includes:

响应DNS实时接收域名的查询请求,通过域名分类器将接收到的域名分类为一次性域名或非一次性域名;Respond to the query request of the DNS to receive domain names in real time, and use the domain name classifier to classify the received domain names as one-time domain names or non-disposable domain names;

若接收到的域名为非一次性域名,则当前域名直接进入分级缓存处理;若接收到的域名为一次性域名,则预先对当前域名进行时间窗处理后进入分级缓存处理。If the received domain name is a non-disposable domain name, the current domain name will directly enter the hierarchical cache processing; if the received domain name is a one-time domain name, the current domain name will be processed in a time window before entering the hierarchical cache processing.

具体的,域名的查询请求在DNS内形成对应的资源记录,其中,一次性域名表示在DNS内存在对应资源记录为一次的域名,非一次性域名表示在DNS内存在对应资源记录大于一次的域名。Specifically, a query request for a domain name forms a corresponding resource record in the DNS, where a one-time domain name means a domain name with a corresponding resource record in the DNS once, and a non-disposable domain name means a domain name with a corresponding resource record in the DNS more than once .

其中,域名在DNS内存在对应的资源记录包括:Among them, the corresponding resource records of the domain name in the DNS include:

A记录:表示主机记录,是DNS名称到IP地址的映射,用于正向解析;A record: indicates the host record, which is the mapping from DNS name to IP address, and is used for forward resolution;

CNAME记录:表示别名记录,用于定义A记录的别名;CNAME record: indicates the alias record, which is used to define the alias of the A record;

MX记录(mail exchange):表示邮件交换器记录,用于告知邮件服务器进程将邮件发送到指定的另一台邮件服务器;MX record (mail exchange): indicates the mail exchange record, which is used to tell the mail server process to send the mail to another designated mail server;

NS记录:用于标识区域的DNS服务器,一个区域可能存在多条ns记录,例如一个主服务器和多个辅助服务器;NS record: DNS server used to identify the zone. There may be multiple ns records in one zone, such as a primary server and multiple secondary servers;

PTR记录:用于反向解析,是IP地址到DNS名称的映射;PTR record: used for reverse resolution, which is the mapping from IP address to DNS name;

SOA记录:用于一个区域的开始,SOA记录后的所有信息均是用于控制这个区域的,每个区域数据库文件都必须包谷一个SOA记录,并且必须是其中的第一个资源记录,用以标识DNS服务器管理的起始位置,SOA记录能解析这个区域的DNS服务器中哪个是主服务器。SOA record: It is used for the beginning of an area. All information after the SOA record is used to control this area. Each area database file must contain an SOA record, and it must be the first resource record in it for Identify the starting position of DNS server management, and the SOA record can resolve which of the DNS servers in this area is the primary server.

具体的,时间窗处理为:Specifically, the time window processing is as follows:

在预先设置时间周期内,当当前域名的查询次数达到阈值时,对当前域名的资源记录进行分级缓存处理;Within the preset time period, when the number of queries of the current domain name reaches the threshold, the resource records of the current domain name are cached hierarchically;

若当前域名的查询次数未达到阈值,则丢弃当前域名的资源记录,返回继续响应DNS实时接收域名的查询请求;If the number of queries of the current domain name does not reach the threshold, discard the resource record of the current domain name, and return to continue to respond to the query request of DNS to receive the domain name in real time;

其中,当前域名的查询次数是通过累计得到的,包括外来客户端的查询次数以及域名分类器发送的同一域名出现的次数。Wherein, the query times of the current domain name are obtained through accumulation, including the query times of external clients and the occurrence times of the same domain name sent by the domain name classifier.

具体的,分级缓存包括低级缓存和高级缓存,处理步骤为:Specifically, hierarchical caching includes low-level caching and high-level caching, and the processing steps are:

判断当前域名的资源记录是否为第一次存放,若是,则将当前域名的资源记录放入低级缓存中;反之,将当前域名的资源记录放入高级缓存中,并累计当前域名的资源记录的缓存次数;Determine whether the resource records of the current domain name are stored for the first time, and if so, put the resource records of the current domain name into the low-level cache; otherwise, put the resource records of the current domain name into the high-level cache, and accumulate the resource records of the current domain name number of caches;

当高级缓存被填满时,累计所有缓存域名的资源记录缓存次数,并且将其中缓存次数最少的域名降级存放至低级缓存中;当低级缓存被填满时,累计所有缓存域名的资源记录缓存次数,并且并移除其中缓存次数最少的域名。When the high-level cache is full, accumulate the resource record cache times of all cached domain names, and downgrade the domain name with the least cache times to the low-level cache; when the low-level cache is full, accumulate the resource record cache times of all cached domain names , and remove the domain with the least number of caches.

如图1所示,本发明还提供了一种基于时间窗的域名缓存替换系统,包括域名分类单元、时间窗处理单元以及分级缓存单元,其中:As shown in Figure 1, the present invention also provides a domain name cache replacement system based on time windows, including a domain name classification unit, a time window processing unit, and a hierarchical cache unit, wherein:

域名分类单元,用于获取DNS接收的域名查询请求,根据名称特征分类法对域名进行分类,并将分类结果发送至时间窗处理单元;The domain name classification unit is used to obtain the domain name query request received by the DNS, classify the domain name according to the name feature classification method, and send the classification result to the time window processing unit;

时间窗处理单元,用于基于分类结果对域名在预先设置时间周期内的查询次数进行记录;A time window processing unit, configured to record the number of queries of domain names within a preset time period based on classification results;

分级缓存单元,用于接收满足缓存阈值条件的域名进行分级缓存处理,并移除其中缓存次数最少的域名。The hierarchical caching unit is configured to receive domain names satisfying the caching threshold condition for hierarchical caching processing, and remove the domain name with the least number of caching times.

具体的,域名的查询请求在DNS内形成对应的资源记录,分类结果为统计所述域名在DNS内存在对应的资源记录次数,包括:Specifically, the domain name query request forms a corresponding resource record in the DNS, and the classification result is to count the number of times the domain name has a corresponding resource record in the DNS, including:

将在DNS内存在对应的资源记录且资源记录仅有一次的域名,分为一次性域名;A domain name that has a corresponding resource record in the DNS and has only one resource record is classified as a one-time domain name;

将在DNS内存在对应的资源记录且资源记录大于一次的域名,分为非一次性域名。A domain name that has a corresponding resource record in the DNS and the resource record is more than once is classified as a non-disposable domain name.

具体的,时间窗处理单元包括若干个滑动时间窗,若干个滑动时间窗设置有不同的时间范围和查询阈值,每个滑动时间窗内置有过期缓存库,过期缓存库为带有过期自动刷新属性的有序字典。Specifically, the time window processing unit includes several sliding time windows, and several sliding time windows are set with different time ranges and query thresholds. Each sliding time window has a built-in expired cache library, and the expired cache library has an expired automatic refresh attribute. An ordered dictionary of .

具体的,时间窗处理单元的具体处理流程为:Specifically, the specific processing flow of the time window processing unit is:

选定任意一个滑动时间窗,判断在滑动时间窗的时间范围内,域名的查询次数是否达到查询阈值;若达到,则将域名的资源记录存放至分级缓存单元,反之,则丢弃域名;Select any sliding time window, and judge whether the number of domain name queries reaches the query threshold within the time range of the sliding time window; if so, store the resource records of the domain name in the hierarchical cache unit, otherwise, discard the domain name;

其中,域名的查询次数通过累计得到,包括外来客户端的查询次数以及域名分类单元发送的分析结果中同一域名出现的次数。Wherein, the number of queries of the domain name is accumulated, including the number of queries of external clients and the number of occurrences of the same domain name in the analysis results sent by the domain name classification unit.

具体的,分级缓存单元包括低级缓存区和高级缓存区,具体操作步骤为:Specifically, the hierarchical cache unit includes a low-level cache area and a high-level cache area, and the specific operation steps are:

判断域名的资源记录是否是第一次存放,若是,则将域名的资源记录放入低级缓存区中;反之,将域名的资源记录放入高级缓存区中,并累计域名的资源记录的缓存次数;Determine whether the resource record of the domain name is stored for the first time, if so, put the resource record of the domain name into the low-level cache; otherwise, put the resource record of the domain name into the high-level cache, and accumulate the cache times of the resource record of the domain name ;

采用LRU算法对存放的所有域名的缓存次数进行统计排序,当高级缓存区填满时,将缓存次数最少的域名降级移存到低级缓存区;当低级缓存区填满时,将缓存次数最少的域名直接移除。The LRU algorithm is used to statistically sort the cache times of all stored domain names. When the high-level cache area is full, the domain names with the least cache times will be downgraded and moved to the low-level cache area; when the low-level cache area is full, the domain names with the least cache times will be moved. The domain name is removed directly.

具体举例如下:Specific examples are as follows:

S1、本地递归服务器从远端服务器接收到DNS回复的域名的查询请求;S1. The local recursive server receives a query request of the domain name replied by DNS from the remote server;

S2、使用域名分类器对域名进行分类;分类结果的处理为:如果识别为非一次域名则直接放入分级缓存中,否则送到时间窗处理器进一步处理;S2. Use the domain name classifier to classify the domain name; the processing of the classification result is: if it is identified as a non-primary domain name, it will be directly placed in the hierarchical cache, otherwise it will be sent to the time window processor for further processing;

S3、时间窗处理器按照预先设置好的时间和阈值作判断,例如:设置100秒时间内查询次数为3次,即该域名在100秒内被请求超过3次则将其域名对应的资源记录放入分级缓存中,反之丢弃;继续接收下一个域名的查询请求;S3. The time window processor makes judgments according to the preset time and threshold, for example: set the number of queries within 100 seconds to 3 times, that is, if the domain name is requested more than 3 times within 100 seconds, the resource record corresponding to the domain name will be recorded Put it into the hierarchical cache, otherwise discard it; continue to receive the query request of the next domain name;

S4、判断缓存中否存在该域名所对应的资源记录,若有则直接返回查询结果,反之继续向下查询,查到返回S1循环执行。S4. Determine whether there is a resource record corresponding to the domain name in the cache, and if so, directly return the query result; otherwise, continue to query downwards, and return to S1 for loop execution.

步骤S3中的时间窗处理步骤具体为:The time window processing steps in step S3 are specifically:

S31、设置不同滑动时间窗和不同阈值测试缓存命中率;S31. Setting different sliding time windows and different thresholds to test the cache hit rate;

S32、评估存命中率及占用存储空间;S32. Evaluate the hit rate and occupied storage space;

S33、根据实际情况选定时间窗和阈值,本方案中选择100秒3次;S33. Select the time window and threshold according to the actual situation, in this scheme, select 100 seconds for 3 times;

S34、时间窗处理器记录时间窗内记录次数,时间窗处理器内置了ExpiringDict(过期字典),ExpiringDict是一种带有过期自动刷新属性的有序字典,通过设置自动过期值即可记录滑动时间窗内的域名请求次数。S34. The time window processor records the number of records in the time window. The time window processor has a built-in ExpiringDict (expiring dictionary). ExpiringDict is an ordered dictionary with an expired automatic refresh attribute. The sliding time can be recorded by setting the automatic expiration value The number of domain name requests within the window.

S35、根据ExpiringDict的记录作逻辑处理,即100秒内请求次数超过3次的域名对应的资源记录放入分级缓存并返回响应结果。S35. Perform logical processing according to the records of ExpiringDict, that is, put resource records corresponding to domain names whose request times exceed 3 times within 100 seconds into the hierarchical cache and return a response result.

步骤S35中放入分级缓存的具体处理操作如下:In step S35, the specific processing operation of putting into hierarchical cache is as follows:

S351、一个新的资源记录被缓存时,先放入低级缓存中;S351. When a new resource record is cached, put it into the low-level cache first;

S352、当它再次命中时被升级到高级缓存中;S352, when it hits again, it is upgraded to the advanced cache;

S353、当低级缓存填满时,直接依据LRU(Least Recently Used)算法将最近最少使用的资源记录移除。S353. When the low-level cache is full, directly remove the least recently used resource record according to the LRU (Least Recently Used) algorithm.

S354、当高级缓存填满时,则依据LRU算法将最近最少使用的资源记录降级到低级缓存中。S354. When the high-level cache is full, demote the least recently used resource record to the low-level cache according to the LRU algorithm.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (9)

1. A domain name cache replacing method based on a time window is characterized in that: the method comprises the following steps:
responding to a query request of a DNS (domain name server) for receiving a domain name in real time, and classifying the received domain name into a disposable domain name or a non-disposable domain name through a domain name classifier;
if the received domain name is a non-disposable domain name, the current domain name directly enters the hierarchical cache processing; if the received domain name is a disposable domain name, the current domain name is processed in a time window mode in advance and then enters a hierarchical cache mode.
2. The method according to claim 1, wherein the method for replacing the domain name cache based on the time window comprises the following steps: the query request of the domain name forms a corresponding resource record in the DNS, wherein:
the disposable domain name indicates that the corresponding resource record exists in the DNS as a domain name for one time, and the non-disposable domain name indicates that the corresponding resource record exists in the DNS for more than one time.
3. The domain name cache replacement method based on the time window according to claim 1, characterized in that: the time window processing is as follows:
in a preset time period, when the query frequency of the current domain reaches a threshold value, performing hierarchical cache processing on the resource record of the current domain;
if the query frequency of the current domain name does not reach the threshold value, discarding the resource record of the current domain name, and returning to continuously respond to the DNS to receive the query request of the domain name in real time;
the current query times of the domain name are obtained through accumulation, and include the query times of an external client and the occurrence times of the same domain name sent by the domain name classifier.
4. The domain name cache replacement method based on the time window according to claim 1, characterized in that: the hierarchical cache comprises a low-level cache and a high-level cache, and the specific processing steps are as follows:
judging whether the resource record of the current domain name is stored for the first time, if so, putting the resource record of the current domain name into a low-level cache; otherwise, the resource record of the current domain name is put into a high-level cache, and the caching times of the resource record of the current domain name are accumulated;
when the high-level cache is filled up, accumulating the resource record caching times of all cached domain names, and downgrading and storing the domain name with the least caching times into the low-level cache; when the lower level cache is full, the resource record cache times for all cached domain names are accumulated, and the domain name with the least cache times is removed.
5. A domain name cache replacement system based on time window is characterized in that: the domain name classification unit, the time window processing unit and the hierarchical cache unit are included, wherein:
the domain name classification unit is used for acquiring a domain name query request received by the DNS, classifying the domain name according to a name feature classification method, and sending a classification result to the time window processing unit;
the time window processing unit is used for recording the query times of the domain name in a preset time period based on the classification result;
and the hierarchical cache unit is used for receiving the domain names meeting the cache threshold condition, performing hierarchical cache processing, and removing the domain name with the least cache times.
6. The system according to claim 5, wherein the system comprises: and the query request of the domain name forms a corresponding resource record in the DNS, and the classification result is the frequency of counting the existence of the corresponding resource record of the domain name in the DNS.
7. The system according to claim 5, wherein the system comprises: the time window processing unit comprises a plurality of sliding time windows, the sliding time windows are provided with different time ranges and query thresholds, an overdue cache bank is arranged in each sliding time window, and each overdue cache bank is an ordered dictionary with an overdue automatic refresh attribute.
8. The system according to claim 7, wherein the system further comprises: the specific processing flow of the time window processing unit is as follows:
selecting any one sliding time window, and judging whether the query frequency of the domain name reaches a query threshold value within the time range of the sliding time window; if yes, storing the resource record of the domain name to the hierarchical cache unit, otherwise, discarding the domain name;
the query times of the domain name are obtained through accumulation, and include the query times of an external client and the times of occurrence of the same domain name in an analysis result sent by the domain name classification unit.
9. The system according to claim 8, wherein the system further comprises: the hierarchical cache unit comprises a low-level cache region and a high-level cache region, and the specific operation steps are as follows:
judging whether the resource record of the domain name is stored for the first time, if so, putting the resource record of the domain name into a low-level cache region; otherwise, the resource records of the domain name are put into a high-level cache region, and the caching times of the resource records of the domain name are accumulated;
performing statistical sorting on the caching times of all the stored domain names by adopting an LRU algorithm, and when a high-level cache region is filled, performing degradation and transfer on the domain name with the minimum caching times to a low-level cache region; and when the lower-level cache region is filled, directly removing the domain name with the least caching times.
CN202211705260.XA 2022-12-29 2022-12-29 Domain name cache replacement method and system based on time window Pending CN115967746A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211705260.XA CN115967746A (en) 2022-12-29 2022-12-29 Domain name cache replacement method and system based on time window

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211705260.XA CN115967746A (en) 2022-12-29 2022-12-29 Domain name cache replacement method and system based on time window

Publications (1)

Publication Number Publication Date
CN115967746A true CN115967746A (en) 2023-04-14

Family

ID=87352547

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211705260.XA Pending CN115967746A (en) 2022-12-29 2022-12-29 Domain name cache replacement method and system based on time window

Country Status (1)

Country Link
CN (1) CN115967746A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105472056A (en) * 2015-11-23 2016-04-06 中国互联网络信息中心 DNS recursive server layered buffer method and system
CN108551494A (en) * 2018-01-30 2018-09-18 北京邮电大学 Domain name caching method and equipment
CN113821461A (en) * 2021-09-24 2021-12-21 牙木科技股份有限公司 Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium
CN114221934A (en) * 2021-12-13 2022-03-22 牙木科技股份有限公司 Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105472056A (en) * 2015-11-23 2016-04-06 中国互联网络信息中心 DNS recursive server layered buffer method and system
CN108551494A (en) * 2018-01-30 2018-09-18 北京邮电大学 Domain name caching method and equipment
CN113821461A (en) * 2021-09-24 2021-12-21 牙木科技股份有限公司 Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium
CN114221934A (en) * 2021-12-13 2022-03-22 牙木科技股份有限公司 Domain name resolution caching method, DNS (Domain name Server) and computer readable storage medium

Similar Documents

Publication Publication Date Title
US9848057B2 (en) Multi-layer multi-hit caching for long tail content
US8370460B1 (en) Optimizing multi-hit caching for long tail content
CN108337172B (en) Large-scale OpenFlow flow table accelerated searching method
US20090094200A1 (en) Method for Admission-controlled Caching
US9075894B2 (en) System and method for identifying web objects unworthy of being cached
CN105376344B (en) A kind of analytic method and system of recurrence name server relevant to source address
CN107301215B (en) Search result caching method and device and search method and device
US20030217113A1 (en) Caching techniques for streaming media
US8392397B2 (en) System and method for provenance function window optimization
US20160335177A1 (en) Cache Management Method and Apparatus
US20210209024A1 (en) Method, device and computer program product for managing cache
CN111131285B (en) Active protection method for random domain name attack
CN103685599A (en) Domain name recursion service pre-judgment and intervention method
CN111182059B (en) Query analysis method for domain name cache updating
WO2020181820A1 (en) Data cache method and apparatus, computer device and storage medium
JP2020503775A (en) DDoS attack detection method and device
CN117459494A (en) TOP domain name guaranteed forwarding method of DNS cache server
CN115967746A (en) Domain name cache replacement method and system based on time window
CN109951811B (en) A service number short message monitoring method, device and system
CN117785933A (en) Data caching method, device, equipment and readable storage medium
CN112994924B (en) Online merging method for network service logs
Alayoff et al. Optimizing DNS resolvers for high loads
CN116502153B (en) A classification model construction method and classification system for domain name classification
Belloum et al. Dealing with one-timer-documents in web caching
CN119271579B (en) Cache replacement method, device, electronic device and medium based on reinforcement learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: No. 7, Mozhou East Road, Jiangning District, Nanjing, Jiangsu 211111

Applicant after: JIANGSU FUTURE NETWORKS INNOVATION INSTITUTE

Address before: Building 2, Yougu, No. 12, Mozhou East Road, Moling Street, Jiangning District, Nanjing City, Jiangsu Province, 211111

Applicant before: JIANGSU FUTURE NETWORKS INNOVATION INSTITUTE

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230414