parca-agent
parca-agent copied to clipboard
Use batch operations
https://github.com/parca-dev/parca-agent/blob/32327eae805c18a3483731cb3dea5fff697dbcb1/pkg/agent/profile.go#L280
libbpf supports the batch operations such as:
-
bpf_map_lookup_and_delete_batch
-
bpf_map_lookup_batch
-
bpf_map_delete_batch
These make sense to be used. Because we already load all the data from the BPF maps into the memory of our user-space program, so might as well do it efficiently. And not only does it allow us to batch, but it also allows us to delete items at the same time, which is exactly what we do anyways after each profiling iteration.
They first need to be implemented in libbpfgo.
Sent in https://github.com/aquasecurity/libbpfgo/pull/97 to support this.
Submitted https://github.com/aquasecurity/libbpfgo/pull/101 to improve error checking within libbpfgo which is necessary for our usage of these batch operations.
This is currently blocked on a libbpfgo patch to improve error handling when calling into the libbpf C library.
See https://github.com/aquasecurity/libbpfgo/pull/100#issuecomment-1004202417 for a summary on my thoughts for error handling and look at comments from Grant on overall summary of where the patch is and the direction for it.
#395 (reverted #403) Waiting for the minimum supported kernel version to 5.2
👋 , is there any profile that shows this is a hotspot? If no, perhaps we can close it. We will always re-evaluate things and keep on profiling the agent to ensure that the performance is within what we expect
Let's close it 😊