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

[bugfix] Replace custom direction filter for loopback interfaces with BPF filter #76

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

fako1024
Copy link
Owner

@els0r I'm glad this popped up, gave me the chance to rethink the strategy and drop the whole internal filtering complexity in favor of the far more efficient BPF filter logic on kernel level. See Issue comment in #75 for more details:

Benchmarks:

                                                 │ nobpf │            bpf            │
                                                 │     sec/op     │    sec/op     vs base               │
CaptureMethods/NextPacket_10485kiBx4-4               78.64n ±  0%   77.22n ±  0%  -1.81% (p=0.000 n=15)
CaptureMethods/NextPacketInPlace_10485kiBx4-4        34.99n ±  1%   34.78n ±  0%  -0.60% (p=0.002 n=15)
CaptureMethods/NextPayload_10485kiBx4-4              69.24n ±  0%   70.26n ±  0%  +1.47% (p=0.000 n=15)
CaptureMethods/NextPayloadInPlace_10485kiBx4-4       29.83n ±  1%   29.66n ±  1%       ~ (p=0.237 n=15)
CaptureMethods/NextPayloadZeroCopy_10485kiBx4-4      17.09n ±  1%   17.05n ±  1%       ~ (p=0.418 n=15)
CaptureMethods/NextIPPacket_10485kiBx4-4             73.32n ±  0%   71.40n ±  0%  -2.62% (p=0.000 n=15)
CaptureMethods/NextIPPacketInPlace_10485kiBx4-4      34.51n ±  1%   32.76n ±  1%  -5.07% (p=0.000 n=15)
CaptureMethods/NextIPPacketZeroCopy_10485kiBx4-4     17.21n ±  1%   17.04n ±  1%  -0.99% (p=0.004 n=15)
CaptureMethods/NextPacketFn_10485kiBx4-4             24.25n ± 11%   23.33n ± 10%       ~ (p=0.267 n=15)
CaptureMethods/NextPacket_10kiBx512-4                205.0n ±  7%   196.5n ±  1%  -4.15% (p=0.000 n=15)
CaptureMethods/NextPacketInPlace_10kiBx512-4         143.4n ±  3%   139.4n ±  1%  -2.79% (p=0.008 n=15)
CaptureMethods/NextPayload_10kiBx512-4               183.4n ±  1%   177.0n ±  2%  -3.49% (p=0.000 n=15)
CaptureMethods/NextPayloadInPlace_10kiBx512-4        144.2n ±  3%   143.3n ±  4%       ~ (p=0.767 n=15)
CaptureMethods/NextPayloadZeroCopy_10kiBx512-4       149.9n ±  2%   143.7n ±  1%  -4.14% (p=0.000 n=15)
CaptureMethods/NextIPPacket_10kiBx512-4              183.9n ±  3%   178.1n ±  2%       ~ (p=0.123 n=15)
CaptureMethods/NextIPPacketInPlace_10kiBx512-4       141.6n ±  2%   139.3n ±  2%  -1.62% (p=0.012 n=15)
CaptureMethods/NextIPPacketZeroCopy_10kiBx512-4      149.6n ±  3%   142.6n ±  2%  -4.68% (p=0.000 n=15)
CaptureMethods/NextPacketFn_10kiBx512-4              145.8n ±  2%   142.2n ±  3%  -2.47% (p=0.012 n=15)
geomean                                              75.78n         74.03n        -2.31%

Closes #75

@fako1024 fako1024 added bug Something isn't working performance Performance / optimization related topics labels Oct 11, 2023
@fako1024 fako1024 requested a review from els0r October 11, 2023 07:11
@fako1024 fako1024 self-assigned this Oct 11, 2023
@fako1024 fako1024 linked an issue Oct 11, 2023 that may be closed by this pull request
Copy link
Collaborator

@els0r els0r left a comment

Choose a reason for hiding this comment

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

See minor comment about switch statement.

link/link.go Show resolved Hide resolved
@fako1024 fako1024 merged commit 9e9e603 into main Oct 12, 2023
4 checks passed
@fako1024 fako1024 deleted the 75-misleading-stats-for-loopback-interfaces branch October 12, 2023 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Performance / optimization related topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading stats for loopback interfaces
2 participants