Skip to content

perf(net): remove coroutine frames from single-operation stream wrappers - #11

Closed
thweetkomputer wants to merge 6 commits into
eloqdata:mainfrom
thweetkomputer:perf/network-awaitables
Closed

thweetkomputer wants to merge 6 commits into
eloqdata:mainfrom
thweetkomputer:perf/network-awaitables

Conversation

@thweetkomputer

@thweetkomputer thweetkomputer commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

TcpStream::ReadSome, WriteSome, and WriteSomeV create forwarding coroutine frames just to select raw or TLS I/O. Return awaitables from these thin wrappers so raw operations live in the caller's frame. Keep TLS's existing coroutine implementation and symmetric transfer.

Companion integration: eloqdata/lavik#315.

Implementation

  • Select the existing raw operation or own the existing TLS Task without a forwarding coroutine frame.
  • Resolve immediate raw results in await_ready, then bind the continuation before yielding. This avoids self-handle transfers that grow the native stack under sanitizers.
  • Retain the original TLS ReadSome/WriteSome coroutine loops. TLS source and header have no changes against the base revision; there is no manual TLS phase machine or new TLS completion queue hop.
  • Keep WriteAll/WriteAllV/WriteRawAll, raw completion callbacks, and io_uring CQ handling unchanged.
  • Document worker affinity, borrowed buffers, and Task ownership near the code. Architecture contracts remain unchanged.

Validation

From the Lavik integration worktree:

  • All 6 standalone Bycorf Debug tests passed again after rebasing onto main (d13be7b).
  • Before the rebase, CI run 38241141719 passed formatting and all 8 build/test matrix jobs (amd64/arm64, GCC/Clang, bypass ON/OFF).
  • Raw/TLS awaitable tests passed with ASan/UBSan and leak detection.
  • Lavik rebuilt; lavik_reply_fragments_e2e passed for TCP/TLS.
  • clang-format 23.1.1 and git diff --check passed.

Coverage includes immediate errors and empty operations, 100,000 immediate completions, half-close and EOF, short writes, iovec preservation, disconnects, TLS record refill, concurrent TLS reader/writer output locking, foreground/background execution, close_notify, and write failures. The concurrent TLS test uses an explicit peer barrier rather than relying on a fixed sleep.

The earlier CI failure was localized to awaiting EOF after data on a half-closed AF_UNIX socketpair with multishot receive enabled. The stream receive test now uses loopback TCP while retaining the same data-before-half-close timing and assertions. The full CI matrix passed with this transport-specific change; this PR does not alter the underlying AF_UNIX receive implementation. This host cannot register provided-buffer rings, so its local tests use the one-shot fallback.

Compatibility

Direct co_await syntax and results are preserved. Explicit Task-returning forwarding functions for the three converted wrappers need an adapted return type. Full-write APIs remain Taskabsl::Status. Awaitables are immovable because backend tags can refer to their storage.

The runtime TCP/TLS selection wrapper remains. On the local 64-bit host its read/write objects are 88/64 bytes. TLS helper and full-write coroutine frames remain. No service throughput or DPDK performance claim is made.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50cf0731-8d8b-429d-a90d-296288c8d07c

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thweetkomputer thweetkomputer changed the title perf(net): avoid child coroutine frames in stream I/O perf(net): remove coroutine frames from single-operation stream wrappers Oct 12, 2026
@thweetkomputer thweetkomputer changed the title perf(net): remove coroutine frames from single-operation stream wrappers perf(net): use native TCP and TLS stream awaitables Oct 12, 2026
@thweetkomputer thweetkomputer changed the title perf(net): use native TCP and TLS stream awaitables perf(net): remove coroutine frames from single-operation stream wrappers Oct 12, 2026
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