I would like to know what is the difference between the sndbuf and rcvbuf buffer used by OpenVPN and net.core.w/rmem_default or net.ipv4.tcp_r/wmem.
What does OpenVPN do when some value a provided for these parameter in the config. I read that if you use 0, it uses OS default buffer size but from which buffer does it take the size from ? or is it a extra layer and when you set it to 0 this extra layout disappear ?
My problem is that when I set sndbuf and rcvbuf to 0 and set net.core.w/rmem_default or net.ipv4.tcp_r/wmem to 64k, I am expecting the same throughput than with sndbuf and rcvbuf not set because the default value for sndbuf and rcvbuf is 64k
Unfortunately it is not the case, the throughput is lower when using OS buffer.
This is maybe because I don't set the right OS buffer or that OpenVPN do something special when using sndbuf and rcvbuf.
If anyone can explain in details I would really appreciate it
Thanks
Alo
-----------------------------------------
After some research, I found out that OpenVPN use setsockopt to set the value of SO_SNDBUF and SO_RCVBUF using sndbuf and rcvbuf value in the configuration file. This will only affect the socket created by OpenVPN and not all TCP /UDP sockets.
SO_SNDBUF and SO_RCVBUF are the equivalent of setting:
- /proc/sys/net/core/rmem_max
- /proc/sys/net/core/wmem_max
- /proc/sys/net/net.ipv4/tcp_rmem
- /proc/sys/net/net/ipv4/tcp_wmem
For the protocol used by openvpn (tcp or udp) (might be _default and not _max I am still not sure).
Manually adjusting socket buffer sizes with setsockopt() disables TCP autotuning. (might not be true)
About TCP being affected by the size of r/wmem_default buffers, I found two answer saying the opposite :
You do not need to adjust rmem_default or wmem_default (at least not for TCP tuning). These are the default buffer sizes for non-TCP sockets (e.g. unix domain and UDP sockets).
wmem_default and wmem_max these settings are the fix default send and receive windows size of all Net Traffic (UDP and TCP)
Anyone with more knowledge is welcome to correct me :)