Skip to content

perf(net): avoid the forwarding coroutine in WriteAll - #24

Merged
thweetkomputer merged 1 commit into
mainfrom
codex/writeall-direct-await-20261029
Oct 29, 2026
Merged

thweetkomputer merged 1 commit into
mainfrom
codex/writeall-direct-await-20261029

Conversation

@thweetkomputer

Copy link
Copy Markdown
Contributor

TcpStream::WriteAll allocates a forwarding WriteSome coroutine for each write chunk. Await the existing plain write operation or TLS writer directly in the loop, removing that frame while preserving partial writes, error handling, stream ownership and TLS encryption. Public interfaces and buffer capacities are unchanged.

Validated with 26 Bycorf runtime/network tests and four Lavik E2E tests (large requests/TLS, fragmented replies, native replication and remote GET), all passed with zero skips. Release disassembly confirms that WriteAll calls TcpStream::WriteSome before this change and no longer does afterward. clang-format 23.1.1 passes.

Measured with Lavik PR #388 commit 8be6211, changing only this Bycorf function from pinned revision edb5804: Azure L16aos_v4 server (16 vCPU), separate L32aos_v4 load generator, 32 client threads, 10M existing keys, 1 KiB values, SPDK storage and kernel TCP. Two reverse-order rounds, fresh fill per visit, 30s warmup; SET windows are 120s and GET windows 60s.

Command / connections Baseline ops/s Change ops/s Difference
SET 320 786,963 791,484 +0.57%
SET 640 873,004 876,410 +0.39%
GET 640 1,141,960 1,146,729 +0.42%

Both rounds had positive throughput differences. These are small effects; two rounds do not establish sub-percent gains as statistically significant. Mean per-run SET P99.9 was 11.935→11.839 ms at 320 connections and 27.199→27.519 ms at 640. All command counts matched, GET had zero misses, and no connection errors or half-median throughput seconds occurred. No new object pooling or retained buffer capacity is introduced.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cefc04a4-bbf6-4289-91f0-60fd2477f52f
  • 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 marked this pull request as ready for review October 29, 2026 04:24
@thweetkomputer
thweetkomputer merged commit 74c4c1f into main Oct 29, 2026
10 checks passed
@thweetkomputer
thweetkomputer deleted the codex/writeall-direct-await-20261029 branch October 29, 2026 04:24
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