Add -u and -U options, for setting UDP socket receive buffer sizes, for IPv4 and IPv6 respectively#53
Conversation
…r IPv4 and IPv6 respectively
|
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? |
|
See latest commit which asks for 2MB on both SND and RCV, and will print to stderr if it gets less than that. |
|
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. |
|
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. |
|
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? |
|
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. |
Hello,
This PR adds 2 new flags -
-uand-U.-uflag is used to configure the receive buffer size for the IPv4 socket, and the-Uflag is used to configure the same property for the IPv6 socket. By default, buffer sizes are not changed.