Skip to content

perf: batch io_uring submissions per poll - #8

Merged
bright2227 merged 1 commit into
mainfrom
perf/batched-submission
Jul 28, 2026
Merged

perf: batch io_uring submissions per poll#8
bright2227 merged 1 commit into
mainfrom
perf/batched-submission

Conversation

@bright2227

Copy link
Copy Markdown
Owner

Summary

  • batch prepared SQEs into one submission per poll cycle
  • retry interrupted and partial submissions without losing pending state
  • reserve capacity for linked sendfile operations
  • increase the default ring size and add submission regression tests

Why

Submitting every prepared operation immediately caused an io_uring_enter syscall per operation and did not safely handle partial submission progress.

Impact

Normal event-loop iterations submit queued work with fewer syscalls while preserving correctness under queue pressure, interruptions, and partial submissions.

Validation

  • rebuilt the CFFI binding for the new queue helpers
  • uv run pytest -q — 17 passed
  • uv run ruff check uringloop tests
  • git diff --check main...HEAD

- io_uring_submit is no longer issued per operation; submitter.submit
  only registers the prepared SQEs and _poll flushes them all with a
  single io_uring_enter before waiting for completions. Previously
  every recv/send/accept paid its own syscall, which negates io_uring's
  batching advantage over epoll.
- Raise DEFAULT_ENTRIES from 16 to 256; the submitter already flushes
  and retries if the queue fills up mid-batch.
- Remove the unused *_nogil C wrappers: CFFI API-mode calls release the
  GIL around C calls already, so they were dead code.
- Poll every 10ms instead of 100ms in the proactor e2e conftest, since
  operations now only make progress when _poll runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bright2227
bright2227 marked this pull request as ready for review July 28, 2026 15:10
@bright2227
bright2227 merged commit 179f8d5 into main Jul 28, 2026
1 check passed
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