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

Use recvmmsg() when available #17

Open
socketpair opened this issue Sep 28, 2012 · 3 comments
Open

Use recvmmsg() when available #17

socketpair opened this issue Sep 28, 2012 · 3 comments

Comments

@socketpair
Copy link
Contributor

On huge netlink traffic (like ULOG or NFLOG) receiving one message per syscall affect performance. Receiving multiple mesasges at once give preformance boost.

@thom311
Copy link
Owner

thom311 commented Dec 2, 2016

Note that since commit 55ea6e6, we use recvmsg() with MSG_PEEK by default, which means that for each message two syscalls are required.

@socketpair
Copy link
Contributor Author

:(
Did anyone test performance ?

@thom311
Copy link
Owner

thom311 commented Dec 4, 2016

Not tested, because correctness trumps performance.

To get the previous behavior, call nl_socket_disable_msg_peek() (this also works against older versions of the library). Then it's up to you to ensure that the buffer size is large enough (it's not clear how to do that in the general case).

FWIW, systemd does MSG_PEEK too: https://github.com/systemd/systemd/blob/3099caf2b5bb9498b1d0227c40926435ca81f26f/src/libsystemd/sd-netlink/netlink-socket.c#L337

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

No branches or pull requests

2 participants