Daemon: batched forks

cua.daemon.v1 batched forks: many sandboxes from checkpoints at once, on this machine or across your machines.

Requests and events of SandboxService.ForkSandboxBatch: groups of forks of one checkpoint placed together on one machine, checkpoints spread over the least-loaded machines, each fork streamed as it is ready.

Source: libs/cua/proto/cua/daemon/v1/fork_batch.proto.

ForkBatchService#

cua.daemon.v1.ForkBatchService

Batched forks, served by the local cua daemon next to SandboxService.

ForkBatchService.ForkSandboxBatch#

/cua.daemon.v1.ForkBatchService/ForkSandboxBatch, server stream: ForkSandboxBatchRequest to ForkSandboxBatchResponse.

Forks many sandboxes from checkpoints at once, on this machine or across your machines. Streams each fork as soon as it is ready (or failed), then one done. A fork that fails does not stop the others, and the batch runs to completion if the caller goes away.

Types in cua/daemon/v1/fork_batch.proto#

ForkBatchGroup#

The forks of one checkpoint that go to one machine together.

Field#TypeDescription
source1stringThe checkpoint (or local sandbox) to fork.
count2uint32How many forks.
name_prefix3stringNames are <name_prefix>-<n>. Empty: the batch's prefix, else <source>-<random>.

ForkSandboxBatchRequest#

Request for SandboxService.ForkSandboxBatch.

Field#TypeDescription
source1stringShorthand for one checkpoint: fork source count times, in groups of group_size. Leave empty when groups is set.
count2uint32How many forks of source.
group_size3uint32Forks of source per group (0: all in one group).
groups4repeated ForkBatchGroupThe groups, each of one checkpoint, when the batch has several checkpoints.
on5stringWhere: empty or local (this machine), auto (your machines that provide Spaces, this one included, least loaded first), or host:<machine> (one machine).
max_parallel_per_host6uint32Forks started at once on one machine (0: 4).
cpus8uint32vCPUs each fork is counted as when placing (0: 1; forks of one world are mostly idle and share its pages).
memory_mb9uint64Memory (MiB) each fork is counted as when placing (0: the checkpoint's when this machine holds it, else 2048).
name_prefix10stringName prefix for groups without their own.
fallback11SnapshotFallbackWhere machines fetch a checkpoint they do not hold when the machine that has it cannot be reached.
retries12uint32How many times forks that failed because their machine failed are placed again on another machine (0: once; set no_retry for never).
no_retry13boolNever place failed forks again.

ForkBatchPlacement#

Where a group goes.

Field#TypeDescription
group1uint32The group (index into the batch's groups).
source2stringIts checkpoint.
host3stringThe machine (local for this one).
count4uint32How many of its forks go there (a group too big for one machine is split, and placed in several parts).
attempt5uint321 for the first placement; higher when forks are placed again after their machine failed.
needs_sync6boolThe machine does not hold the checkpoint yet: it is copied there first.
reason7stringWhy it went there, for people.

ForkBatchSummary#

The end of a batch.

Field#TypeDescription
ok1uint32Forks that are ready.
failed2uint32Forks that failed.
elapsed_ms3uint64Milliseconds the batch took.
per_host4map of string to uint32Ready forks per machine.
peak_parallel5map of string to uint32Most forks that were starting at once on one machine.

ForkBatchItem#

One fork of a batch.

Field#TypeDescription
index1uint32Its index in the batch (groups in order, forks in order).
group2uint32Its group.
source3stringIts checkpoint.
name4stringIts name.
host5stringThe machine it runs on (local for this one).
space6stringThe Space it is, to connect to: local:<name>, direct:<addr> or relay:<machine>. Empty when it failed.
error8stringWhy it failed. Empty when it is ready.
error_code9stringA short machine-readable reason with error: host_failed, no_capacity, sync_failed, fork_failed, no_host.
attempt10uint32Which placement it came from (1: the first).
elapsed_ms11uint64Milliseconds from the start of the batch until it was ready (or failed).
fork_ms12uint64Milliseconds its own fork took, on its machine.

ForkSandboxBatchResponse#

One event of ForkBatchService.ForkSandboxBatch.

Field#TypeDescription
placement1ForkBatchPlacement (oneof event)A group was placed on a machine.
sync2SnapshotSyncProgress (oneof event)A checkpoint is being copied to a machine.
item3ForkBatchItem (oneof event)One fork is ready, or failed.
done4ForkBatchSummary (oneof event)The batch is over (the last event).
sandbox5SandboxWith a ready item on this machine: its sandbox.