Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache mechanism is not working #43

Open
phantomcraft opened this issue Dec 19, 2022 · 0 comments
Open

Cache mechanism is not working #43

phantomcraft opened this issue Dec 19, 2022 · 0 comments

Comments

@phantomcraft
Copy link

Command line:

mosdns-cn --cache=10000 --lazy-cache-ttl=1000 --min-ttl=3600 --max-ttl=7200 --server=127.0.0.1:1053 --upstream=114.114.114.114:53

When I dig two times in any domain, the response time is the same:

user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56208
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			3600	IN	A	142.250.178.142

;; Query time: 300 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:54:47 EST 2022
;; MSG SIZE  rcvd: 53


real	0m0.320s
user	0m0.004s
sys	0m0.006s
user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52969
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			3600	IN	A	142.250.178.142

;; Query time: 300 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:54:48 EST 2022
;; MSG SIZE  rcvd: 53


real	0m0.319s
user	0m0.010s
sys	0m0.000s

When using another DNS forwarder the second query is got from the app cache:

user@localhost:~$ time dig @127.0.0.1 -p 1053 g.co

; <<>> DiG 9.18.7-1-Debian <<>> @127.0.0.1 -p 1053 g.co
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9464
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;g.co.				IN	A

;; ANSWER SECTION:
g.co.			118	IN	A	142.250.178.142

;; Query time: 0 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Sun Dec 18 23:56:36 EST 2022
;; MSG SIZE  rcvd: 49


real	0m0.021s
user	0m0.004s
sys	0m0.006s

Something missing in my config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant