Component sharing¶
A large framework, such as a machine-learning library with its native and accelerator dependencies, is expensive to build and store once per block. When several blocks select the same component, their cells share its bytes: one immutable, content-addressed copy on the node, mounted read-only into each cell whose closure selected it. Each cell keeps its own running state.
flowchart LR
S["One component<br/>immutable bytes, one digest"]
S -->|"read-only mount"| A["Cell A<br/>own process, own loaded state"]
S -->|"read-only mount"| B["Cell B<br/>own process, own loaded state"]
What is shared¶
The component's files: the distribution, its native libraries and its executables. They are stored once in the node's content store, keyed by digest, and charged to the store's quota once however many closures reference them.
The component reaches a cell only when that cell's closure selected it, which requires the block to declare a compatible requirement. See Presence versus import authority.
What each cell keeps to itself¶
- Its process. Each cell imports the framework in its own provider process.
- Its live objects. Models, sessions and caches the framework creates stay in the cell that created them. See Framework objects.
- Its writable state. Each cell has one private writable filesystem, and every shared mount is read-only.
- Its lifecycle. Each cell starts, fails and ends on its own.
- Accelerator state. GPU contexts, allocations and quotas belong to the owner of the resource, and cells reach them through the kernel's resource authority.
Getting blocks onto one component¶
Blocks share a component when their closures select the same one. Two homes make
that happen for a framework many blocks use: the runtime foundation, and a
component prepared once in the project's runtime.xratu. See
Where shared dependencies live.
Related: Closure artifact sets and materialization covers the content store.