-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Minor Change
-
Dotnet Drivers
In TcpStreamFactory, the socket's SO_RCVBUF and SO_SNDBUF are set to the values contained in TcpStreamSettings:
socket.ReceiveBufferSize = _settings.ReceiveBufferSize; socket.SendBufferSize = _settings.SendBufferSize;
The default value for these buffer sizes is 64KB. (See the constructor for TcpStreamSettings.) Most users do not explicitly modify these settings and end up with the defaults.
The MSDN docs for Socket.ReceiveBufferSize indicate that the value is OS-dependent, but the API docs say (incorrectly) that it is 8KB:
An Int32 that contains the size, in bytes, of the receive buffer. The default is 8192.
Empirically comparing the values set by various OSes:
OS | SO_RCVBUF | SO_SNDBUF |
Windows 10 | 65536 | 65536 |
MacOS Sonoma | 408300 | 146988 |
Ubuntu 20.04 | 131072 | 131072 |
While the intent was to increase the TCP buffer sizes, modern OSes appear to have increased their defaults and thus the code is actually decreasing the TCP buffer sizes.
We should make TcpStreamSettings.ReceiveBufferSize and TcpStreamSettings.SendBufferSize nullable and only modify the OS defaults if their values are explicitly set by the user.
This issue originated from this forums post.