PERF-01: the local lane carries every endpoint method but Worker.*; contract amendments
- worker: local_lane_carries is every method but Worker.*, so an endpoint's read-only extension (SERVE-01's Legacy.FeedStatus) no longer crosses the bus. - ipc-v1 section 1, bus-v1 section 12, step-v1 and the framework README: the in-process local lane and in-memory artifacts, dated 2026-09-30.
This commit is contained in:
parent
fa8c9305a7
commit
9a2d7c0286
5 changed files with 58 additions and 4 deletions
|
|
@ -78,7 +78,10 @@ Application / supervisor Application presentation
|
|||
This diagram is connectivity, not execution order. The step contract defines causal order.
|
||||
One router can host several independent sessions and application consumers; a deployment may
|
||||
choose one router per application for fault isolation. A router crash affects all its clients,
|
||||
so choose that boundary deliberately. In-process mode still exercises routing and ownership.
|
||||
so choose that boundary deliberately. In-process mode still exercises routing and ownership,
|
||||
unless its participants are offered over the local lane ([session RPCs](ipc-v1.md) section 1,
|
||||
amendment 2026-09-30), as the legacy composition's in-process release configuration is; process
|
||||
mode always goes through the router.
|
||||
|
||||
Defaults: coordinator per session, worker per fly, environment worker per world. Task and
|
||||
per-agent executors begin as coordinator-local libraries. An environment helper may own a
|
||||
|
|
|
|||
|
|
@ -523,3 +523,14 @@ this same section forbids to reject one.
|
|||
longer passes a `budget` into `bus.call` and shows the deadline at the caller instead, because
|
||||
section 5's wire contract for `rpc.call` has no budget field and section 2 is self-labelled
|
||||
illustrative.
|
||||
|
||||
**2026-09-30, PERF-01 (SDK only; no wire change, `contractDigest` unchanged).** The Rust client
|
||||
gains *in-memory artifacts*: `Artifact::in_memory(contentType, bytes)` is an immutable buffer in
|
||||
the caller's address space with an ordinary `ArtifactRef` whose `storeId` is `in-memory` (no
|
||||
router issues that id) and whose digest is null; `Artifact::to_memory` reads a sealed handle into
|
||||
one under the same reference. They read, clone and retain without a router, and no router ever
|
||||
learns of them: the SDK refuses one as an attachment of `rpc.call`, `rpc.reply` or `publish`
|
||||
before anything is sent (`INVALID_ENVELOPE`, not dispatched). They exist for participants of one
|
||||
process that hand each other buffers directly ([session RPCs](ipc-v1.md) section 1, amendment of
|
||||
the same date); section 8's ownership rules apply to every artifact a router stores, which these
|
||||
never are.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,37 @@ ownership. This document owns Scope, model-related scalar types, worker capabili
|
|||
domain operation deduplication and errors. Domain request identity is independent of the bus
|
||||
callId: a safe retry has a new transport callId but the original domain requestId/body.
|
||||
|
||||
**Amendment, 2026-09-30 (PERF-01; operator-approved slice).** One exception to "every session/worker
|
||||
RPC is a Flybus call", for participants that share the coordinator's process. The release
|
||||
container runs the legacy composition in-process, and there the bus path cost about 4.7 ms a
|
||||
frame above the brain (three round trips through the router and four or five sealed store files
|
||||
a frame), against 0.7 ms for everything the legacy loop does outside its ticks.
|
||||
|
||||
- **The local lane.** A launcher MAY offer an in-process worker's shell to the coordinator
|
||||
directly (`fly-session` `worker::LocalLane`, `launcher::Via::Local`). Endpoint methods --
|
||||
step mutations, lifecycle/capture and an endpoint's own read-only extensions -- then go to
|
||||
that shell without a bus message. `Worker.*` stays on the bus, where the supervisor asks.
|
||||
- **Same domain semantics.** The request is the same `SessionRpcRequest`, and it goes through
|
||||
the same shell code as a bus request: section 5's classification, canonical body digest,
|
||||
result cache and conflict/IN_PROGRESS/RESULT_EXPIRED rules, the arrival-order lock, and the
|
||||
endpoint. The reply is the same `SessionRpcOutcome`, checked by the coordinator for worker,
|
||||
incarnation, scope and request id exactly as a bus reply is. Section 6's deadline and
|
||||
resolution procedure are unchanged: a lane send is the "bus call", and a worker that stopped
|
||||
before answering is a lost connection (mutation unknown).
|
||||
- **Artifacts.** Over the lane, a handler's reply media are *in-memory artifacts* (bus-v1
|
||||
section 12, 2026-09-30): immutable buffers in the process with a normal `ArtifactRef`
|
||||
(`storeId` `in-memory`, no digest), no store file and no router owner. The rule of section 3
|
||||
holds as written: every `ArtifactRef` in a payload is backed by a live handle the message
|
||||
carries. An in-memory artifact never crosses a router: a bus call or a publication that needs
|
||||
one carries a sealed copy (the coordinator makes it), and the snapshot names the copy.
|
||||
A sealed handle a handler returns over the lane reaches the caller in memory under the same
|
||||
reference.
|
||||
- **Scope.** Only `ExecutionMode::InProcess`. A thread or process participant is always reached
|
||||
over the bus, so process mode keeps exercising routing and ownership, and the bus path stays
|
||||
the reference: `FLY_SESSION_LOCAL_LANE=0` runs an in-process session over it. Every synthetic
|
||||
transport test also runs over the lane (`tests/common` `local_lane` module), and the legacy
|
||||
parity runs in-process (lane) and process (bus).
|
||||
|
||||
## 2. Common domain types
|
||||
|
||||
```ts
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@ ordering. Its frame order is this document's transaction order (legacy-gameboy-v
|
|||
maps it step by step), so the amendments below add capabilities to the protocol and change
|
||||
none of its ordering rules.
|
||||
|
||||
**Amendment, 2026-09-30 (PERF-01).** In-process participants MAY be called over the local lane of
|
||||
[session RPC](ipc-v1.md) section 1 (amendment of the same date) instead of through the router:
|
||||
the arrows below are then direct calls into the same worker shell, carrying the same requests and
|
||||
replies. No ordering rule changes. Measured on the release container's CPU and cpuset, work that
|
||||
overlaps the brain's ticks slows them (the sweep owns every core of the cpuset), so the
|
||||
coordinator overlaps nothing with Prepare: a boundary's publication copies are made while the
|
||||
world, the task and the commits run, and the snapshot is published before the next Prepare.
|
||||
|
||||
## 1. Committed boundary
|
||||
|
||||
At `Ready(epoch, k)`:
|
||||
|
|
|
|||
|
|
@ -378,10 +378,11 @@ impl LocalLane {
|
|||
}
|
||||
}
|
||||
|
||||
/// True for a method the local lane carries: every method the shell admits through its
|
||||
/// result cache into the endpoint. `Worker.*` stays on the bus.
|
||||
/// True for a method the local lane carries: every method the shell admits into the endpoint
|
||||
/// (step mutations, lifecycle and capture, and an endpoint's own read-only extensions such as
|
||||
/// SERVE-01's `Legacy.FeedStatus`). The common `Worker.*` methods stay on the bus.
|
||||
pub fn local_lane_carries(method: &str) -> bool {
|
||||
matches!(classify_default(method), Some(OpClass::StepMutation | OpClass::Lifecycle))
|
||||
!method.starts_with("Worker.")
|
||||
}
|
||||
|
||||
/// How the shell answers one request: over the bus, or into a local waiter.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue