🚀 Inside Orbit
Architecture, internals, and performance that speaks for itself
🏗️ Core Architecture
Orbit Ledger uses the LMAX Disruptor pattern with a Ring Buffer for lock-free, high-throughput event processing. Here's the complete flow:
flowchart TD
subgraph Input ["Step 1: Ingestion"]
P1[User Thread]
P2[API Thread]
InputEvent>"Event: Credit ACC-001 $100"]
end
subgraph Memory ["Step 2: Orbit Core"]
RB((ORBIT RING BUFFER))
NoteRB["Ordered Sequence of Events
1. ACC-001 (+100)
2. ACC-002 (-50)
3. ACC-001 (+20)"]
end
subgraph Workers ["Step 3: Parallel Workers (All Read Everything)"]
direction TB
subgraph W0 ["Worker 0 (CPU Core 1)"]
Check0{"Hash % 2 == 0?"}
Match0[ Process ACC-002]
Ignore0[ Ignore ACC-001]
end
subgraph W1 ["Worker 1 (CPU Core 2)"]
Check1{"Hash % 2 == 1?"}
Match1[ Process ACC-001]
Ignore1[ Ignore ACC-002]
end
end
subgraph Batch ["Step 4: Batched Commit"]
B0[Batch: ACC-002 Updates]
B1[Batch: ACC-001 Updates]
end
P1 & P2 -->|Publish| RB
RB -->|Sequence 1| W0 & W1
RB -->|Sequence 2| W0 & W1
RB -->|Sequence 3| W0 & W1
W0 --> Check0
Check0 -->|Yes| Match0
Check0 -->|No| Ignore0
W1 --> Check1
Check1 -->|Yes| Match1
Check1 -->|No| Ignore1
Match0 --> B0
Match1 --> B1
style RB fill:#1a4d1a,stroke:#00d2ff,stroke-width:4px,color:#fff
style Match0 fill:#1a3d4d,stroke:#00d2ff,color:#fff
style Match1 fill:#1a3d4d,stroke:#00d2ff,color:#fff
style Ignore0 fill:#4d1a1a,stroke:#ff6b6b,stroke-dasharray: 5 5,color:#fff
style Ignore1 fill:#4d1a1a,stroke:#ff6b6b,stroke-dasharray: 5 5,color:#fff
style B0 fill:#1a4d1a,stroke:#00d2ff,color:#fff
style B1 fill:#1a4d1a,stroke:#00d2ff,color:#fff
Processing Steps
Step 1: Ingestion
Multiple threads (API handlers, user requests) can publish events concurrently to the Ring Buffer. This is non-blocking and takes nanoseconds.
Step 2: Orbit Core (Ring Buffer)
Events are stored in a pre-allocated circular buffer. Each event gets a monotonically increasing sequence number, guaranteeing order.
Step 3: Parallel Workers
Workers process events in parallel using key sharding:
- Each worker reads all events from the Ring Buffer
- Workers only process events where
hash(key) % threadCount == workerId - This ensures each key is processed by exactly one worker (deterministic ordering)
- Different keys can be processed in parallel (high throughput)
Step 4: Batched Commit
When the release threshold is reached, all accumulated events for a key are committed as a single batch:
- 1 UPDATE for the final balance
- 1 batch INSERT for all history records
Key Concepts
| Concept | Description |
|---|---|
| Ring Buffer | Pre-allocated circular array that eliminates garbage collection |
| Sequence Number | Monotonic counter ensuring strict event ordering per key |
| Key Sharding | hash(key) % threadCount routes each key to a dedicated worker |
| Batched Commits | Multiple events are flushed together, reducing DB calls by 1000x+ |
| Wait Strategies | Adaptive: Blocking for efficiency (Standard), Yielding for speed (Maximum) |
⚡ Performance Modes
Orbit Ledger adapts to your hardware profile with two optimized performance modes:
⚖️ STANDARD
- Strategy: Thread Parking (Blocking)
- CPU Usage: Low (yields when idle)
- Throughput: ~2,800,000 ops/sec
- Best For: General production workloads, shared cloud environments.
🚀 MAXIMUM
- Strategy: Thread Yielding
- CPU Usage: Moderate
- Throughput: ~4,500,000 ops/sec
- Best For: High-volume batch processing, dedicated instances.
💡 Tuning Tip #1 (Buffer): Increasing
the Ring Buffer size from 262,144 to 524,288 resulted in a
+4-6% throughput gain in our benchmarks.
💡 Tuning Tip #2 (GC): While Orbit is virtually garbage-free, using low-latency
collectors like ZGC (-XX:+UseZGC) or Shenandoah
can further stabilize tail latency for the < 0.1% of operations that might trigger JVM
housekeeping.
📊 Orbit Internal Performance
The chart below isolates Orbit Ledger's throughput (ops/sec), demonstrating the engine's raw speed across various configurations. To ensure production-grade reliability, tests were conducted across multiple phases—including rigorous endurance runs of over 3,000,000 orders—validating both long-term stability and JVM efficiency. Key performance indicators from these tests are summarized below:
View Detailed Performance Data
1. Order Volume: 1,000,000 Orders (Warm-up Phase)
JVM optimization in progress.
| Perf. Mode | Release Type | Buffer Size | Throughput | Heap (Peak) | Mem Delta | Correctness |
|---|---|---|---|---|---|---|
| STANDARD | COUNT | 524k | 2.08M ops/sec | 327 MB | +230 MB | ✅ PASS |
| STANDARD | TIME | 524k | 2.50M ops/sec | 365 MB | +268 MB | ✅ PASS |
| STANDARD | HYBRID | 524k | 2.15M ops/sec | 392 MB | +295 MB | ✅ PASS |
| MAXIMUM | COUNT | 524k | 2.67M ops/sec | 397 MB | +300 MB | ✅ PASS |
| MAXIMUM | TIME | 524k | 2.62M ops/sec | 453 MB | +356 MB | ✅ PASS |
| MAXIMUM | HYBRID | 524k | 3.33M ops/sec | 448 MB | +351 MB | ✅ PASS |
2. Order Volume: 2,000,000 Orders (Steady State)
Peak Performance.
| Perf. Mode | Release Type | Buffer Size | Throughput | Heap (Peak) | Mem Delta | Correctness |
|---|---|---|---|---|---|---|
| STANDARD | COUNT | 524k | 3.17M ops/sec | 429 MB | +244 MB | ✅ PASS |
| STANDARD | TIME | 524k | 2.82M ops/sec | 411 MB | +225 MB | ✅ PASS |
| STANDARD | HYBRID | 524k | 3.01M ops/sec | 401 MB | +216 MB | ✅ PASS |
| MAXIMUM | COUNT | 524k | 4.31M ops/sec | 406 MB | +220 MB | ✅ PASS |
| MAXIMUM | TIME | 524k | 3.67M ops/sec | 485 MB | +300 MB | ✅ PASS |
| MAXIMUM | HYBRID | 524k | 3.79M ops/sec | 602 MB | +416 MB | ✅ PASS |
3. Order Volume: 3,000,000 Orders (Endurance)
Sustained throughput.
| Perf. Mode | Release Type | Buffer Size | Throughput | Heap (Peak) | Mem Delta | Correctness |
|---|---|---|---|---|---|---|
| STANDARD | COUNT | 524k | 4.40M ops/sec | 741 MB | +468 MB | ✅ PASS |
| STANDARD | TIME | 524k | 2.82M ops/sec | 542 MB | +268 MB | ✅ PASS |
| STANDARD | HYBRID | 524k | 3.54M ops/sec | 751 MB | +478 MB | ✅ PASS |
| MAXIMUM | COUNT | 524k | 4.51M ops/sec | 667 MB | +393 MB | ✅ PASS |
| MAXIMUM | TIME | 524k | 3.40M ops/sec | 631 MB | +357 MB | ✅ PASS |
| MAXIMUM | HYBRID | 524k | 3.90M ops/sec | 494 MB | +221 MB | ✅ PASS |
🆚 Comparison: Orbit vs Traditional DB
This table highlights the fundamental architectural differences that allow Orbit Ledger to achieve 500x-600x greater throughput than traditional RDBMS approaches.
| Metric | Traditional DB (Postgres/MySQL) | Orbit Ledger (Standard) | Orbit Ledger (Maximum) |
|---|---|---|---|
| Max Throughput | ~2,000 - 5,000 ops/sec | ~2,800,000 ops/sec | ~4,500,000 ops/sec |
| Scale Factor | 1x | ~1000x | ~2000x |
| Latency (p99) | 10-50ms | <1μs | <1μs |
Flow Comparison
❌ Traditional Database
sequenceDiagram
participant T1 as Thread 1
participant T2 as Thread 2
participant DB as Database
Note over T1, T2: Both update Account A
T1->>DB: BEGIN TX & LOCK
activate DB
Note right of DB: ❌ Locked
T2->>DB: BEGIN TX & LOCK
Note right of T2: ❌ BLOCKED
T1->>DB: UPDATE Balance
T1->>DB: COMMIT
deactivate DB
Note right of DB: ✅ Released
T2->>DB: Acquired Lock
activate DB
T2->>DB: UPDATE Balance
T2->>DB: COMMIT
deactivate DB
✅ Orbit Ledger
sequenceDiagram
participant T1 as Thread 1
participant T2 as Thread 2
participant RB as Orbit Engine
participant DB as Database
Note over T1, T2: Write to RAM
T1->>RB: Credit $100
T1-->>T1: ✅ Done (0 wait)
T2->>RB: Debit $50
T2-->>T2: ✅ Done (0 wait)
Note over RB: Processing...
RB->>RB: Memory +100
RB->>RB: Memory -50
Note over RB, DB: Batch Persist
RB->>DB: ONE SAVE (+$50)
DB Load Reduction (per 10,000 transactions)
| Operation | Traditional | Orbit (threshold=1000) | Reduction |
|---|---|---|---|
| SELECT FOR UPDATE | 10,000 | 0 | 100% |
| UPDATE balance | 10,000 | 10 (10 batches) | 99.9% |
| INSERT history | 10,000 | 10 (batch inserts) | 99.9% |
| Total DB Calls | 30,000 | 20 | 1500x fewer |
💰 Cost Savings Example
E-commerce with 1M daily transactions
❌ Traditional Approach
- 3M DB calls/day
- 1M row locks/day
- Requires: 8-core DB, connection pool 100+
- DB CPU: 80%+ (under load)
✅ With Orbit Ledger
- 2K DB calls/day (1500x fewer)
- 0 row locks
- Requires: 2-core DB, connection pool 10
- DB CPU: <10%
🔧 Under the Hood
Zero Garbage Collection
Events are pre-allocated in the Ring Buffer. We reuse the same objects millions of times. No
new Object(), no GC pauses.
Smart Threading
Orbit adapts its wait strategy based on load. It uses Thread Yielding or Parking to minimize latency without needlessly burning 100% CPU when idle.