Skip to content

perf(net): add opt-in buffered stream reads - #15

Merged
thweetkomputer merged 2 commits into
eloqdata:mainfrom
thweetkomputer:perf/large-bulk-read
Oct 15, 2026
Merged

thweetkomputer merged 2 commits into
eloqdata:mainfrom
thweetkomputer:perf/large-bulk-read

Conversation

@thweetkomputer

@thweetkomputer thweetkomputer commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Large incoming payloads can already span several queued receive buffers, but TcpStream::ReadSome returns only the front buffer. Add opt-in ReadSomeBuffered(span<byte>) so callers with a larger destination can consume the queued bytes in one await, bounded by the destination size. It waits only for initial data and returns as soon as the available queue drains. Existing ReadSome behavior and receive-pool sizing remain unchanged.

The new API preserves partial-buffer offsets, byte order, and EOF semantics. If a later buffer view fails after bytes were consumed, it returns the valid prefix and reports the error on the next read. TLS keeps its existing decrypted-read behavior. Public API comments explain caller responsibility for scheduling fairness.

Validation: Debug build with GCC 13; all five standalone CTest checks passed. CI passed all eight combinations of amd64/arm64, Clang/GCC Debug, and kernel-bypass OFF/ON, plus clang-format. The CI artifact confirms the real multishot receive and EOF assertions pass without the provided-buffer fallback. The new check uses deterministic queued backend views for cross-buffer ordering, partial reads, unchanged ordinary reads, and error handling, plus real Unix socket receives for initial waiting, prompt short reads, and EOF. This host rejects io_uring provided-buffer-ring setup with EINVAL, so live socket checks use the runtime's existing one-shot fallback; live multishot batching performance was not measured.

The EOF fixture tests queued data plus EOF deterministically, then checks real socket EOF after consuming the sent payload. This avoids the older Linux AF_UNIX multishot lost-EOF wakeup race triggered by back-to-back send and shutdown, while preserving coverage of data-before-EOF ordering. Assertions flush their output so any CI timeout identifies the last completed check.

cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Debug -DBYCORF_BUILD_EXAMPLES=OFF
cmake --build build --target bycorf_tcp_buffered_read_check bycorf_connect_timer_check bycorf_connection_storage_check bycorf_backend_selection_check bycorf_task_transfer_check --parallel 4
ctest --test-dir build --output-on-failure --no-tests=error

@coderabbitai

coderabbitai Bot commented Oct 15, 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: 53a555e6-e5d8-4d3c-8f11-3cdc2f47a165
  • 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 merged commit 0f7b4c0 into eloqdata:main Oct 15, 2026
10 checks passed
@thweetkomputer
thweetkomputer deleted the perf/large-bulk-read branch October 15, 2026 05:07
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