Skip to content

[h2olog] switch from perf buffer to ring buffer #2800

Description

@kazuho

At the moment, we use perf buffers for sending events to h2olog.

As stated in https://nakryiko.com/posts/bpf-ringbuf/, the downside of using perf buffers is that it uses a per-CPU ring buffer, and therefore events that happen on different CPU cores can be read by h2olog in an incorrect order.

While that sounds like a non-issue for a server that has event loop on each thread, the fact is that it is. When a thread is migrated to a different CPU core, then the events that occurred on the original CPU and the new CPU can arrive in different order, sometimes as late as 0.1 seconds (FWIW, I'm writing this in front of a trace that has 173ms of reordering).

This reordering makes it very hard to read the traces.

We should migrate to ring buffer, a new structure as suggested by the document linked above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions