Skip to content

perf(zero-cache): improve rm fanout flow control - #7

Closed
Karavil wants to merge 1 commit into
capy/rm-vs-load-serving-local-applyfrom
capy/rm-vs-load-fanout-flow
Closed

perf(zero-cache): improve rm fanout flow control#7
Karavil wants to merge 1 commit into
capy/rm-vs-load-serving-local-applyfrom
capy/rm-vs-load-fanout-flow

Conversation

@Karavil

@Karavil Karavil commented May 26, 2026

Copy link
Copy Markdown
Owner

what changed

Raises the RM fanout byte window, batches forwarded changes, and lets flow control release after majority completion plus padding.

Also fixes the split branch ordering issue found by benchmark: a subscriber batch now enqueues the whole batch synchronously before awaiting results, so later fire-and-forget batches cannot interleave before a prior commit.

benchmark output

Targeted 16-subscriber websocket run, medium-wide-batch-pressure, 15s, apply disabled:

tx/s: 273.7 -> 306.4
rows/s: 5,474.3 -> 6,128.0
fanout msg/s: 84,481.0 -> 91,086.5
max ACK lag: 47,828 -> 47,498

The single-consumer stack run is roughly neutral to noisy for this PR, which matches the intent. This change is about RM fanout pressure across multiple serving replicas.

validation

pnpm exec vitest --project='*no-pg*' run src/services/change-streamer/broadcast.test.ts src/config/zero-config.test.ts src/services/change-streamer/subscriber.test.ts
pnpm run check-types
pnpm exec oxlint --config ../../oxlint.config.ts src/services/change-streamer/broadcast.ts src/services/change-streamer/forwarder.ts src/services/change-streamer/subscriber.ts

Why: let the RM keep the serving apply pipeline full without waiting for every slow subscriber on every small byte window

* release flow control after subscriber majority plus padding

* batch forwarded changes before subscriber fanout

* widen the bounded fanout byte window used by the benchmark
@Karavil
Karavil force-pushed the capy/rm-vs-load-serving-local-apply branch from 0d0e9ec to 8b7d6ce Compare May 26, 2026 19:02
@Karavil
Karavil force-pushed the capy/rm-vs-load-fanout-flow branch from d68c8d6 to 4e5e06e Compare May 26, 2026 19:02
@Karavil

Karavil commented May 26, 2026

Copy link
Copy Markdown
Owner Author

Replaced by rocicorp/mono PRs rocicorp#6070 through rocicorp#6078.

@Karavil Karavil closed this May 26, 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