Commit 1da66bf
authored
feat: Enhance benchmark configuration and latency testing (#72)
* feat: Add --send-delay for latency-focused testing
Introduces a new `--send-delay` command-line argument that adds a
configurable pause between sending messages.
This feature allows users to switch from the default high-throughput
benchmark to a latency-focused test, which is useful for simulating
workloads that are not CPU-bound and for measuring message latency
under a controlled, predictable load.
The implementation includes:
- A new `--send-delay` CLI flag with microsecond-level duration
parsing.
- Integration into the benchmark runner to pause after each send.
- Updated README.md to explain the difference between throughput and
latency testing and document the new flag.
AI-assisted-by: Gemini 2.5 Pro
test: Add unit and integration tests for --send-delay
Adds test coverage for the new send delay feature:
- A unit test for the `parse_duration_micros` function to validate
correct parsing of various time units.
- An integration test (`test_send_delay_is_applied`) to ensure the
`--send-delay` logic correctly pauses between messages during a
benchmark run.
AI-assisted-by: Gemini 2.5 Pro
feat: Add configurable PMQ message priority
Adds a `--pmq-priority` command-line flag to allow setting the message
priority for the POSIX Message Queue (PMQ) mechanism.
This feature enables more fine-grained control over PMQ behavior,
allowing for latency-focused testing where message delivery order
can be influenced by priority.
The priority is passed through the configuration layers and used in the
`mq_send` call. The UI has been updated to display the configured
priority when a PMQ test is run.
AI-assisted-by: Gemini 2.5 Pro
test: Add tests and docs for PMQ priority feature
Adds unit and integration tests to validate the functionality of the
`--pmq-priority` flag.
- A unit test in `src/cli.rs` verifies that the CLI argument is
parsed correctly.
- An integration test in `src/ipc/posix_message_queue.rs` confirms
that the specified priority is correctly applied during the
`mq_send` call. This test uses a `oneshot` channel for robust
synchronization between the server and client tasks.
Also updates the `README.md` to document the new flag for users.
AI-assisted-by: Gemini 2.5 Pro
feat: Add option to control first-message latency spike
Introduces a mechanism to mitigate first-message latency spikes and
provides user control over this behavior.
High latency on the first message of a benchmark is a common phenomenon
due to "cold start" effects like CPU cache misses, page faults, and
one-time memory allocations in the measurement code path.
This commit addresses this by:
1. Sending a single "canary" message before the main measurement loop
begins. This message warms up the hardware and application code
paths.
2. Discarding the result of this canary message by default, ensuring
that the final statistics are more representative of steady-state
performance.
3. Adding an `--include-first-message` command-line flag that allows
users to disable this behavior and include the canary message in
the results for raw performance analysis.
The implementation correctly handles both message-count and
duration-based tests. The UI has been updated to clearly display
whether the first message is being discarded or included in every
benchmark summary.
AI-assisted-by: Gemini 2.5 Pro
refactor(ui): Centralize benchmark configuration display
The benchmark configuration display logic was duplicated, leading to
inconsistent UI output and recurring bugs where new options were not
displayed.
This commit refactors the display logic into a single `BenchmarkConfigDisplay`
struct in `benchmark.rs`, which now serves as the single source of truth.
The dead `impl Display for Args` in `src/cli.rs` has been removed.
This also removes an unused `use std::fmt;` import that was causing a
compiler warning.
AI-assisted-by: Gemini 2.5 Pro
fix(benchmark): Apply send_delay during warmup phase
The warmup loop was not respecting the `--send-delay` argument, causing
it to send messages as fast as possible regardless of the configuration.
This led to unexpected backpressure warnings, particularly for the PMQ
mechanism, even when a delay was specified.
This commit applies the `send_delay` within the warmup message loop,
ensuring that the warmup phase accurately simulates the conditions of the
actual benchmark run.
AI-assisted-by: Gemini 2.5 Pro
update README
* address cargo fmt CI problems
* feat: Add info log for ignored pmq-priority parameter
When the `--pmq-priority` parameter is provided for an IPC
mechanism that is not POSIX Message Queues (PMQ), the parameter is
ignored. This commit adds an `info` level log message to notify the
user when this occurs, so they are aware that the setting is not
being applied.
The message is logged for each non-PMQ mechanism specified when
`--pmq-priority` is used.
AI-assisted-by: Gemini 2.5 Pro
* fix: Prevent server timeout with long send-delay
When running a message-count-based test with a `--send-delay`
that was longer than the servers internal 50ms receive timeout,
the server would prematurely exit. This caused the client to fail
with a "Broken pipe" error when it attempted to send its next
message.
This commit fixes the issue by changing the servers behavior.
When a receive timeout occurs, the server now continues its loop
instead of exiting. This ensures the server waits patiently for all
expected messages, making the benchmark tool robust for any
`--send-delay` value.
AI-assisted-by: Gemini 2.5 Pro
* fix: Correct Windows and macOS build failures
The Windows and macOS builds were failing due to a check for the
`--pmq-priority` parameter that referenced
`IpcMechanism::PosixMessageQueue`, an enum variant that is only
compiled on Linux.
This commit resolves the build failures by wrapping the entire check
in a `#[cfg(target_os = "linux")]` attribute. This ensures the
platform-specific code is only compiled on Linux and is ignored on
all other platforms.
AI-assisted-by: Gemini 2.5 Pro1 parent be0e3a3 commit 1da66bf
7 files changed
Lines changed: 574 additions & 190 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
144 | 196 | | |
145 | 197 | | |
146 | 198 | | |
| |||
153 | 205 | | |
154 | 206 | | |
155 | 207 | | |
| 208 | + | |
156 | 209 | | |
157 | 210 | | |
158 | 211 | | |
159 | 212 | | |
160 | 213 | | |
161 | 214 | | |
162 | 215 | | |
163 | | - | |
| 216 | + | |
| 217 | + | |
164 | 218 | | |
165 | 219 | | |
166 | 220 | | |
| |||
535 | 589 | | |
536 | 590 | | |
537 | 591 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | 592 | | |
555 | 593 | | |
556 | 594 | | |
| |||
564 | 602 | | |
565 | 603 | | |
566 | 604 | | |
567 | | - | |
| |||
0 commit comments