WEBVTT

00:00:00.550 --> 00:00:03.794
An inter-canister call is a relatively coarse communication

00:00:03.727 --> 00:00:04.406
primitive.

00:00:05.224 --> 00:00:08.937
Small operations compete for callback slots, queue space,

00:00:09.013 --> 00:00:10.356
and execution time.

00:00:11.175 --> 00:00:14.471
The replica guarantees fifty callback slots per canister.

00:00:15.289 --> 00:00:18.846
Reactor makes each physical call carry much more useful work:

00:00:19.000 --> 00:00:22.830
hundreds of small application messages, grouped into one batch.

00:00:25.017 --> 00:00:26.932
Each canister has one Reactor.

00:00:27.751 --> 00:00:31.451
Requests collect in its outbox, grouped by destination.

00:00:32.269 --> 00:00:35.969
Here, three hundred small messages fit into one inter-canister

00:00:35.902 --> 00:00:36.412
call.

00:00:37.230 --> 00:00:38.847
They cross the channel together.

00:00:39.665 --> 00:00:43.026
Reactor sends the work already queued; it does not wait

00:00:42.959 --> 00:00:44.029
for a full batch.

00:00:44.847 --> 00:00:48.156
The receiving entrypoint stores them in an inbox and acknowledges

00:00:48.089 --> 00:00:48.716
receipt.

00:00:49.535 --> 00:00:52.414
This acknowledgement means stored, not completed.

00:00:53.233 --> 00:00:56.242
The scheduler then runs registered endpoint handlers.

00:00:57.061 --> 00:01:00.513
These are local synchronous functions: they can read selectors

00:01:00.446 --> 00:01:01.841
or dispatch actions.

00:01:02.660 --> 00:01:05.240
Results keep their requests' return addresses.

00:01:06.058 --> 00:01:08.794
They collect into another batch and travel back through the

00:01:08.727 --> 00:01:09.250
channel.

00:01:10.069 --> 00:01:13.026
The sender matches each result to its waiting request.

00:01:15.217 --> 00:01:18.057
Queues also help protect the user experience.

00:01:18.875 --> 00:01:22.992
Reactor serves three priorities: Control, for replies and

00:01:22.925 --> 00:01:26.820
library obligations; Interactive, for the user's current flow;

00:01:27.013 --> 00:01:29.828
and Maintenance, for ordinary background work.

00:01:30.646 --> 00:01:34.281
Here, an interactive request arrives after maintenance, but

00:01:34.214 --> 00:01:35.440
gets served first.

00:01:36.258 --> 00:01:38.500
Priority is checked between batches.

00:01:39.318 --> 00:01:42.523
It cannot interrupt a running handler, and maintenance waits

00:01:42.456 --> 00:01:44.893
while higher-priority work remains ready.

00:01:47.083 --> 00:01:51.082
An ingress cap, say a thousand calls per block, limits incoming

00:01:51.015 --> 00:01:52.970
calls from outside the IC.

00:01:53.788 --> 00:01:57.019
It does not limit us to a thousand application operations.

00:01:57.838 --> 00:02:01.850
On one subnet, an ingress call can trigger batches, handlers,

00:02:01.952 --> 00:02:05.470
replies, and further calls within the same execution round,

00:02:05.559 --> 00:02:06.928
while budget remains.

00:02:07.747 --> 00:02:10.769
Work that does not fit stays queued for a later turn or

00:02:10.702 --> 00:02:11.381
round.

00:02:12.200 --> 00:02:15.626
Batching reduces communication overhead; it does not create

00:02:15.559 --> 00:02:16.511
more compute.

00:02:18.717 --> 00:02:22.520
In a sixteen-canister, single-subnet Pocket I C benchmark,

00:02:22.688 --> 00:02:25.685
the measured arrival window reached about sixty-five hundred

00:02:25.618 --> 00:02:27.690
Reactor calls handled per second.

00:02:28.508 --> 00:02:31.948
Including the final drain, that run averaged about forty-two

00:02:31.881 --> 00:02:32.429
hundred.

00:02:33.248 --> 00:02:36.648
We count requests and notifications handled at endpoints.

00:02:37.467 --> 00:02:40.619
Replies are additional messages; they are not counted again

00:02:40.552 --> 00:02:41.388
as calls.

00:02:43.583 --> 00:02:46.488
Now spread the same channel across six canisters.

00:02:47.306 --> 00:02:49.274
Every canister receives ingress.

00:02:50.093 --> 00:02:55.238
A fans out to B, C, D, E, and F, while they send work

00:02:55.171 --> 00:02:56.006
of their own.

00:02:56.825 --> 00:03:00.746
Requests, results, and application-created follow-up work share

00:03:00.679 --> 00:03:01.345
the mesh.

00:03:02.163 --> 00:03:05.342
These three hundred illustrated operations show the idea:

00:03:05.484 --> 00:03:09.287
many small messages, fewer physical calls, and each canister

00:03:09.221 --> 00:03:10.538
still owns its state.

