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

什麼狀況緩存紀錄會被踢掉?:serve-expired-ttl 0 #1729

Open
kousyougi opened this issue Apr 26, 2024 · 6 comments
Open

什麼狀況緩存紀錄會被踢掉?:serve-expired-ttl 0 #1729

kousyougi opened this issue Apr 26, 2024 · 6 comments

Comments

@kousyougi
Copy link

问题现象
每天離峰時段重啟時發現緩存只有100KB。但尖峰時段重啟時,看到緩存有2MB

請問在serve-expired-ttl 0的設置下,緩存會一直變大,大到我設置的cache-size值嗎?
有什麼設置是會把緩存的域名踢掉的嗎?

涉及的配置(注意去除个人相关信息)
rr-ttl-min 60
rr-ttl-max 3600
rr-ttl-reply-max 60
cache-size 20000
cache-persist yes
cache-file /tmp/smartdns.cache
cache-checkpoint-time 0
prefetch-domain yes
serve-expired yes
serve-expired-ttl 0
serve-expired-reply-ttl 2
serve-expired-prefetch-time 14400

@PikuZheng
Copy link
Contributor

理论上缓存会一直增长直到达到cache-size。但受内存可用空间影响,可能有更小的限制。实际使用中不会有那么多域名查询,一般不会达到上限。
serve-expired-ttl 0 我理解就相当于serve-expired no。但由于prefetch-domain yes,在ttl降到0之前会重新查询,所以会一直ttl>0,直到一段时间内没有被下游查询,不触发预读

@kousyougi
Copy link
Author

理论上缓存会一直增长直到达到cache-size。但受内存可用空间影响,可能有更小的限制。实际使用中不会有那么多域名查询,一般不会达到上限。 serve-expired-ttl 0 我理解就相当于serve-expired no。但由于prefetch-domain yes,在ttl降到0之前会重新查询,所以会一直ttl>0,直到一段时间内没有被下游查询,不触发预读

https://pymumu.github.io/smartdns/configuration/
這邊寫 serve-expired-ttl :0 表示停用超时

這邊的敘述寫 0 表示停用超时 我以為是 serve-expired-ttl 無限大的意思。
我測測看把serve-expired-ttl 設到大一點的值,看看緩存大小會不會有我預期的反應。
謝謝

@pymumu
Copy link
Owner

pymumu commented Apr 26, 2024

代码有BUG,修改了

@kousyougi
Copy link
Author

我测试了新版。跑了一天。设定 serve-expired-ttl 0 。cache好像还是没有持续膨胀。
serve-expired-ttl 设定 604800时cache有在膨胀。

@PikuZheng
Copy link
Contributor

我测试了新版。跑了一天。设定 serve-expired-ttl 0 。cache好像还是没有持续膨胀。 serve-expired-ttl 设定 604800时cache有在膨胀。

还有一种可能 就是有大量域名只被查询了一次 有些系统或软件会发起很多不存在的域名来实现一些探测的目的
可以比较一下大缓存和小缓存中域名的差别 看有没有什么规律

@pymumu
Copy link
Owner

pymumu commented Apr 28, 2024

重新修改了一下

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

3 participants