Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from sysctl to setsockopt for setting recv/send buffer sizes #3594

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

gregcusack
Copy link

@gregcusack gregcusack commented Nov 12, 2024

Problem

receive and send buffer sizes should not be set system wide to 128MB.

Summary of Changes

  1. Leave the system wide max buffer sizing
  2. Remove system wide default buffer sizing
  3. use secksockopt to set the send and receive buffer sizes
  4. remove OS check for default, system wide send/recv buffer sizes

NOTES

  1. This PR does not actually change any buffer sizes. This is just reimplementing the same buffer sizes at runtime instead of system wide via sysctl.
  2. There will be follow up PR(s) to
    a) reduce the size of the send or recv buffer on the unused side of sockets
    b) make better sizing decisions on socket buffers based on actual use

Copy link

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be follow up PR(s) to ...

Obviously out of scope for this PR, but we might consider hidden CLI args (maybe non-hidden at some point) to control this as well

net-utils/src/lib.rs Outdated Show resolved Hide resolved
@gregcusack gregcusack force-pushed the set-socket-buffer-limits branch from 8253fe7 to ab0eefc Compare November 12, 2024 21:54
@t-nelson
Copy link

Obviously out of scope for this PR, but we might consider hidden CLI args (maybe non-hidden at some point) to control this as well

I'd probably punt cli args altogether. The next iteration will be to selectively set buffers on the ports that actually need it. We don't even offer the ability to configure service port number individually. If we intend to support precision service socket configurations, we should do that all in one change set with consideration for consistency

Copy link

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks!

@gregcusack gregcusack merged commit 8b4f5e0 into anza-xyz:master Nov 14, 2024
41 checks passed
@gregcusack gregcusack deleted the set-socket-buffer-limits branch November 14, 2024 22:59
@@ -421,6 +426,10 @@ fn udp_socket_with_config(config: SocketConfig) -> io::Result<Socket> {

let sock = Socket::new(Domain::IPV4, Type::DGRAM, None)?;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants