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
使用v2ray的socks udp会出现cpu占用高的情况 #2427
Comments
我也出现了这样的情况,开始以为是 |
可以撇开 iptables 单独对 v2ray 发包或者抓包看看有没有打环的情况先? |
怎么操作? |
在linux上测试了一下,有相同的问题 |
Kinda confirmed with custom SOCKS5 UDP tester. Under similar IO performance, the process resource info shown below. test results PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
# generated with top -b -p $(pgrep clash) | grep $(pgrep clash)
10347 root 20 0 803408 9444 3356 S 173.3 0.5 2:29.62 clash-linux-arm
10347 root 20 0 803408 9600 3356 S 167.1 0.5 2:34.65 clash-linux-arm
10347 root 20 0 803408 10152 3356 S 167.3 0.5 2:39.67 clash-linux-arm
10347 root 20 0 803408 9640 3356 S 167.3 0.5 2:44.69 clash-linux-arm
10347 root 20 0 803408 9688 3356 S 167.0 0.5 2:49.70 clash-linux-arm
10347 root 20 0 803408 9836 3368 S 166.7 0.5 2:54.70 clash-linux-arm
10347 root 20 0 803408 10016 3372 S 166.8 0.5 2:59.72 clash-linux-arm
10347 root 20 0 803408 9764 3376 S 168.0 0.5 3:04.76 clash-linux-arm
10347 root 20 0 803408 9868 3376 S 168.3 0.5 3:09.81 clash-linux-arm
10347 root 20 0 803408 10028 3376 S 167.1 0.5 3:14.84 clash-linux-arm
10347 root 20 0 803408 9220 3376 S 151.7 0.5 3:19.39 clash-linux-arm
10347 root 20 0 803408 10132 3376 S 143.0 0.5 3:23.68 clash-linux-arm
10347 root 20 0 803408 10204 3376 S 157.1 0.5 3:28.41 clash-linux-arm
10347 root 20 0 803408 8420 3376 S 62.8 0.5 3:30.30 clash-linux-arm
10347 root 20 0 803408 8420 3376 S 0.0 0.5 3:30.30 clash-linux-arm
# generated with top -b -p $(pgrep v2ray) | grep $(pgrep v2ray)
10390 root 20 0 119496 10424 5416 R 173.3 0.6 0:02.29 v2ray
10390 root 20 0 119496 11308 5472 S 227.3 0.6 0:09.11 v2ray
10390 root 20 0 119496 12108 5500 S 261.8 0.7 0:16.99 v2ray
10390 root 20 0 119496 13028 5516 R 258.7 0.7 0:24.75 v2ray
10390 root 20 0 119496 13720 5520 S 252.0 0.7 0:32.31 v2ray
10390 root 20 0 119496 14384 5540 S 247.5 0.8 0:39.76 v2ray
10390 root 20 0 119496 14596 5564 S 238.7 0.8 0:46.92 v2ray
10390 root 20 0 119496 16036 5564 R 249.0 0.9 0:54.39 v2ray
10390 root 20 0 119496 16012 5568 S 238.2 0.9 1:01.56 v2ray
10390 root 20 0 119496 15996 5568 R 249.0 0.9 1:09.03 v2ray
10390 root 20 0 119496 17416 5572 S 248.2 0.9 1:16.50 v2ray
10390 root 20 0 119496 17140 5572 S 245.7 0.9 1:23.87 v2ray
10390 root 20 0 119496 17224 5572 S 246.7 0.9 1:31.27 v2ray
10390 root 20 0 119496 18124 5584 R 237.5 1.0 1:38.42 v2ray
10390 root 20 0 119496 18624 5584 S 248.3 1.0 1:45.87 v2ray
10390 root 20 0 119496 18160 5596 R 244.2 1.0 1:53.22 v2ray
10390 root 20 0 119496 18176 5596 S 251.3 1.0 2:00.76 v2ray
10390 root 20 0 119496 16532 5596 S 240.7 0.9 2:07.98 v2ray
10390 root 20 0 119496 16844 5596 S 56.3 0.9 2:09.67 v2ray
10390 root 20 0 119496 17136 5600 R 171.4 0.9 2:14.83 v2ray
Test Environment:
|
因为这个问题 我无法使用/2Ray搭建游戏加速器 只能改用$$ |
tproxy 的 udp 没问题 |
v2fly发布的最新的v4.25.0试了一下,cpu占用好点了,我手机上测试,以前占用能到90%,现在最高30%左右,但还是有点高,用iperf3测试udp,网速也就一百多k,30%的cpu占用还是高了点吧,dokodemo-door的tcp,网速10M+占用也就20%左右 |
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days |
提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。
除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。
如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。
你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
4.23.1及以前的几个版本
你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。
已root的安卓手机,使用shell脚本执行iptables规则及运行v2ray,使用v2ray的socks+tun2socks配合处理udp请求
你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等)
将tcp,udp用两个进程分别启动,udp的那个进程cpu占用会出现较高的情况(使用toybox top, busybox top查看)
你期待看到的正确表现是怎样的?
cpu占用低
请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。
客户端配置:
tcp使用的config, config.json
udp使用的config, v2_udp.json
用到的iptables规则
使用了pdnsd,端口1240,没有使用v2ray内置的DNS
(使用了内置的DNS会出现一样的情况)
使用toybox top命令看到的情况:
config.json是上面的tcp配置,v2_udp.json是上面的udp配置
看到的udp的那个进程占用90%+,但上面一行有个300%,所以要除以3,跟busybox top查看的30%+是差不多的。有占用更高的情况,udp的进程cpu占用有达到过60-70%(busybox top),手机会有比较明显的卡顿情况,将数据关掉后,cpu占用降为0。
跟以下几种情况做了比较:
a. iptables规则不变,使用同样用go写的clash(arm,arm64)
b. iptables规则不变,udp部分使用dokodemo-door+TPROXY(上面规则中useTun != 1),配置只使用上面的config.json
c. 不使用mangle规则,不处理udp请求,nat OUTPUT/PREROUTING规则加上
-p udp -j REDIRECT --to-ports 65535
d. 使用内置DNS,tun2socks只处理
-p udp --dport 53
, 其他端口udp在nat表上-p udp ! --dport 53 -j REDIRECT --to-ports 65535
e. iptables规则不变,使用redsocks2+TPROXY
f. 只代理udp,nat表中的
-p tcp -j REDIRECT --to-ports 1230
注释掉使用v2ray+tun2socks和e,f两个情况,会出现cpu占用高的情况。a,b,c,d四种情况都不会出现。
/var/log/v2ray/error.log
文件中。服务器端错误日志:
// 在这里附上服务器端日志
客户端错误日志:
这是前几天使用内置DNS测试时的,CPU占用高时记录的部分日志文件(v2ray+tun2socks)
111.111.111.111:6666是服务器ip,我改了一下
v2ray_1.log
v2ray_2.log
/var/log/v2ray/access.log
文件中。// 在这里附上服务器端日志
其它相关的配置文件(如 Nginx)和相关日志。
如果 V2Ray 无法启动,请附上
--test
输出。通常的命令为
/usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json
。请按实际情况修改。通常的命令为
journalctl -u v2ray
。请预览一下你填的内容再提交。
The text was updated successfully, but these errors were encountered: