Reactor: Inside the Channel

Chapters

  1. Small messages, fewer calls
  2. Through the channel
  3. Keep the user moving
  4. Within an IC round
  5. Measured throughput
  6. A mesh of canisters
Transcript
Download transcript

REACTOR_LIMITS An inter-canister call is a relatively coarse communication primitive. Small operations compete for callback slots, queue space, and execution time. The replica guarantees fifty callback slots per canister. Reactor makes each physical call carry much more useful work: hundreds of small application messages, grouped into one batch.

REACTOR_CHANNEL Each canister has one Reactor. Requests collect in its outbox, grouped by destination. Here, three hundred small messages fit into one inter-canister call. They cross the channel together. Reactor sends the work already queued; it does not wait for a full batch. The receiving entrypoint stores them in an inbox and acknowledges receipt. This acknowledgement means stored, not completed. The scheduler then runs registered endpoint handlers. These are local synchronous functions: they can read selectors or dispatch actions. Results keep their requests' return addresses. They collect into another batch and travel back through the channel. The sender matches each result to its waiting request.

REACTOR_PRIORITY Queues also help protect the user experience. Reactor serves three priorities: Control, for replies and library obligations; Interactive, for the user's current flow; and Maintenance, for ordinary background work. Here, an interactive request arrives after maintenance, but gets served first. Priority is checked between batches. It cannot interrupt a running handler, and maintenance waits while higher-priority work remains ready.

REACTOR_ROUNDS An ingress cap, say a thousand calls per block, limits incoming calls from outside the IC. It does not limit us to a thousand application operations. On one subnet, an ingress call can trigger batches, handlers, replies, and further calls within the same execution round, while budget remains. Work that does not fit stays queued for a later turn or round. Batching reduces communication overhead; it does not create more compute.

REACTOR_BENCHMARK In a sixteen-canister, single-subnet Pocket I C benchmark, the measured arrival window reached about sixty-five hundred Reactor calls handled per second. Including the final drain, that run averaged about forty-two hundred. We count requests and notifications handled at endpoints. Replies are additional messages; they are not counted again as calls.

REACTOR_MESH Now spread the same channel across six canisters. Every canister receives ingress. A fans out to B, C, D, E, and F, while they send work of their own. Requests, results, and application-created follow-up work share the mesh. These three hundred illustrated operations show the idea: many small messages, fewer physical calls, and each canister still owns its state.