domain-name-system – 未绑定 – 仅在短时间内缓存的域

我最近设置了Unbound for DNS缓存,以及 Linux Mint 18.1上的DNScrypt.它工作,但我注意到页面只在很短的时间内缓存:

>首次查询google.com – 48ms(域未缓存)
> google.com的第二个查询(紧接着之后) – 0ms(域缓存)
> google.com的第三次查询(在〜分钟后) – 46ms(域未缓存)

这是预期的行为,还是我需要设置不同的东西来缓存页面更长的时间?这是我的Unbound配置(/etc/unbound/unbound.conf):
#

Unbound configuration file for Debian.
    #
    # See the unbound.conf(5) man page.
    #
    # See /usr/share/doc/unbound/examples/unbound.conf for a commented
    # reference config file.age
    #
    # The following line includes additional configuration files from the
    # /etc/unbound/unbound.conf.d directory.
    include: "/etc/unbound/unbound.conf.d/*.conf"
    server:
        verbosity: 1
        num-threads: 4
        outgoing-range: 8192
        so-rcvbuf: 4m
        so-sndbuf: 4m
        so-reuseport: yes
        msg-cache-size: 50m
        msg-cache-slabs: 16
        num-queries-per-thread: 4096
        rrset-cache-size: 100m
        rrset-cache-slabs: 16
        infra-cache-slabs: 16
        do-ip4: yes
        do-ip6: no
        do-udp: yes
        do-tcp: yes
        do-daemonize: yes
        hide-identity: yes
        hide-version: yes 
        harden-short-bufsize: yes
        harden-large-queries: yes
        harden-glue: yes
        harden-dnssec-stripped: yes
        harden-below-nxdomain: yes
        harden-referral-path: yes
        logfile: "/etc/unbound/unbound.log"
        use-caps-for-id: yes
        do-not-query-localhost: no
        prefetch: no 
    forward-zone:
        name: "."
        forward-addr: 127.0.0.1@40

解决方法

未绑定将(或至少应该)将结果缓存在 TTL中为您请求的记录指定的时间.

这正是我在一个运行未绑定的系统上观察到的.初始请求需要14ms,后续请求需要0ms,当TTL到期时,下一个请求需要14ms.

初始请求显示300秒TTL并需要18ms

;; ANSWER SECTION:
google.com.             300     IN      A       172.217.20.46

;; Query time: 18 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:39:30 2017
;; MSG SIZE  rcvd: 44

后续请求 – TTL正在倒计时并需要0ms

;; ANSWER SECTION:
google.com.             196     IN      A       172.217.20.46

;; Query time: 0 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:41:14 2017
;; MSG SIZE  rcvd: 44

TTL已过期,因此另一个上游请求为23ms

;; ANSWER SECTION:
google.com.             300     IN      A       172.217.20.46

;; Query time: 23 msec
;; SERVER: 10.34.20.1#53(10.34.20.1)
;; WHEN: Sun Feb 12 20:44:37 2017
;; MSG SIZE  rcvd: 44

相关文章

vue阻止冒泡事件 阻止点击事件的执行 <div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些