• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

databendlabs / openraft / 26814307926

02 Jun 2026 10:21AM UTC coverage: 86.54% (-0.001%) from 86.541%
26814307926

push

github

drmingdrmer
feat: make client-write batch capacity and linger configurable

# Summary

The API message receiver merges consecutive `ClientWrite` requests into a
single batch before submitting them to storage. The batch size was hardcoded
to 4096 and the receiver never waited for more requests, so on slow or busy
networks throughput suffered from undersized batches. This makes both the
batch capacity and a linger (debounce) window configurable, with linger
defaulting to 0 to preserve the current non-waiting behavior.

# Details

- Add `api_batch_capacity` and `api_batch_linger_ms` to `Config` (also exposed
  as CLI options) so the batch size and the time to wait for additional
  requests can be tuned per deployment.
- The batch receiver now waits up to the linger deadline for each additional
  `ClientWrite` and stops merging once the capacity is reached, the deadline
  expires, or a non-matching message arrives, replacing the previously
  hardcoded batch size of 4096.
- Add `AsyncRuntime::mpsc_recv_timeout_at`, a default trait method that returns
  an immediately available value or waits for one until a deadline; the linger
  wait is built on it.
- `BatchRaftMsgReceiver::try_recv` becomes async to support the timed wait, so
  `raft_core` now awaits it.

- Fix: #1758

83 of 90 new or added lines in 4 files covered. (92.22%)

7 existing lines in 3 files now uncovered.

16376 of 18923 relevant lines covered (86.54%)

144345.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.38
/rt/src/async_runtime.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc