feat(Core/Optimization): Correctly document sendBuffer size and optimize it. (#18647)

* Fix comment documenting WorldSocket

The buffer is constructed with 4096 bytes but later resized in
WorldSocketThread::SocketAdded() according to the configuration
setting Network.OutUBuff (currently 65536 bytes)

* Reuse calculated packet size

Instead of recalculating the current packet size three times at
worst, calculate it once and reuse it when required.

* Reduce reserved buffer size per WorldSocket

Don't reserve 64kB of memory for every WorldSocket's output
buffer.

Instead, start with a 4kB baseline for every WorldSocket and grow
the buffer size dynamically when we have single packets that do
not fit the current buffer.
This commit is contained in:
Johaine
2024-04-06 15:22:32 +02:00
committed by GitHub
parent c80ad3d779
commit 3a93ae1af1
2 changed files with 19 additions and 12 deletions

View File

@@ -364,11 +364,11 @@ Network.OutKBuff = -1
#
# Network.OutUBuff
# Description: Amount of memory (in bytes) reserved in the user space per connection for
# output buffering.
# Default: 65536
# Description: Amount of memory (in bytes) reserved initially in the user space per
# connection for output buffering.
# Default: 4096
Network.OutUBuff = 65536
Network.OutUBuff = 4096
#
# Network.TcpNoDelay: