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

Simplifying observed interfaces - moving it to main map #509

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jotak
Copy link
Member

@jotak jotak commented Jan 15, 2025

Observed interfaces is a structure managed from the TC hook, so it is elligible for being written in the main map instead of the additional metrics map. Moreover, it is very frequently created (the vast majority of flows being observed from at least two interfaces), so having it in the additional maps sort of defeats one of its purpose, that was allowing to reduce the memory used by separating commonly flow data from more uncommon data.

In other words, when this is set into the addtional map, the size map becomes similar to main map, whereas if removed the size map can be shrinked to a much lower number.

Also:

  • Increase Max Interfaces
  • ignore direction for duplicate interface checks (tradeoff to minimize loss of data in case of max reached)
  • Discard non IP flows (as they all end up in the same map bucket, they make the max interface quickly reached)

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Copy link

openshift-ci bot commented Jan 15, 2025

[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 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

bpf/flows.c Outdated
bpf_printk("error creating new observed_intf: %d\n", ret);
}
}
add_observed_intf(aggregate_flow, skb->ifindex, direction);
Copy link
Member Author

Choose a reason for hiding this comment

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

need to acquire lock here

Copy link
Contributor

Choose a reason for hiding this comment

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

make interface update part of update_existing_flow()

Copy link
Member Author

Choose a reason for hiding this comment

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

done, but I still take the lock in add_observed_intf for 2 reasons:

  • we can't call a function while having a lock (so for instance the call to increase_counter isn't allowed)
  • we can't read map value while having the lock, so all the for-loop to check for existing intf+direction isn't allowed during locking
    In other words we need to keep lock as short time as possible

jotak added 2 commits January 16, 2025 13:34
Observed interfaces is a structure managed from the TC hook, so it is
elligible for being written in the main map instead of the additional
metrics map. Moreover, it is very frequently created (the vast majority
of flows being observed from at least two interfaces), so having it in
the additional maps sort of defeats one of its purpose, that was
allowing to reduce the memory used by separating commonly flow data from
more uncommon data.

In other words, when this is set into the addtional
map, the size map becomes similar to main map, whereas if removed the
size map can be shrinked to a much lower number.
@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 16, 2025
Copy link

New image:
quay.io/netobserv/netobserv-ebpf-agent:6970084

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=6970084 make set-agent-image

... and ignore direction for duplicate interface checks (tradeoff to
minimize loss of data in case of max reached)

Also some padding optimisation
@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 16, 2025
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