Skip to content

Add RT scheduling support for ring buffer reader goroutine#271

Draft
YoannGh wants to merge 1 commit intomainfrom
yoanngh/ringbuffer-rt-scheduling
Draft

Add RT scheduling support for ring buffer reader goroutine#271
YoannGh wants to merge 1 commit intomainfrom
yoanngh/ringbuffer-rt-scheduling

Conversation

@YoannGh
Copy link
Copy Markdown
Contributor

@YoannGh YoannGh commented Apr 2, 2026

What does this PR do?

Add SchedPolicy and SchedPriority fields to RingBufferOptions that allow callers to request a realtime scheduling policy for the ring buffer reader goroutine's OS thread.

When SchedPolicy is set, the reader goroutine pins itself to an OS thread via LockOSThread and calls sched_setattr(2) to apply the requested realtime policy and priority. On failure, the error is sent to ErrChan and the reader continues with default scheduling (graceful degradation).

Motivation

The goal is to allow experimenting with realtime scheduling as a way to address ring buffer event loss under heavy load.

Additional Notes

Describe how to test your changes

Add SchedPolicy and SchedPriority fields to RingBufferOptions that allow
callers to request a realtime scheduling policy for the ring buffer
reader goroutine's OS thread.

When SchedPolicy is set, the reader goroutine pins itself to an OS
thread via LockOSThread and calls sched_setattr(2) to apply the
requested realtime policy and priority. On failure, the error is sent
to ErrChan and the reader continues with default scheduling (graceful
degradation).

This reduces eBPF ring buffer event loss under heavy syscall load by
giving the reader thread priority over normal workloads.
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