Skip to content

feat(io): add REST performance instrumentation - #178

Open
ran-yuan-rui wants to merge 4 commits into
NVIDIA:mainfrom
ran-yuan-rui:feat-rest-perf-counters
Open

feat(io): add REST performance instrumentation#178
ran-yuan-rui wants to merge 4 commits into
NVIDIA:mainfrom
ran-yuan-rui:feat-rest-perf-counters

Conversation

@ran-yuan-rui

Copy link
Copy Markdown

What

Implements the REST perf-instrumentation follow-up left out of #172. Sirius consumes these counters in its S3 tests and benchmark JSON.
Add loopback HTTP range server for REST conformance tests

Counter behavior

  • Retry, terminal-failure, device-stream-sync, and payload-byte counters are always enabled. Payload bytes count HTTP response-body bytes across attempts, including retries.
  • chunk_get, queue_wait, h2d_observed, blocking_host_get, and ttfb_ns are recorded only when perf_instrumentation is enabled. The disabled instrumentation path adds no clock reads.
  • Despite its retained name, ttfb_ns measures GET submission to completion of the first completed GET, not time to the first byte on the wire.
  • Counters use relaxed atomics. Snapshots can be read while reactors are running without taking reactor locks, but exact comparisons should be made after outstanding requests finish.
  • rest_perf_snapshot is source-pin API rather than a stable binary layout. New fields are appended without reordering existing fields.
  • cuCascade exposes only the C++ config field. YAML wiring remains the responsibility of the embedding application.

Validation

  • Standalone: pixi run -e cuda-12-stable build / test — 4/4 ctest targets, cucascade_io_tests 103 cases / 1169 assertions green, [rest][perf] 20 cases / 149 assertions.
  • Consumer-side: the Sirius integration branch builds against this branch, and its full S3 integration suite and S3 benchmark pass with the perf coverage restored (the counters are consumed by its tests and its benchmark JSON).

Adds a perf_instrumentation config gate (off by default; no hot-path
clock reads when off), per-request timing carriers on
rest_chunked_rx_request, and a host_read_attribution tag so synchronous
host reads can be told apart from async chunk reads.
prep_host_rx_request gains a four-argument overload carrying the tag;
the existing three-argument signature stays as a delegating overload, so
no existing symbol or caller changes.
…ation

Adds the REST perf-counter subsystem: a 16-field rest_perf_snapshot
value struct, per-reactor relaxed atomics behind it, and a pool-level
aggregation on rest_ioctx (sums, maxes, and the smallest non-zero ttfb).
Retry, terminal-failure, device-stream-sync and payload-byte counters
are always on; the micro timings (chunk_get, queue_wait, ttfb,
h2d_observed) record only under the perf_instrumentation gate, which
costs zero clock reads when off.  Snapshot layout is not ABI-stable:
consumers build from the same source pin, and fields are appended, never
reordered or removed.
A real 127.0.0.1 HTTP/1.1 server for driving the REST reactor end to end
in-process: ranged GET/206, HEAD, a single-page LIST XML mode, a
controllable per-request delay, and fault injection (fail the first N
requests with a configurable status).  Pure POSIX + std, header-only.
Twenty cases on cucascade_io_tests locking the perf-counter contract:
default/zero state and noexcept readouts, chunk vs blocking vs footer
attribution, HEAD and LIST isolation from payload/chunk counters, gate
on/off semantics (safety counters live with the gate off), pool
aggregation across reactors, retry/terminal accounting incl. the 403
re-authorize path, device-read h2d timings with a clean-read
stream-sync-zero proof, deterministic queue wait, and a stash-hit
zero-movement check.  Driven through the loopback range server; snapshots
are read only after all futures resolve (counters are relaxed atomics).
@copy-pr-bot

copy-pr-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@felipeblazing

Copy link
Copy Markdown
Contributor

/ok to test 3eda942

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.

3 participants