shadowsocks-rust icon indicating copy to clipboard operation
shadowsocks-rust copied to clipboard

[Enhancement] UDP sockets improve with sendmmsg/recvmmsg

Open zonyitoo opened this issue 3 years ago • 9 comments

  • Linux: https://man7.org/linux/man-pages/man2/sendmmsg.2.html
  • FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=send&sektion=2
  • macOS: https://github.com/apple/darwin-xnu/blob/main/bsd/sys/socket.h#L1433
  • Windows: https://docs.microsoft.com/en-us/windows/win32/api/mswsock/nc-mswsock-lpfn_transmitpackets

Speedtest: https://github.com/shadowsocks/shadowsocks-org/issues/194#issuecomment-1109529757

Batch send and recv UDP packets will significantly increase the upper limit of speed for UDP channels.

Works have to be done:

  • [ ] Find a proper way (zero-cost abstraction) for sendmmsg and recvmmsg on these 4 platforms
  • [ ] Making UDP association channels to be compatible with batch send / recv
  • [ ] Proper way to fallback (when sendmmsg/recvmmsg are not supported)

If anyone interested to make it available, PRs are welcome.

zonyitoo avatar Apr 27 '22 16:04 zonyitoo

遇到未知情况:是否因为没有区分bypass流量,还是proxy流量,在微信语音通话时,通话质量不好。 表现为:在对方说话过程中,己方想插一句话,对方没办法听到。就像无线对讲机的那种体验。

dev4u avatar May 11 '22 09:05 dev4u

sendmmsg and recvmmsg are not used in actual code yet.

zonyitoo avatar May 11 '22 09:05 zonyitoo

sendmmsg and recvmmsg are not used in actual code yet.

那可能是我的ipv6问题,回去我确认一下。

dev4u avatar May 11 '22 09:05 dev4u

那可能是我的ipv6问题,回去我确认一下。

万恶的,几天前开始就把我出国的ipv6流量全掐断了。

多包合发、多包合收的功能什么时候可以开放呢?ipv4的使用体验不是太好,想看看这个能不能提升使用质量。

dev4u avatar May 21 '22 00:05 dev4u

Do not expect sendmmsg/recvmmsg can improve user experience in poor network environment. sendmmsg/recvmmsg is just for reducing syscalls, which will eventually increase the upper limit of performance.

zonyitoo avatar May 21 '22 03:05 zonyitoo

The GFW enforces much fewer rules on IPv6. I think you should do a traceroute to make sure it's not your local network's problem.

database64128 avatar May 21 '22 04:05 database64128

其实对于移动手机用户来说,体验好并不等于上网速度快。更多追求的是电池续航更长点、网络请求响应迅速点。 或许这也是大佬们说的,别压榨尽手机的极限能力吧。 sendmm、recvmm,正是把多次包合并一次来处理。在理论上,应该能延长电池续航能力。

dev4u avatar May 21 '22 05:05 dev4u

The GFW enforces much fewer rules on IPv6. I think you should do a traceroute to make sure it's not your local network's problem.

先放几天再试,毕竟最近网上太多事情发生了,有可能受不知哪个事件的影响导致的。

dev4u avatar May 21 '22 05:05 dev4u

Turns out FreeBSD's sendmmsg(2) is just a compatibility shim in its libc. It still makes sendmsg(2) syscalls. https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/sendmmsg.c

Therefore it should be removed from the list.

database64128 avatar Aug 09 '22 14:08 database64128