Conversation
Adds SO_NOBUFFER which replaces previous SO_RCVBUF to eliminate listen socket buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enhancement allows tuning ELKS network applications to use less memory than was otherwise possible from ktcp's heap, while still maximizing efficiency. Programs now have total control over their TCP/IP receive buffer sizes during both passive listen, active connect, and accept sockets.
Previously, SO_RCVBUF set the buffer size for connect and listen sockets. Most ELKS network applications used this to set a small receive buffer for
listenusing SO_LISTEN_BUFSIZE, which was 128. The buffer size for new sockets fromacceptalways defaulted to CB_NORMAL_BUFSIZ (=4380 = 3*(MTU-40)).Now, SO_RCVBUF additionally sets the receive buffer size for accepted sockets, allowing applications to set a smaller (or larger) buffer size for efficiency as well as better use of ktcp's heap.
Adds non-standard
setsockoptoption SO_NOBUFFER which replaces previous SO_RCVBUF to eliminate any listen socket buffer completely.ftpdhas been experimentally enhanced to use a 2920 byte buffer (=2*(MTU-40)). Testing with QEMU showed a small decrease in throughput but using 1/3 less heap per connection in ktcp. This may also want to be performed for the other network applications, to enable more connections in ELKS without running out of ktcp heap.All network applications in elkscmd/inet have been updated. External applications which used SO_LISTEN_BUFSIZ to eliminate a listen socket buffer will have to be recompiled, or their receive buffer size will be set to a very small 128.
Partly based off ideas from code in #2801 which didn't work properly for listen sockets.