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

pkg/agent: Use eBPF map batch operations #181

Closed
wants to merge 3 commits into from

Conversation

derekparker
Copy link
Contributor

This patch adds support for using eBPF batch operations on maps which
should dramatically improve the performance of the parca-agent by
enabling it to batch lookup and delete keys/values in maps in a single
operation.

This replaces the use of iterators in favor of iteration in batches.

Fixes #74

@derekparker derekparker changed the title pkg/agent: Use eBPF map batch operations WIP: pkg/agent: Use eBPF map batch operations Dec 21, 2021
@derekparker derekparker force-pushed the ebpf-batch-map branch 3 times, most recently from e91265d to 40ceae5 Compare January 13, 2022 01:28
@derekparker derekparker marked this pull request as ready for review January 13, 2022 01:43
@derekparker derekparker changed the title WIP: pkg/agent: Use eBPF map batch operations pkg/agent: Use eBPF map batch operations Jan 13, 2022
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

It looks good to me.

We just need to clean up a minor thing.

README.md Outdated Show resolved Hide resolved
cmd/parca-agent/main.go Outdated Show resolved Hide resolved
@@ -53,6 +54,16 @@ const (
doubleStackDepth = 254
)

// stackCountKey mirrors the struct in parca-agent.bpf.c.
//
// TODO(derekparker) Perhaps in order to keep these in sync we should write a Go generator to
Copy link
Member

Choose a reason for hiding this comment

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

Awesome idea! Let's do it.

Copy link
Member

Choose a reason for hiding this comment

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

Already the opened the issue for it #207


stackBytes, err := stackTraces.GetValue(unsafe.Pointer(&userStackID))
if err != nil {
//profile.MissingStacks++
// TODO(derekparker): Should we log or increment missing stack trace count?
Copy link
Member

Choose a reason for hiding this comment

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

👍 Let's add a metric for it, not necessarily in this PR though. #208

// memsetCountKeys will reset the given slice to the given value.
// This function makes use of the highly optimized copy builtin function
// and is able to fill the entire slice in O(log n) time.
func memsetCountKeys(in []stackCountKey, v stackCountKey) {
Copy link
Member

Choose a reason for hiding this comment

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

❤️

Copy link
Member

Choose a reason for hiding this comment

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

🚀

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

Let's clean up first.

This patch adds support for using eBPF batch operations on maps which
should dramatically improve the performance of the parca-agent by
enabling it to batch lookup and delete keys/values in maps in a single
operation.

This replaces the use of iterators in favor of iteration in batches.

Fixes parca-dev#74
@derekparker
Copy link
Contributor Author

Let's clean up first.

Done!

@kakkoyun kakkoyun closed this Mar 3, 2022
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.

Use batch operations
3 participants