Benchmarks & Performance ⚡

Real-world throughput, latency numbers, and reproducible test suites demonstrating how Workmatic outperforms traditional queues on single-node workloads.

📊 Summary of Benchmark Results #

Tests run on Apple Silicon (M-series) / Ubuntu 22.04 with NVMe SSD and Node.js v22 using SQLite WAL mode and Workmatic's single-pass atomic claim engine:

WorkloadOperationsThroughputAvg LatencyNotes
Sequential Insert (add)10,000 jobs37,600+ ops/sec0.026 msDirect single-pass prepared statement insert
Batch Insert (addMany)50,000 jobs150,000+ ops/sec0.006 msSingle transaction multi-row insert
Concurrent Processing (c=1)5,000 jobs12,400+ ops/sec0.080 ms1 worker fastq stream
Concurrent Processing (c=4)5,000 jobs24,800+ ops/sec0.040 ms4 parallel fastq threads
Concurrent Processing (c=16)5,000 jobs32,600+ ops/sec0.030 msHigh concurrency micro-batching enabled
Mixed Workload (Insert + Process)1,000 jobs18,500+ ops/sec0.054 msWriters and readers running simultaneously in WAL mode
Live Stats Query (stats())1,000 queries4,900+ ops/sec0.204 msCovering composite index lookups
Event-Driven Wakeup LatencySingle job~0.03 ms0.030 msClient-to-worker in-process event notification

🏎️ How Workmatic Achieves This Speed #

1. Zero Network Latency #

Redis and Postgres job queues incur at least 0.5 ms to 2.0 ms per round-trip network hop for every claim, complete, and lock extension. Workmatic runs in the same process memory space as your application—function calls and SQLite C-bindings execute in microseconds.

2. SQLite WAL Mode (Concurrent Read/Write) #

With PRAGMA journal_mode = WAL, writers write sequentially to the -wal log file while concurrent workers read committed snapshots without blocking or being blocked.

3. Single-Pass Atomic Claims #

Instead of executing a SELECT ... FOR UPDATE followed by an UPDATE ..., Workmatic's atomic:

SQL
UPDATE workmatic_jobs SET status = 'running', ...
WHERE rowid IN (SELECT rowid FROM workmatic_jobs WHERE ... LIMIT ?)
RETURNING *;

claims up to $N$ jobs in a single SQLite transaction and returns their full records immediately.

4. Statement Caching #

Workmatic eliminates the SQLite bytecode compilation step by reusing compiled statement pointers via an O(1) LRU statement cache.

5. Completion Micro-Batching #

When running under high concurrency, marking jobs as done is automatically micro-batched into chunked multi-row updates, eliminating write transaction contention.


🧪 Running the Benchmarks Locally #

Workmatic includes a built-in benchmarking suite that you can execute at any time:

Full Benchmark Suite #

Runs sequential insert, parallel insert, processing at concurrency 1, 2, 4, 8, 16, and mixed workloads:

BASH
npm run bench

To test against a persistent file on disk instead of in-memory SQLite:

BASH
npm run bench -- --file

Micro Benchmark Suite #

Runs a rapid 2,000-job sequential insert and stats query check for quick CI validation:

BASH
npm run bench:micro