Skip to content

fix(memtrack): handle dropped events better#321

Open
not-matthias wants to merge 4 commits intomainfrom
cod-2577-detect-or-prevent-dropped-events-in-memtrack-ringbuffer
Open

fix(memtrack): handle dropped events better#321
not-matthias wants to merge 4 commits intomainfrom
cod-2577-detect-or-prevent-dropped-events-in-memtrack-ringbuffer

Conversation

@not-matthias
Copy link
Copy Markdown
Member

No description provided.

The eBPF ring buffer was 256 KiB (~4.7k events). High-allocation
benchmarks could fill it faster than userspace drained, silently
losing events. Bump it to 16 MiB (~300k events) and add a single-slot
BPF array that bpf_ringbuf_reserve() failures atomically increment,
so userspace can detect when the trace is incomplete.

Refs COD-2577.
Replace the 10ms-timeout poll loop with a blocking epoll wait that
combines the ring buffer's epoll fd and a shutdown eventfd. The
kernel now wakes the drain thread the moment events arrive, which
removes the polling-induced backlog under bursty workloads.

Refs COD-2577.
The streamed event file has no header, so per-run summary data has
nowhere to live. Add a small JSON sidecar (`{pid}.MemtrackMeta.json`)
carrying the dropped-event count so the backend can invalidate
benchmarks whose trace is incomplete.

Refs COD-2577.
After the tracked command exits, read the eBPF dropped-event
counter, log a warning if non-zero, and persist the value as a
MemtrackMeta sidecar next to the events file. Lets the backend
mark a benchmark as incomplete instead of silently accepting a
truncated memory trace.

Refs COD-2577.
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 28, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing cod-2577-detect-or-prevent-dropped-events-in-memtrack-ringbuffer (c673c68) with main (c227c9f)

Open in CodSpeed

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.

1 participant