Skip to content

Commit d7212b8

Browse files
committed
Revert "docs: update documentation for v1.1.0 MPSC release"
This reverts commit df6108c.
1 parent df6108c commit d7212b8

2 files changed

Lines changed: 33 additions & 126 deletions

File tree

README.md

Lines changed: 26 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@
22

33
[![CI](https://github.com/codenimja/nimsync/actions/workflows/ci.yml/badge.svg)](https://github.com/codenimja/nimsync/actions/workflows/ci.yml)
44
[![Benchmark](https://github.com/codenimja/nimsync/actions/workflows/benchmark.yml/badge.svg)](https://github.com/codenimja/nimsync/actions/workflows/benchmark.yml)
5-
[![Nimble](https://img.shields.io/badge/nimble-v1.1.0-orange.svg)](https://nimble.directory/pkg/nimsync)
5+
[![Nimble](https://img.shields.io/badge/nimble-v1.0.0-orange.svg)](https://nimble.directory/pkg/nimsync)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
77
[![Nim](https://img.shields.io/badge/nim-2.0.0%2B-yellow.svg?style=flat&logo=nim)](https://nim-lang.org)
88
![Peak](https://img.shields.io/badge/peak-615M_ops/sec-success)
99
![P99](https://img.shields.io/badge/p99_latency-31ns-blue)
1010
![Contention](https://img.shields.io/badge/contention-0%25-brightgreen)
1111

12-
**Lock-free SPSC and MPSC channels for Nim with production-grade performance validation**
12+
**Lock-free SPSC channels for Nim with production-grade performance validation**
1313

14-
nimsync v1.1.0 is production-ready for both SPSC and MPSC channels with comprehensive benchmarking following industry standards (Tokio, Go, LMAX Disruptor, Redis). Performance: 615M ops/sec SPSC peak, 16M ops/sec MPSC (2 producers), 31ns P99 latency, stable under burst loads. This is verified, tested, real code.
14+
nimsync v1.0.0 is production-ready for SPSC channels with comprehensive benchmarking following industry standards (Tokio, Go, LMAX Disruptor, Redis). Performance: 615M ops/sec peak throughput, 31ns P99 latency, stable under burst loads. This is verified, tested, real code.
1515

1616
## Features
1717

18-
- **High throughput**: 615M ops/sec SPSC (raw), 16M ops/sec MPSC (2 producers), 512K ops/sec (async) - [See benchmarks](#performance)
18+
- **High throughput**: 615M ops/sec (raw), 512K ops/sec (async) - [See all 7 benchmarks](#performance)
1919
- **Production-validated**: Comprehensive benchmark suite (throughput, latency, burst, stress, sustained)
2020
- **Industry-standard testing**: Following Tokio, Go, Rust Criterion, LMAX Disruptor methodologies
21-
- **SPSC and MPSC modes**: Single-producer or multi-producer with single consumer
2221
- Lock-free ring buffer with atomic operations
2322
- Zero GC pressure with ORC memory management
2423
- Cache-line aligned (64 bytes) to prevent false sharing
25-
- Wait-free MPSC algorithm (based on dbittman + JCTools patterns)
2624
- Power-of-2 sizing for efficient operations
2725
- Non-blocking `trySend`/`tryReceive`
2826
- Async `send`/`recv` wrappers for Chronos
@@ -47,7 +45,7 @@ nimble install
4745

4846
## Quick Start
4947

50-
### Basic Usage (SPSC)
48+
### Basic Usage
5149
```nim
5250
import nimsync
5351
@@ -63,36 +61,6 @@ if chan.tryReceive(value):
6361
echo "Received: ", value
6462
```
6563

66-
### Multi-Producer Usage (MPSC)
67-
```nim
68-
import nimsync
69-
import std/[os, threadpool]
70-
71-
# Create MPSC channel for multiple producers
72-
let chan = newChannel[int](1024, ChannelMode.MPSC)
73-
74-
# Multiple producer threads
75-
proc producer(ch: Channel[int], id: int) =
76-
for i in 0..<1000:
77-
while not ch.trySend(id * 1000 + i):
78-
discard # Spin until space available
79-
80-
# Start multiple producers
81-
spawn producer(chan, 1)
82-
spawn producer(chan, 2)
83-
spawn producer(chan, 3)
84-
85-
# Single consumer
86-
var count = 0
87-
var value: int
88-
while count < 3000:
89-
if chan.tryReceive(value):
90-
echo "Received: ", value
91-
count.inc
92-
93-
sync()
94-
```
95-
9664
### Async Operations
9765
```nim
9866
import nimsync
@@ -121,10 +89,7 @@ waitFor main()
12189
proc newChannel[T](size: int, mode: ChannelMode): Channel[T]
12290
```
12391
Creates a channel with specified size (rounded to next power of 2).
124-
125-
**Modes**:
126-
- `ChannelMode.SPSC`: Single Producer Single Consumer (fastest)
127-
- `ChannelMode.MPSC`: Multi-Producer Single Consumer (wait-free producers)
92+
Only `ChannelMode.SPSC` is implemented.
12893

12994
### Non-Blocking Operations
13095
```nim
@@ -150,9 +115,7 @@ proc isFull[T](channel: Channel[T]): bool
150115

151116
### Comprehensive Benchmark Suite
152117

153-
nimsync includes benchmarks for both SPSC and MPSC modes following industry best practices:
154-
155-
#### SPSC Benchmarks (Single Producer Single Consumer)
118+
nimsync includes 7 official benchmarks following industry best practices:
156119

157120
| Benchmark | Metric | Result | Industry Reference |
158121
|-----------|--------|--------|--------------------|
@@ -164,36 +127,18 @@ nimsync includes benchmarks for both SPSC and MPSC modes following industry best
164127
| **Sustained** | Long-duration | Stable over 10s | Cassandra/ScyllaDB |
165128
| **Async** | Overhead | 512K ops/sec | Standard async benchmarking |
166129

167-
#### MPSC Benchmarks (Multi-Producer Single Consumer)
168-
169-
| Producers | Throughput | Latency (avg) | Notes |
170-
|-----------|-----------|---------------|-------|
171-
| 1P | 33M ops/sec | 30ns | Comparable to SPSC |
172-
| 2P | 16M ops/sec | 62ns | Optimal sweet spot |
173-
| 4P | 9M ops/sec | 111ns | Good scalability |
174-
| 8P | 4M ops/sec | 250ns | Contention limited |
175-
176-
**Key Findings**:
177-
- Wait-free MPSC algorithm: No CAS retry loops
178-
- Best performance: 2 producers (16M ops/sec)
179-
- Stress test: 1M items across 8 producers (5.65M ops/sec)
180-
- Latency stable: 96-117ns across 1-4 producers
181-
182130
### Quick Run
183131
```bash
184-
# Run SPSC benchmark suite (~18 seconds)
132+
# Run complete benchmark suite (~18 seconds)
185133
./tests/performance/run_all_benchmarks.sh
186134

187-
# Run MPSC benchmarks
188-
nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_mpsc.nim
189-
./tests/performance/benchmark_mpsc
190-
191-
# Run individual SPSC benchmarks
135+
# Run individual benchmarks
192136
nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_latency.nim
193137
./tests/performance/benchmark_latency
194138
```
195139

196140
**Full Documentation**: See [`tests/performance/README.md`](tests/performance/README.md) for detailed explanations of each benchmark.
141+
```
197142
198143
### Third-Party Verification
199144
@@ -205,10 +150,9 @@ Want to verify these claims yourself?
205150
206151
## Limitations
207152
208-
1. **Single Consumer Only** - All modes require single consumer
209-
- SPSC: ONE sender, ONE receiver (fastest)
210-
- MPSC: MULTIPLE senders, ONE receiver (wait-free)
211-
- SPMC/MPMC not implemented
153+
1. **SPSC Only** - Single Producer Single Consumer only
154+
- Each channel: ONE sender, ONE receiver
155+
- MPSC/SPMC/MPMC will raise `ValueError`
212156
213157
2. **No close()** - Channels don't have close operation
214158
- Use sentinel values for shutdown signaling
@@ -220,16 +164,12 @@ Want to verify these claims yourself?
220164
- Starts at 1ms, backs off to 100ms max
221165
- Use `trySend`/`tryReceive` for zero-latency
222166
223-
5. **MPSC contention** - Best performance with 2-4 producers
224-
- 8+ producers experience diminishing returns due to contention
225-
226167
## Development
227168
228169
### Testing
229170
```bash
230-
nim c -r tests/unit/test_channel.nim # Basic SPSC tests
231-
nim c -r tests/unit/channels/test_mpsc_channel.nim # MPSC tests
232-
nim c -r tests/unit/test_basic.nim # Version check
171+
nim c -r tests/unit/test_channel.nim # Basic tests
172+
nim c -r tests/unit/test_basic.nim # Version check
233173
```
234174

235175
### Benchmarking
@@ -258,8 +198,8 @@ This repository contains experimental implementations of:
258198
## Roadmap
259199

260200
-**v1.0.0**: Production SPSC channels (DONE!)
261-
- **v1.1.0**: MPSC channels (DONE!)
262-
- **v1.2.0**: TaskGroup fixes + Production-ready Streams
201+
- **v1.1.0**: MPSC channels + TaskGroup fixes
202+
- **v1.2.0**: Production-ready Streams
263203
- **v2.0.0**: Full async runtime with actors
264204

265205
## Known Issues
@@ -268,17 +208,18 @@ See [GitHub Issues](.github/) for experimental features and known limitations:
268208

269209
- **Async wrappers use polling** - exponential backoff (1ms-100ms), use `trySend`/`tryReceive` for zero-latency
270210
- **TaskGroup has bugs** - nested async macros fail (not exported) - [See issue template](.github/ISSUE_TASKGROUP_BUG.md)
211+
- **MPSC not implemented** - multi-producer channels needed for actors - [See issue template](.github/ISSUE_MPSC_CHANNELS.md)
271212
- **NUMA untested** - cross-socket performance unknown - [See issue template](.github/ISSUE_NUMA_VALIDATION.md)
272213

273214
**These are documented limitations, not intentional behavior.** Contributions to fix welcome!
274215

275216
## Contributing
276217

277218
Contributions welcome! Priority areas:
278-
1. Fix TaskGroup nested async bug - [Details](.github/ISSUE_TASKGROUP_BUG.md)
279-
2. Validate NUMA performance - [Details](.github/ISSUE_NUMA_VALIDATION.md)
280-
3. Cross-platform support (macOS/Windows)
281-
4. SPMC/MPMC channel implementations
219+
1. Fix TaskGroup nested async bug (blocking v0.3.0) - [Details](.github/ISSUE_TASKGROUP_BUG.md)
220+
2. Implement MPSC channels (enables actors) - [Details](.github/ISSUE_MPSC_CHANNELS.md)
221+
3. Validate NUMA performance - [Details](.github/ISSUE_NUMA_VALIDATION.md)
222+
4. Cross-platform support (macOS/Windows)
282223

283224
See [issue templates](.github/) for detailed specifications and acceptance criteria.
284225

@@ -288,17 +229,16 @@ MIT License - see LICENSE for details.
288229

289230
---
290231

291-
**Status**: Production-ready SPSC and MPSC channels with comprehensive validation. Other features (TaskGroup, actors, streams) are experimental - see [GitHub Issues](.github/) for contributor opportunities.
232+
**Status**: Production-ready SPSC channels with comprehensive validation. Other features (TaskGroup, MPSC, actors) are experimental - see [GitHub Issues](.github/) for contributor opportunities.
292233

293234
---
294235

295236
## Disclaimer
296237

297-
**nimsync v1.1.0 is production-ready for SPSC and MPSC channels.**
238+
**nimsync v1.0.0 is production-ready for SPSC channels.**
298239

299-
**SPSC channels verified** - 615M ops/sec peak, 31ns P99 latency, 7-benchmark suite validation
300-
**MPSC channels verified** - 16M ops/sec (2 producers), wait-free algorithm, comprehensive stress testing
301-
⚠️ **Experimental features** - TaskGroup, actors, streams not yet production-ready ([help wanted](.github/))
240+
**SPSC channels verified** - 615M ops/sec peak, 31ns P99 latency, 7-benchmark suite validation
241+
⚠️ **Experimental features** - TaskGroup, MPSC, actors not yet production-ready ([help wanted](.github/))
302242

303243
We document performance honestly. We benchmark rigorously. We're transparent about limitations.
304244

tests/performance/README.md

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,16 @@ Official benchmark suite following industry best practices from Tokio, Go, and R
55
## Quick Start
66

77
```bash
8-
# Run all SPSC benchmarks
8+
# Run all benchmarks
99
./tests/performance/run_all_benchmarks.sh
1010

11-
# Run MPSC benchmarks
12-
nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_mpsc.nim
13-
./tests/performance/benchmark_mpsc
14-
15-
# Or run SPSC benchmarks individually
11+
# Or run individually
1612
nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_latency.nim
1713
./tests/performance/benchmark_latency
1814
```
1915

2016
## Benchmark Suite
2117

22-
## SPSC Benchmarks (Single Producer Single Consumer)
23-
2418
### 1. benchmark_spsc_simple.nim - Throughput (Baseline)
2519
**What it measures**: Raw SPSC channel throughput
2620
**Industry reference**: Standard practice for lock-free queue benchmarking
@@ -120,32 +114,6 @@ nim c -r tests/performance/benchmark_concurrent.nim
120114

121115
**Key insight**: Channel itself is 600M+ ops/sec, async wrapper adds polling overhead
122116

123-
## MPSC Benchmarks (Multi-Producer Single Consumer)
124-
125-
### 8. benchmark_mpsc.nim - Multi-Producer Performance
126-
**What it measures**: MPSC channel throughput, latency, and scalability
127-
**Industry reference**: JCTools MPSC queue benchmarking, Disruptor patterns
128-
**Results**: 16M ops/sec (2 producers), 9M ops/sec (4 producers), wait-free algorithm
129-
**Use case**: Concurrent producer scenarios (worker threads, event aggregation)
130-
131-
```bash
132-
nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_mpsc.nim
133-
./tests/performance/benchmark_mpsc
134-
```
135-
136-
**Benchmark suite includes**:
137-
- **Throughput comparison**: SPSC vs MPSC with 1/2/4/8 producers
138-
- **Latency measurement**: Average latency across different producer counts
139-
- **Scalability analysis**: Fixed items per producer, measuring scalability
140-
- **Size impact**: Performance across buffer sizes (64/256/1024/4096)
141-
- **Burst workload**: Handling bursty traffic patterns
142-
143-
**Key findings**:
144-
- **2 producers**: Optimal sweet spot (16M ops/sec)
145-
- **Wait-free algorithm**: No CAS retry loops, predictable latency
146-
- **Stress tested**: 1M items across 8 producers (5.65M ops/sec)
147-
- **Latency stability**: 96-117ns across 1-4 producers
148-
149117
## Design Principles
150118

151119
**Non-redundant**: Each benchmark measures a different aspect
@@ -158,12 +126,11 @@ nim c -d:danger --opt:speed --mm:orc tests/performance/benchmark_mpsc.nim
158126

159127
| Category | Benchmarks | Purpose |
160128
|----------|-----------|---------|
161-
| **Throughput** | simple, concurrent, mpsc | Raw performance numbers |
162-
| **Latency** | latency, mpsc | Tail latency analysis |
163-
| **Stability** | burst, sustained, mpsc | Real-world behavior |
164-
| **Tuning** | sizes, mpsc | Optimization guidance |
165-
| **Limits** | stress, mpsc | Breaking point analysis |
166-
| **Scalability** | mpsc | Multi-producer scaling |
129+
| **Throughput** | simple, concurrent | Raw performance numbers |
130+
| **Latency** | latency | Tail latency analysis |
131+
| **Stability** | burst, sustained | Real-world behavior |
132+
| **Tuning** | sizes | Optimization guidance |
133+
| **Limits** | stress | Breaking point analysis |
167134

168135
## CI Integration
169136

0 commit comments

Comments
 (0)