Channel Topology Patterns
This document describes common redundancy topologies and how they map to vital_channel configurations. Each pattern supports different failure scenarios and recovery characteristics.
Pattern 1: Single-System 2oo2 (A ↔ B → C)
Your Question: A and B on same unit, communicate with C**
Architecture:
Online (A) Standby (B)
| |
+─────────────────+ Channel 0: Shared Memory
| | (bidirectional heartbeat)
+─────────────────+ Channel 1: FIFO
| | (bidirectional fallback)
v v
[Vital Channel: 2oo2 Voting]
|
v
Non-Vital Service (C)
(Diagnostics, Logging, Telemetry)
Use Case:** Railway ERTMS single board with redundant cores or processes on same CPU. App Manager coordinates between Online (A) and Standby (B), sends diagnostics to Non-Vital Service (C).
Characteristics:**
Pattern 2: Distributed 2oo2 (A ↔ B Across Network)
For remote standby on different host**
Architecture:
Host 1 (Online A) [Network] Host 2 (Standby B)
| |
+──────────TCP:5000──────────+
| (reliable, ordered) |
+──────────UDP:5001──────────+
| (fast, best-effort) |
| |
[Vital Channel: 2oo2] [Vital Channel: 2oo2]
| |
v v
Online: Make decision Standby: Verify data
Send to external Report health
Use Case:** Regional redundancy where Online is in main datacenter, Standby in backup facility or different geographic location.
Characteristics:**
Pattern 3: Hot Standby with Mirroring
For automatic failover without data loss**
Architecture:
Online (A) Standby/Mirror (B)
│ │
├──[Channel 0: SHM]────────┤ Real-time sync
│ │ (command echo)
├──[Channel 1: FIFO]───────┤ Heartbeat
│ │ (backup link)
├──[Channel 2: Voting]─────┤ State verification
│ │ (both publish result)
v v
Input Input
Process ←→ Process
Decision Decision
Output (to external systems, A only unless failover)
↓
[Channel 3] ──→ External Device
Failover on A crash:
B detects 3 consecutive timeouts
→ B takes over sending output
→ No interruption to external system
Use Case:** Zero-downtime redundancy where standby must take over immediately when online fails. Both processes maintain identical state (mirror).
Characteristics:**
- Scope: Can be same system or distributed
- Latency: <1ms (same) or 50-100ms (distributed)
- Failure Tolerance: 0 during operation, but automatic failover (<100ms)
- Recovery Time: <100ms (automatic, no manual intervention)
Suitable for: Critical systems needing zero-downtime failover
Channel Configuration:**
Channel 0: Shared Memory Queue (same system) or TCP (distributed)
├─ A → B: "Execute command X"
├─ B → A: "Ack, executing"
├─ Latency: <1µs (SHM) or 20-50ms (TCP)
├─ Timeout: 50ms (fail fast on crash)
└─ Use: Command propagation & echo verification
Channel 1: FIFO (same system) or UDP (distributed)
├─ A → B: "I'm alive (seq 42)"
├─ B → A: "Ack (seq 42)"
├─ Latency: 5-10ms
├─ Timeout: 200ms (allow for network jitter)
└─ Use: Presence detection
Channel 2: Shared Memory Queue (2oo2 voting)
├─ A publishes: "State = X"
├─ B publishes: "State = X" (verified match)
├─ Voting layer: Compare A vs B
├─ Mismatch: SAFE_STATE (corruption detected)
└─ Timeout: 100ms (state update cycle)
Channel 3: to External Device
├─ A sends normally (while online)
├─ B sends only after failover detected
├─ Arbitration: Only one sender at a time
└─ Use: Safety-critical output to external system
Failover State Machine:**
Normal Operation:
Online (A) Standby (B)
├─ Receive input ├─ Receive input
├─ Compute state ├─ Verify A's state
├─ Send output ├─ Monitor A alive
└─ Verify B echo └─ Ready to takeover
Failover Trigger (B detects A is down):
Condition: 3 consecutive timeouts on Channel 0/1
Action: B state becomes ONLINE
B starts sending output
A→B links become B→A (role swap)
Failover Complete:
Online (B) Standby (A)
├─ Receive input ├─ Monitor B alive
├─ Compute state ├─ Wait for re-sync
├─ Send output └─ Ready to recover
└─ Verify A online?
Recovery (A restarts):
Action: A detects B is now online
A requests full state sync from B
A verifies state matches B
A resumes as standby
Optionally: failback to A (depends on policy)
Advantages:**
- ✓ Automatic failover (<100ms)
- ✓ No manual intervention
- ✓ Both systems always in sync (mirror)
- ✓ No data loss
✓ Voting ensures consistency
Challenges:**
- ✗ 2x processing overhead (both compute)
- ✗ Complex state synchronization
- ✗ Split-brain risk if A/B network partition (both think they're online, both send output) → Solution: Use arbitration (quorum, UUID-based tie-breaking)
Pattern 4: Triple Redundancy (2oo3)
For highest reliability (tolerate 1 fault)**
Architecture:
Online (A) Standby 1 (B) Standby 2 (C)
| | |
+──────TCP────+ |
| | |
+──────TCP────────────────────+
| | |
+──────UDP────+──────UDP──────+
| | |
v v v
[Vital Channel: 2oo3]
Voting: 2 or 3 channels agree → RESULT
0-1 channels available → TIMEOUT
No majority → DISAGREED → SAFE_STATE
Voting Decision Table:**
| Ch0 | Ch1 | Ch2 | Decision | Action |
| A | A | A | AGREED | ✓ Use A |
| A | A | B | AGREED | ✓ Use A (2 agree) |
| A | B | B | AGREED | ✓ Use B (2 agree) |
| A | B | C | DISAGREED | ✗ SAFE_STATE |
| TO | A | A | AGREED | ✓ Use A (ignore timeout) |
| TO | TO | A | INSUFFICIENT | ✗ TIMEOUT |
| TO | TO | TO | TIMEOUT | ✗ SAFE_STATE |
Use Case:** Mission-critical systems (aircraft, medical devices, nuclear plants) where losing 1 component must not cause failure.
Characteristics:**
Summary Comparison
| Topology | Channels | Transport | Latency | Tolerance | Failover | Best For |
| 2oo2 Local | 2 | SHM+FIFO | <1ms | 0 | None | High-speed same-board |
| 2oo2 Dist. | 2 | TCP+UDP | 50-100ms | 0 | None | Regional active-standby |
| Hot Standby | 3 | SHM+FIFO+... | <1ms | 0 ops, <100ms failover | Auto | Zero-downtime HA |
| 2oo3 | 3 | TCP×3 | 50-150ms | 1 | Auto | Mission-critical SIL 4 |
| NMR | N | Mixed | Varies | M-quorum | Auto | Distributed consensus |
How to Choose a Topology
Question 1: What's the failure tolerance requirement?**
- Need to tolerate 0 faults (2oo2) → Must have perfect communication
- Need to tolerate 1 fault (2oo3) → Use triple redundancy
Need to tolerate N faults → Use NMR with appropriate quorum
Question 2: Are the redundant units on the same system?**
- YES (same CPU/board) → Use shared memory (fastest)
NO (different systems) → Use TCP/IP (reliable) or UDP (fast)
Question 3: Do you need automatic failover?**
- YES (hot standby) → Use mirroring pattern + heartbeat
NO (cold standby) → Use simple 2oo2 or 2oo3
Question 4: What's the acceptable latency?**
- <1ms → Shared memory (local only)
- 1-10ms → FIFO or local UDP
- 10-100ms → TCP/IP (LAN)
100-1000ms → TCP/IP (WAN) or async patterns
Decision Tree:**
Tolerance = 1 fault?
NO → 2oo2 topology
Same system?
YES → Shared Memory + FIFO
NO → TCP + UDP
YES → 2oo3 topology
Need failover?
YES → Hot standby + mirror
NO → 2oo3 simple voting