Skip to content

Batched datagram I/O for Windows (IOCP/RIO) and io_uring on Linux #48

Description

@Segfaultd

Summary

Extend batched datagram I/O beyond the Linux recvmmsg/sendmmsg paths: io_uring on Linux as a next step, and IOCP with WSASendMsg/WSARecvMsg (or Registered I/O) on Windows.

Motivation

Linux currently coalesces up to MMSG_BATCH_MAX datagrams per syscall, which cut syscall counts by roughly 31x on burst workloads. Windows and macOS still pay one syscall per datagram, so servers on those platforms hit syscall overhead first under load.

Proposal

  • Windows: batch sends through overlapped WSASendMsg submissions completed via IOCP, or Registered I/O (RIO) ring buffers for the server oriented build; RIO gives the closest analogue to sendmmsg amortization
  • Linux (second phase): an io_uring backend submitting send/recv SQEs in bulk, replacing per tick sendmmsg calls with ring submissions
  • Follow the established structure: all batching logic stays in portable helpers (see MmsgBatch.h: DriveBatchedSend, ClassifySendmmsgErrno equivalents, CompactRecvSlots) with unit tests compiled on every platform; only the syscall glue is platform gated, with no build options and no capability macros

Validation

  • Unit tests for any new portable helper on all platforms
  • On the target platform, a burst integration test that provably crosses the batch threshold (message counts above the batch max), mirroring Tests/Integration/MmsgBatchLiveTests.cpp
  • Before/after syscall or completion counts recorded in the PR description using the platform profiler (strace equivalent, xperf, dtrace)

Acceptance criteria

  • Behaviour identical to the per datagram path; only syscall counts differ
  • No new configuration surface

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions