NextDNS DNS Cache

Continuing the discussion from NextDNS app possible latency issues:

I do not appreciate the fact this was closed @psherman

you was quoting old posts, I am risking being banned here, just because you will not keep threads I still need open

I ran "nextdns config set -max-ttl=5s" and "nextdns restart" and response times are still over 20ms

I change it to 50s and got a 0ms response time then a 3ms response time

then the cache must have gone stale and stopped working, as I got 247ms

thats the intermittent ISP fault, but now I don't think its working again as everything is above 20ms

here is the nextdns config by the way

config nextdns 'main'
        option enabled '1'
        option setup_router '1'
        option report_client_info '1'
        option hardened_privacy '0'
        option log_queries '1'
        option bogus_priv '1'
        option use_hosts '1'
        option debug '0'
        option control '/var/run/nextdns.sock'
        option timeout '5s'
        option cache_metrics '0'
        option mdns 'all'
        option auto_activate '0'
        option cache_max_age '0s'
        option detect_captive_portals '0'
        option max_inflight_requests '256'
        option cache_size '0'
        option max_ttl '50s'
        list listen 'localhost:53'
        list profile 'c####d'

and /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fda1:5d42:b57::/48'
        option packet_steering '1'
        option dhcp_default_duid '0004531ca97d5bf44a9390a9eef6da5742a0'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ip6assign '60'
        option gateway '192.168.1.1'
        list dns '1.1.1.1'
        option multipath 'off'
        list ipaddr '192.168.1.253/16'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '0

I didn't follow your previous threads but setting TTL that low will effectively disable caching. What are trying to achieve? Break things which are not broken (at least by default)?

the information you sent said "5s", so this number is higher

have I got this completely wrong

faster loading times for webpages, as you can see above our connection is not great at the moment

less than 20ms is fine, but over 200ms per DNS request is high

our connection is ranging from 20-2000ms, not a fault of openwrt but its why I believe cahching would help

so should it have worked with the default config

Yes. I informed you of that in a Private Message and posted it in the previous thread, but you responded:

it was never enabled

I don’t know what you have got against me

I don’t like where this going

Another user informed you too, and it was discussed previously.

This is the same discussion where I said it was better not to reference old threads as related just because they have NextDNS as the title (even though during one thread, you weren't even using an OpenWrt device).

Using DoH without cache causes even more latency than already expected.

DNS over HTTPS (and DoT) is SLOW. 200 ms is pretty normal for DoH if you have to establish TLS connection.

It does work. I have strong impression that you just don't get how it works.

This is a real World example on my particular equipment in my particular setup. Whenether I try DNS request with proxy not having connection which previously established I get this:

root@router:~# nslookup -type=A -debug ubuntu.com
Server:		127.0.0.1
Address:	127.0.0.1:53

Query #0 completed in 193ms:
Non-authoritative answer:
Name:	ubuntu.com
Address: 185.125.190.21
Name:	ubuntu.com
Address: 185.125.190.20
Name:	ubuntu.com
Address: 185.125.190.29

If I make new request quickly after that (my connection lives for 10 seconds) I get much shorter reply:

root@router:~# nslookup -type=A -debug redhat.com
Server:		127.0.0.1
Address:	127.0.0.1:53

Query #0 completed in 17ms:
Non-authoritative answer:
Name:	redhat.com
Address: 34.235.198.240
Name:	redhat.com
Address: 52.200.142.250

Both domains were not previously cached. When you visit your typical webpage you get cascade of DNS requests. First one will take long time, but following requests will take much shorter time (DNS proxy reuses same connection). Then those domains will live in cache according to their TTL time (usually minutes). Your further requests to those domains will take ~0ms. When you override TTL time lowering it you kill cache.

so what went wrong with my config

I seem to have missed that, sorry

it was automatically done, when I quoted the post

I was for 99% of it, I went 48 hours without openwrt, it has been connected again probably a week now

yes and along with over 200ms of FTTP problems, you get webpages taking over 5 seconds to even think about loading

less than 20ms is the speed I see consistently

the over 200ms is the intermittent fault

I see the same response times at 192.168.1.253(openwrt) and 192.168.1.1(router), the main router is setup with regular DNS to an IP address

maybe I don't but if openwrt is responding it should be a few ms at most

I will try to find the default config for nextdns, I changed nothing though

maybe some other software changed it

stop with the solutions as well please

951ms is probably not a normal response time

but then after that to the same domain 15ms, still seems a little high if its cached

Establishing TLS connection takes LONGER: https://tlseminar.github.io/first-few-milliseconds/

I see less than 20ms with and without DOH

its the spikes of 951ms I want to reduce

Query time: 2103 msec

Just accept what they tell you as a fact. You don't get how it works. Educate yourself on mechanics behind DoH and DoT. First step is to establish encrypted connection. There is plenty of data (and benchmarks) which will prove your statement about sub 20ms WRONG. Defaults are pretty sane, you're just misinterpreting results.

Remove the max-ttl setting and only run the nextdns config set -cache-size=10MB cmd.

Someone else can clarify. Unfortunately, I don't see an OpenWrt nor its config being discussed in the previous thread. :man_shrugging:

You could have removed it (i.e., like suggested) - and not claimed it was related to 3 to 4 others (nor found a need to berate a moderator).

We discussed not connecting the OpenWrt in an un meaningful manner just for forum support. If you readded the OpenWrt, this means you had to reconfigure your upstream device (again). For some reason you don't like discussing those relevant changes, nor providing configs. I'm not sure why.

@Kcajminer2312 don't waste your breath try to be laconic.

... or better read that article I sent you. There is the answer you're looking for in its very bottom.

I know how normal caching should work, it should be around 2ms from over 20ms

DOH and regular DNS give nearly the same results in my case

I under stand the encrypted connection will take slightly longer, not 2103ms longer though, that would have been the same for standard DNS as well

I want to try and mask the ISP spikes as much as possible

I have the proof in front of me

Query time: 15 msec (google.com)

new query Query time: 23 msec (google.co.uk)

Query time: 19 msec (redhat.com)

Query time: 19 msec (ubuntu.com)

if caching is working why around 20ms

its acting like a regular uncached DNS connection

its not the ~103ms I care about

its the 20ms, that should be closer to 1ms, as its communication on the local network without asked the external server

that's irrevant to this thread

yes, again irrevant to this thread

it is related, there all about NextDNS

it was closed for no good reason

I have had enough of this, my result are being argued, I don't feel welcome here

what is there to configure upstream, it was a DHCP server swap when Openwrt was unplugged

again off topic to the current thread

I want to speak with a moderator. I do not like how this is going, everyone is against me and off topic

Don't even think about banning me, read the whole thread, I have proof of my results

I read it ~103ms for the first query

the cached should not be ~20ms in my option, that's not how cache is supposed to work

cache should not be 20ms, otherwise its the same as a regular DNS query

this seems to have helped

So your query can't be shorter than that! Do you get it or not? It can only take shorter time if you have pre-established connection. Those connections live short time, several seconds. Because servers which serve MILLIONS of queries per second can't hold established TCP connection for a long time.

@timur.davletshin, I'm afraid you were correct.

You asked me about your configurations, they're not in the thread you referenced. I agree, the previous thread isn't relevant - nor are the others.

But knowing that's not what you intended to express, I'll be leaving you to discuss with others here.

Good day, I wish your setup well.

I get it but the 20ms shows that some cache was clearly happening then, not very fast cache

the 20ms is maybe the fact I am spamming the query then

0-3ms with "cache-size=10MB"

I have a dedicated IP for NextDNS, so is it still shared over millions or just my network

the configuration are in this thread

so I am not correct, 20ms is high for cache

I really dislike it here

I have selected the real solution

I may have read the wrong command