SPSC Bridge

The SPSC (Single-Producer, Single-Consumer) bridge is the only communication path between the Control Plane and Data Plane. No Arc<Mutex<T>>, no shared state — only bounded, lock-free ring buffers.

Request Envelope

Control Plane → Data Plane:

FieldTypePurpose
request_idu64Correlates request with response
tenant_idu32Tenant scoping
vshard_idu16Routes to the correct core
planPhysicalPlanThe physical execution plan
deadline_nsu64Absolute deadline (monotonic clock)
priorityu8Scheduling priority
trace_idu64Distributed trace propagation
consistencyReadConsistencyRead consistency level
idempotency_keyOption\<u64\>Dedup key for non-idempotent writes
event_sourceEventSourceUser, Trigger, Raft, or CrdtSync
user_rolesVec\<String\>Caller's RBAC roles

Response Envelope

Data Plane → Control Plane:

FieldTypePurpose
request_idu64Matches the originating request
statusu8Success, error, partial
attemptu32Retry attempt counter
partialboolWhether more results follow
payloadPayloadResponse data
watermark_lsnu64Latest committed LSN
error_codeu16Typed error (if status != ok)

Memory Ownership

  • Cross-plane payloads use Arc<[u8]> or slab IDs with explicit reclaim ACK
  • Producer owns buffer until ACK/NACK received
  • Zero-copy buffers remain valid until consumer ACK

Ordering

  • Strict FIFO per (connection_id, vshard_id) stream
  • Best-effort ordering across streams
  • Cancellation is cooperative: Control Plane emits CANCEL(request_id), Data Plane stops at the next safe point

Backpressure

Queue utilizationAction
< 85%Normal operation
85% - 95%Reduce read depth
> 95%Suspend new reads

All transitions are observable via metrics and trace spans.

View page sourceLast updated on Apr 18, 2026 by Farhan Syah