-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
新版本性能变低 #1337
Comments
没发现什么问题,相比之前版本有下降,但没下降10倍那么多,我不知道你测试方法有什么不同。 |
压测过程中,单次用nslookup查询,国内网站,响应速度也是在30毫秒内完成的。 |
应该还是配置上的差异。可以看看是否是因为双栈优选功能,2020年版本如果配置文件中没有显示启用双栈优选功能的话 ,默认是关闭的。 2022年版本,默认启用了双栈优选。双栈优选开启的话,会拖慢查询速度,因为要等测速对比。 |
双栈优选是哪个配置项呢?我来设置看看. |
dualstack-ip-selection no |
使用smartdns.1.2023.03.04-1125.x86_64-linux-all.tar.gz版本,
但是在运行的过程中,另开一个终端执行循环执行nslookup命令, 就会发现有大量的超时了, 可以直接复制以下命令来执行.
|
我这边测试没有发现明显问题,关了debug log的结果
nslookup循环查询,没有失败
|
可以尝试把cache-size调大,把log级别改成info或error。 |
这个是我的配置,
重启smartdns,在做测试, 只要加上循环nslookup, 一下就出现大量超时
nslookup循环查询,没有失败, 只是qps降了好几倍. |
查询过程中重启smartdns? |
压力测试过程中没有重启smartdns, 只是刚开始配置后重启smartdns就开始做压力测试+循环nslookup. |
cache-size调大看看吧 |
能否比较一下41.rc3(20230223)和当前版本 |
设置了cache-size 也没有效果,我设置成
|
能否比较一下41.rc3(20230223)和当前版本 我试试看. |
测试的域名列表中有多少个不同的域名?重复率有多少? |
代码增加了相关性能的测试用例。随机生成100K域名,上游为本机的一个模拟服务器。 目前在RK3588的板子上,测试结果如下: rock@rock-5b:~/code/smartdns/test$ make all -j8 && ./test.bin --gtest_filter=Perf.*
make: Nothing to be done for 'all'.
Note: Google Test filter = Perf.*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from Perf
[ RUN ] Perf.no_speed_check
DNS Performance Testing Tool
Version 2.9.0
[Status] Command line: dnsperf -p 60053 -d /tmp/smartdns-perftest-domain.listfa37J
[Status] Sending queries (to 127.0.0.1:60053)
[Status] Started at: Sun Mar 19 14:08:59 2023
[Status] Stopping after 1 run through file
[Status] Testing complete (end of file)
Statistics:
Queries sent: 100000
Queries completed: 100000 (100.00%)
Queries lost: 0 (0.00%)
Response codes: NOERROR 100000 (100.00%)
Average packet size: request 32, response 54
Run time (s): 1.979820
Queries per second: 50509.642291
Average Latency (s): 0.001945 (min 0.000070, max 0.017268)
Latency StdDev (s): 0.001110
[ OK ] Perf.no_speed_check (2334 ms)
[----------] 1 test from Perf (2334 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (2334 ms total)
[ PASSED ] 1 test. 需要安装dnsperf命令
从测试看,基本上没有大问题。和之前最早的测试结果,差异不大。 测试代码样例: smartdns/test/cases/test-perf.cc Lines 33 to 99 in aa6f6fd
|
我遇到一个情况供大佬参考,dns结构图如下,因为是上游是同一个Adguard Home,所以从2个mosdns发到smartdnsdns的完全相同的dns请求几乎是同时到达smartdns的,只要有dns请求,2个mosdns都会出现大量错误日志: 2023-03-17T10:10:23.418+0800 WARN forward_local upstream error {"uqid": 103, "qname": "www.sonystyle.com.cn.", "qtype": 28, "qclass": 1, "upstream": "10.10.10.1:8055", "error": "context deadline exceeded"} 把其中1个mosdns去掉,保留的mosdns就完全不会出现错误日志,关于此错误日志,mosdns的FAQ里面解释为上游dns不可用: |
test.tar.gz
|
系统是alpine,由于没有queryperf,改成dnsperf
此期间另外启一个shell做testnslookup.sh,人眼观察是没有失败的查询。 |
这个cpu使用 我比较在意,为什么新版本cpu使用量大大降低了? 再就是您连接上游都是udp,考虑到默认测速的ping,很容易导致连接数超系统限制 |
@PikuZheng
你那个性能才2400个。那个dnsperf命令替换后,要去掉-T参数。-T那个意思不同。 |
@yyysuo 新提交一个issue,提供对应出问题时间的smartdns的debug log。 |
@PikuZheng 你的环境是在哪里搭建的? 怎么搭建的呢? 我搭建个和你一样的环境我在测试下. |
我用的alpine容器跑smartdns,目前最新代码自动编译,日常使用配置(约6000多domain-rule,上游只有tcp,国内ping测速,有缓存),本机(容器外)跑dnsperf。cpu是 i3-4010U,猜测是日志读写导致的cpu爆满。 降到37.2.10(第一个支持domain-rule的版本):
此期间做了5000次nslookup,虽然响应时间显著下降,但是没有失败的。
去掉 -T 后,没有明显变化
|
检查配置发现日志级别是debug,改为error后(但是开audit log)
这个结果和楼主用旧版的好像差不多。此期间cpu依旧爆满。 在runquerypref.sh的同时nslookup循环5000次(testnslookup.sh 改 总体来说楼主旧版和新版测试结果可能都有问题。旧版受x86架构所限,可能实际性能会更好。新版结果就离谱了,中间肯定是产生了什么问题。 |
是的, 单纯执行runquerypref.sh 压测, 性能可以接受, |
@xiaotudoubaba @PikuZheng 跑一下smartdns代码里面的性能测试看看吧。
|
编译时报错
-fpermissive 忽略错误后
|
@xiaotudoubaba 你的那个测试方法,因为域名是重复的,所以基本上都是缓存生效。数据并不会发送到上游。 我这边也用你的测试验证了一下,运行runquerypref.sh的同时执行testnslookup.sh,并没有性能下降的问题。 DNS Query Performance Testing Tool
Version: $Id: queryperf.c,v 1.12 2007/09/05 07:36:04 marka Exp $
[Status] Processing input data
[Status] Sending queries (beginning with 192.168.59.2)
[Status] Testing complete
Statistics:
Parse input file: once
Ended due to: reaching end of file
Queries sent: 4000000 queries
Queries completed: 4000000 queries
Queries lost: 0 queries
Queries delayed(?): 0 queries
RTT max: 0.015537 sec
RTT min: 0.001030 sec
RTT average: 0.001227 sec
RTT std deviation: 0.000352 sec
RTT out of range: 0 queries
Percentage completed: 100.00%
Percentage lost: 0.00%
Started at: Mon Mar 20 17:44:14 2023
Finished at: Mon Mar 20 17:48:07 2023
Ran for: 232.778404 seconds
Queries per second: 17183.724655 qps
Total QPS/target: 17183.806079/50000 qps 测试机器信息: ./runquerypref.sh脚本,使用的是默认并发数量,默认是20,可以使用-q参数,将并发数调整到120,将CPU消耗到90%以上。
目前在x86机器,ARM机器,没有发现问题, @PikuZheng 你那个机器性能看上去和我那个虚拟机差不多。你可以吧 ./runquerypref.sh和testnslookup.sh拿到另外一个机器上测试下看看。 |
找了个 Xeon Silver 4210, |
2G Hz的CPU性能至少4W以上。 dnsperf没有-q参数,不要混淆两个工具。 dnsperf好像是-c,或者是-t 但是代码中那个性能测试用例,我的rock5b的CPU,默认参数是可以到5W的。 |
请教下,这个你是怎么搭建测试环境的, 有这个步骤吗? 我和你同步下测试环境,我在做下测试.谢谢. |
我这个是实际使用配置,六千多domain-set相当于两万多行匹配规则,应该是卡在cpu性能了 |
你直接下载代码,然后用test目录的性能用例。
需要安装dnsperf |
匹配规则的时间复杂度是O(1),不会影响太多性能。应该不是这个问题。 你可以不启用规则测试看看。 |
问题现象
新版本性能变差
压测说明
运行环境
centos7.6
smartdns 版本1: smartdns.1.2020.09.08-2235.x86-linux-all.tar.gz
smartdns 版本2: smartdns.1.2023.03.04-1125.x86_64-linux-all.tar.gz
相同配置, 相同压测工具,queryperf,在压测期间,同时使用nslookup不停对smartdns服务查询站点,查看在压力情况下是否能正常查询.
测试结果
smartdns.1.2020.09.08-2235.x86-linux-all.tar.gz 版本
{'qps': '21304.715020'}
{'totaltime': '188.249924329', 'success': '820', 'fail': '0', 'sucrate': '100.0%', 'rate': '4.355911445504249%'}
{'cpu_avg_used': 72.62}
nslookup 在压测期间,nslookup共执行的次数和总消耗的时间.
执行时间:188.249924329 秒
成功执行 820 个命令
失败执行 0 个命令
smartdns.1.2023.03.04-1125.x86_64-linux-all.tar.gz 版本
{'qps': '4889.277531'}
{'totaltime': '780.141572664', 'success': '87460', 'fail': '0', 'sucrate': '100.0%', 'rate': '112.10785716923746%'}
{'cpu_avg_used': 20.36}
nslookup 在压测期间,nslookup共执行的次数和总消耗的时间.
执行时间:780.141572664 秒
成功执行 87460 个命令
失败执行 0 个命令
可以发现smartdns.1.2023.03.04-1125.x86_64-linux-all.tar.gz版本比smartdns.1.2020.09.08-2235.x86-linux-all.tar.gz qps 少很多**(4889.277531<21304.715020)** 是否需要对新版做什么配置调整?
出现大量的TRR is out of range.
Warning: RTT is out of range: 17.498381 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.498380 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.498381 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.498379 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.491195 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.491202 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.491204 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.491220 [query=www.baidu.com/1, rcode=0]
Warning: RTT is out of range: 17.491259 [query=www.baidu.com/1, rcode=0]
The text was updated successfully, but these errors were encountered: