-
Notifications
You must be signed in to change notification settings - Fork 0
Description
To produce stable and reliable benchmark results, it is crucial to minimize environmental interference,
particularly from the operating system scheduler. Standard Linux schedulers (like CFS) are designed for
fairness, not for minimizing the latency of a specific application. This can introduce jitter and variability
into our measurements.
Our design should use the SCHED_FIFO real-time scheduling policy to grant the
benchmark processes priority over most other tasks on the system. To ensure we
can run tests in a similarly controlled environment, rusty-comms must support this capability.
Proposed Solution
A new command-line argument should be introduced to enable and configure real-time scheduling for the benchmark
processes.
-
New Command-Line Argument:
- Add an optional flag, for example:
--sched-fifo <priority>. - The
<priority>value should be an integer between 1 (lowest) and 99 (highest) for SCHED_FIFO.
- Add an optional flag, for example:
-
Implementation:
- When this flag is provided, the application will use the
sched_setschedulerfunction from the nix crate to
change the scheduling policy for both the parent (sender) and child (receiver) processes. - This call should be made in both processes immediately after the
fork().
- When this flag is provided, the application will use the
-
Error Handling:
- Setting a real-time scheduling policy often requires elevated privileges (e.g., CAP_SYS_NICE or running as
root). - If the
sched_setschedulercall fails (e.g., due to a permissions error), the application should not
terminate. Instead, it should log a clear and informative WARN message to the user, explaining that the
policy could not be set and that the benchmark will continue with the default scheduler.
- Setting a real-time scheduling policy often requires elevated privileges (e.g., CAP_SYS_NICE or running as
Acceptance Criteria
- A new optional command-line argument,
--sched-fifo <priority>, is added. - If the flag is used,
sched_setscheduleris called for both the parent and child processes with the
specified priority. - If setting the scheduler policy fails, a descriptive warning is logged, and the benchmark continues
execution. - The benchmark runs correctly both with and without the new flag enabled.
- The help text for the new argument clearly explains its purpose and the typical need for elevated
privileges.
Context
This is a high-priority task (P1) for ensuring the environmental comparability of our benchmark results.
This task is dependent on the completion of the multi-process refactoring (Issue #74). The
logic must be applied to the separate parent and child processes created by that task.