Skip to content

Conversation

@Mateusz-Laczny
Copy link

Hello,

This PR adds 2 new flags - -u and -U. -u flag is used to configure the receive buffer size for the IPv4 socket, and the -U flag is used to configure the same property for the IPv6 socket. By default, buffer sizes are not changed.

@sflow
Copy link
Owner

sflow commented Jun 11, 2025

Good idea, but I think sflowtool should always ask for a larger-than-default buffer. If we always asked for, say, 2MB then that would probably be enough for any normal situation. So I’m thinking we could do this without the clutter of adding CLI options. Would that work for you?

@sflow
Copy link
Owner

sflow commented Jun 16, 2025

See latest commit which asks for 2MB on both SND and RCV, and will print to stderr if it gets less than that.

@Mateusz-Laczny
Copy link
Author

Unfortunately, for our (admittedly quite specific) use case, 2MB is still not enough. It wouldn't make sense to set an even higher value as default, so we would prefer to be able to configure the sizes. But, I understand that this may be unnecessary for most use cases, so this PR can be left unmerged.

@sflow
Copy link
Owner

sflow commented Jun 17, 2025

Would it help if the setting could be configured at compile time on the make(1) command line? At the moment it's a preprocessor definition, but that could be passed in. So you could put your override in a Dockerfile or build script instead of patching the sources.

Also, can you share why you need so much buffering? Is it just that the thread gets preempted by other activity? For higher input rate you might consider recvmmsg() or PF-RING or DPDK or multiple threads or pinning the thread to one core, but none of those tricks seem appropriate for a throwaway demo like sflowtool.

It's quite common for sFlow to be configured with 1:N sampling rate that is more aggressive than it really needs to be (N too small). So that might be worth a look too. For most analysis you can back off the sampling rate by a factor of 10 and barely notice the difference in the results.

@sflow
Copy link
Owner

sflow commented Jun 17, 2025

Upon reflection, it probably does make sense to have this be settable on the CLI. If only to remind people to think about it. But why did you make it possible to set different values for IPv4 and IPv6? OK to have just one setting?

@Mateusz-Laczny
Copy link
Author

Sorry for the late response. I made both values configurable, since I saw two sockets being used. If you think that one value is enough, then I think it's OK to only have a single flag.

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.

3 participants