Skip to content

Send SV2 frames in a single write#1771

Merged
0xf0xx0 merged 1 commit into
bitaxeorg:masterfrom
warioishere:feature/sv2-single-write
Jun 21, 2026
Merged

Send SV2 frames in a single write#1771
0xf0xx0 merged 1 commit into
bitaxeorg:masterfrom
warioishere:feature/sv2-single-write

Conversation

@warioishere

Copy link
Copy Markdown
Contributor

SV2 frames were sent as two writes — the encrypted header, then the encrypted payload — so every share submit left the device as two TCP segments. This builds both parts into one buffer and sends them in a single write, so a frame goes out as one segment.

On my hardware this drops the SV2 submit response time from ~8.1 ms to ~5.4 ms, on top of the TCP_NODELAY fix — so the two-write pattern still had measurable overhead even with Nagle disabled.

It also removes the root cause that #1722 (TCP_NODELAY) worked around: that latency came from the second segment being held back by Nagle until the first was ACKed. With the whole frame sent as a single segment there is no held-back second segment, so TCP_NODELAY is no longer needed as a fix here. It does not hurt to keep it in either — still sensible for a latency-sensitive socket — so this PR leaves it untouched.

The bytes on the wire are identical (header and payload use separate Noise nonces but are just consecutive bytes); the receiver reads the 22-byte header first and then the payload, so it is unaffected. No pool-side change needed.

Tested on hardware against an SV2 pool.

The encrypted header and payload were sent as two writes, so every frame
left as two TCP segments. Build them into one buffer and send once, so a
frame is a single segment — drops SV2 submit response time further (8.1
to 5.4 ms measured) on top of the TCP_NODELAY fix.
@github-actions

Copy link
Copy Markdown

Test Results

 2 files   2 suites   0s ⏱️
92 tests 92 ✅ 0 💤 0 ❌
94 runs  94 ✅ 0 💤 0 ❌

Results for commit 46d4e3e.

@mutatrum mutatrum added the enhancement New feature or request label Jun 17, 2026
@WantClue WantClue added this to the 2.15.0 milestone Jun 19, 2026

@0xf0xx0 0xf0xx0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

acked

@0xf0xx0 0xf0xx0 merged commit 5a3afba into bitaxeorg:master Jun 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants