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 global map, spinlock, split maps #469

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

jotak
Copy link
Member

@jotak jotak commented Nov 27, 2024

Also:

  • remove MAC and eth_protocol from map key (they're moved to flow
    metrics ie. map values)
  • in every hook, we don't update flow counters, even when the flow doesn't exist and is created. Previously, we were
    adding bytes/packet counters from hooks, which doesn't seem correct as
    counting bytes/packets is the role of the TC hook only - else it can
    lead to overcounts I guess
  • remove code that sets MIN_RTT on TCP flows (not sure why we had that)
  • small refactoring of the "Accumulate" functions to adapt to new model

Copy link

openshift-ci bot commented Nov 27, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Nov 27, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jotak. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jotak
Copy link
Member Author

jotak commented Nov 27, 2024

} else {
// Key does not exist in the map, and will need to create a new entry.
u64 rtt = 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

@msherif1234 I don't understand the rationale for this code. We're setting default RTT for TCP flows, how could that be accurate? I don't see how this wouldn't produce fake data.

Split BPF maps to avoid having one huge map for flows. This should move
us farther from the "stack size limit" that potentially shows up when
adding new features.

This is also a pre-req for later being able to move away from per-cpu
maps, which is wasting memory by duplicating flows across CPUs

Also:
- remove MAC and eth_protocol from map key (they're moved to flow
  metrics ie. map values)
- in every hook, we don't try anymore to create the flow it it didn't
  exist. We assume it should exist. Note that, previously, we were
adding bytes/packet counters from hooks, which doesn't seem correct as
counting bytes/packets is the role of the TC hook only - else it can
lead to overcounts
- remove code that sets MIN_RTT on TCP flows (not sure why we had that)
- small refactoring of the "Accumulate" functions to adapt to new model
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 52.84974% with 91 lines in your changes missing coverage. Please review.

Project coverage is 29.65%. Comparing base (02d1817) to head (70fad30).

Files with missing lines Patch % Lines
pkg/tracer/tracer.go 0.00% 32 Missing ⚠️
pkg/model/flow_content.go 60.52% 20 Missing and 10 partials ⚠️
pkg/exporter/ipfix.go 0.00% 14 Missing ⚠️
pkg/tracer/tracer_legacy.go 0.00% 8 Missing ⚠️
pkg/agent/agent.go 0.00% 2 Missing ⚠️
pkg/model/record.go 60.00% 1 Missing and 1 partial ⚠️
pkg/ebpf/bpf_x86_bpfel.go 0.00% 1 Missing ⚠️
pkg/exporter/kafka_proto.go 83.33% 1 Missing ⚠️
pkg/flow/tracer_map.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   29.52%   29.65%   +0.12%     
==========================================
  Files          50       51       +1     
  Lines        4863     4913      +50     
==========================================
+ Hits         1436     1457      +21     
- Misses       3321     3348      +27     
- Partials      106      108       +2     
Flag Coverage Δ
unittests 29.65% <52.84%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/decode/decode_protobuf.go 29.97% <100.00%> (ø)
pkg/flow/account.go 84.74% <100.00%> (ø)
pkg/flow/decorator.go 100.00% <100.00%> (ø)
pkg/flow/deduper.go 94.54% <100.00%> (-0.05%) ⬇️
pkg/test/tracer_fake.go 52.77% <100.00%> (ø)
pkg/ebpf/bpf_x86_bpfel.go 0.00% <0.00%> (ø)
pkg/exporter/kafka_proto.go 70.00% <83.33%> (ø)
pkg/flow/tracer_map.go 80.00% <50.00%> (+2.22%) ⬆️
pkg/agent/agent.go 33.74% <0.00%> (ø)
pkg/model/record.go 79.59% <60.00%> (+10.70%) ⬆️
... and 4 more

... and 2 files with indirect coverage changes

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

Successfully merging this pull request may close these issues.

2 participants