Execution Patterns
IndexBus provides four standard execution patterns. Each maps to a specific region layout and set of primitives.
Router Loop (Fanout)
A single-writer router step that moves events from a producer ring into one or more consumer rings.
Modes
Tuning Knobs
Larger batches increase throughput at the cost of latency. Smaller batches reduce latency but add per-event overhead. Choose a wait strategy to match the deployment: busy spin for best latency with high CPU, backoff for lower CPU, or wake-based for low idle CPU.
Use Cases
- Market-data fanout
- Edge gateway distribution
- CPU isolation with dedicated router cores
Sequencer + Gating
Disruptor-style monotonic sequence with per-consumer gating for strict ordering and stage coordination.
- Producer claims sequence numbers, publishes, and advances the cursor.
- Consumers wait on barriers and advance their gating sequences.
- Wrap prevention: the producer cannot advance more than
capacityahead of the slowest consumer.
Use Cases
- Low-latency staged flows
- Deterministic coordination
- Multi-stage fanout with ordering guarantees
Router-Enforced Credits
Credit accounting layered on top of fanout routing. Each consumer has a credit budget (maximum allowed backlog). The router checks credits before delivery. On exhaustion, the configured policy determines behavior.
Use Cases
- Protect consumers from overwhelm
- Prevent unbounded lag
- Make overload behavior observable and testable
Journal (Append + Tail/Replay)
Append-only segmented log for fast appends, tailing, and replay-style reads.
Record Format
Each record consists of an 8-byte header (payload_len + flags) followed by an 8-byte-aligned payload. Publication uses two-phase commit with FLAG_COMMITTED. Storage is bounded via fixed-size segments, with overrun detection for slow subscribers.
Use Cases
- Capture-and-replay debugging
- Late-joiner subscribers
- Inspectable streams