[Feature: 21869] Add Ractor#recieve_all method for Message Batching#16105
Open
synacker wants to merge 13 commits into
Open
[Feature: 21869] Add Ractor#recieve_all method for Message Batching#16105synacker wants to merge 13 commits into
synacker wants to merge 13 commits into
Conversation
synacker
force-pushed
the
feature-21869
branch
2 times, most recently
from
February 7, 2026 22:12
fba0113 to
3480ae0
Compare
This comment has been minimized.
This comment has been minimized.
synacker
force-pushed
the
feature-21869
branch
6 times, most recently
from
February 9, 2026 22:21
2138067 to
7277592
Compare
synacker
force-pushed
the
feature-21869
branch
5 times, most recently
from
March 1, 2026 18:50
3d4cf72 to
20ac4d8
Compare
Author
Fix error after merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Ractor API provides an excellent mechanism for inter‑thread communication, but it currently lacks a built‑in message batching technique. I propose adding a receive_all method to enable batch processing of messages, which can significantly improve performance in high‑load scenarios.
Motivation
In distributed queued systems, processing messages one‑by‑one (as with the current receive method) can introduce unnecessary overhead. Batch processing allows:
Reduced context‑switching overhead.
More efficient I/O operations (e.g., fewer file writes).
Better throughput in high‑concurrency environments.
Proposed Solution
Add a receive_all method to the Ractor API that:
Returns all available messages in the Ractor’s mailbox at once (as an array).
Demonstration Code
Below is a benchmark comparing individual receive vs. batch receive_all:
Benchmark Results
On my system, receive_all shows ~4x improvement over individual receive:
Key Observations:
Ractor1 (using receive): Processes each message individually, resulting in frequent I/O calls.
Ractor2 (using receive_all): Processes all queued messages at once, minimizing I/O overhead