iovisor / iovisor/bcc

Reduce CPU overhead of per-event tools by allowing more buffering

Open
#1,033 12 comments 0 reactions 0 assignees View on GitHub
help wanted prio:high
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

Not a big problem yet, but at some point we should look into this...

The normal perf_output-consuming loop we've been using is:

```
while 1:
b.kprobe_poll()
```

This wakes up as quickly as it can, and can consume noticeable CPU. I had to tune it for my cpuunclaimed tool:

```
while 1:
# allow some buffering by calling sleep(), to reduce the context switch
# rate and lower overhead.
try:
if not exiting:
sleep(wakeup_s)
except KeyboardInterrupt:
exiting = 1
b.kprobe_poll()
slept += wakeup_s
```

This ticket is to explore doing this for more tools. Should b.kprobe_poll() have a built-in sleep, that can be tuned? Eg, 100ms by default?

This is more practical now we have #997, and can increase the buffer size.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names the b.kprobe_poll() loop, the cpuunclaimed tool, perf_output consumers, and #997; start by tracing that polling entry point and comparing it with cpuunclaimed’s sleep-based loop. Review which tools use this pattern and how the buffer-size change affects them. Done requires a scoped, measured decision about tunable buffering or sleep behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.