Skip to content

Benchmarks

bunqueue supports two deployment modes: Embedded (direct SQLite) and TCP (network + SQLite). This page shows real benchmark results comparing both modes at scale.

Summary

Embedded Mode

Up to 286K ops/sec

Direct SQLite access, zero network overhead

TCP Mode

Up to 149K ops/sec

Network client/server for distributed systems

Embedded Advantage

2-4x Faster

Depending on operation type

Scale Tested

50,000 Jobs

Verified at multiple scales


Embedded Mode Results

Embedded mode uses direct SQLite access with no network overhead. Ideal for single-process applications.

Embedded mode throughput chart
ScalePushBulk PushProcess
1,00086,248 ops/sec221,365 ops/sec47,538 ops/sec
5,000187,256 ops/sec278,587 ops/sec64,716 ops/sec
10,000177,098 ops/sec279,640 ops/sec77,713 ops/sec
50,000204,913 ops/sec286,616 ops/sec74,772 ops/sec

TCP Mode Results

TCP mode connects clients to a bunqueue server over the network. Required for distributed systems with multiple client processes.

TCP mode throughput chart
ScalePushBulk PushProcess
1,00028,633 ops/sec96,635 ops/sec20,195 ops/sec
5,00049,284 ops/sec142,152 ops/sec34,098 ops/sec
10,00054,562 ops/sec149,218 ops/sec34,679 ops/sec
50,00051,827 ops/sec131,897 ops/sec32,544 ops/sec

Embedded vs TCP Comparison

How much faster is Embedded mode compared to TCP mode?

Embedded vs TCP comparison chart
ScalePushBulk PushProcess
1,0003.0x faster2.3x faster2.4x faster
5,0003.8x faster2.0x faster1.9x faster
10,0003.2x faster1.9x faster2.2x faster
50,0004.0x faster2.2x faster2.3x faster

Peak Performance Summary

Peak throughput comparison chart
OperationEmbedded ModeTCP Mode
Push (peak)204,913 ops/sec54,562 ops/sec
Bulk Push (peak)286,616 ops/sec149,218 ops/sec
Process (peak)77,713 ops/sec34,679 ops/sec

Benchmark Methodology

The benchmark tests three operations at four different scales (1K, 5K, 10K, 50K jobs):

1. Push Test

Sequential push of individual jobs to measure single-job insertion speed.

for (let i = 0; i < scale; i++) {
await queue.add('job', PAYLOAD);
}

2. Bulk Push Test

Push jobs in batches of 100 to measure bulk insertion efficiency.

const jobs = Array.from({ length: 100 }, (_, i) => ({
name: 'bulk-job',
data: { ...PAYLOAD, i },
}));
for (let i = 0; i < scale / 100; i++) {
await queue.addBulk(jobs);
}

3. Process Test

Push jobs in parallel batches of 500, then process them with 10 concurrent workers.

// Push in parallel batches
for (let i = 0; i < scale; i += 500) {
const promises = [];
for (let j = 0; j < Math.min(500, scale - i); j++) {
promises.push(queue.add('job', PAYLOAD));
}
await Promise.all(promises);
}
// Wait for all to complete
while (processed < scale) {
await sleep(5);
}

Run the Benchmark

The benchmark source code is available at bench/comprehensive.ts.

Terminal window
# Clone the repository
git clone https://github.com/egeominotti/bunqueue.git
cd bunqueue
bun install
# Start the bunqueue server (for TCP tests)
bun run start &
# Run the comprehensive benchmark
bun run bench/comprehensive.ts

Expected Output

═══════════════════════════════════════════════════════════════
bunqueue Comprehensive Benchmark
Embedded vs TCP Mode
═══════════════════════════════════════════════════════════════
Scales: 1,000, 5,000, 10,000, 50,000 jobs
Bulk size: 100
Concurrency: 10
Payload: 111 bytes
✓ TCP server connected (port 6789)
📦 EMBEDDED MODE (Direct SQLite)
══════════════════════════════════════════════════
🔄 Testing 1,000 jobs...
Push: 86,248 ops/sec
Bulk Push: 221,365 ops/sec
Process: 47,538 ops/sec
...
📊 EMBEDDED MODE RESULTS
┌──────────┬────────────────┬────────────────┬────────────────┐
│ Scale │ Push (ops/s) │ Bulk (ops/s) │ Process (ops/s)│
├──────────┼────────────────┼────────────────┼────────────────┤
│ 1,000 │ 86,248 │ 221,365 │ 47,538 │
│ 5,000 │ 187,256 │ 278,587 │ 64,716 │
│ 10,000 │ 177,098 │ 279,640 │ 77,713 │
│ 50,000 │ 204,913 │ 286,616 │ 74,772 │
└──────────┴────────────────┴────────────────┴────────────────┘
📈 EMBEDDED vs TCP (Embedded is X times faster)
┌──────────┬────────────────┬────────────────┬────────────────┐
│ Scale │ Push │ Bulk │ Process │
├──────────┼────────────────┼────────────────┼────────────────┤
│ 1,000 │ 3.0x │ 2.3x │ 2.4x │
│ 5,000 │ 3.8x │ 2.0x │ 1.9x │
│ 10,000 │ 3.2x │ 1.9x │ 2.2x │
│ 50,000 │ 4.0x │ 2.2x │ 2.3x │
└──────────┴────────────────┴────────────────┴────────────────┘

When to Use Each Mode

Embedded Mode

Best for single-process apps

  • Microservices
  • CLI tools
  • Edge functions
  • Serverless

TCP Mode

Best for distributed systems

  • Multiple worker processes
  • Separate producer/consumer
  • Horizontal scaling
  • Remote workers

Why bunqueue is Fast

SQLite WAL Mode

Concurrent reads/writes with memory-mapped I/O via Bun’s native FFI bindings.

Auto Sharding

Auto-detected from CPU cores (power of 2, max 64). Minimizes lock contention.

TCP Pipelining

Multiple commands in flight per connection with reqId-based response matching.

Efficient Structures

Skip lists for O(log n) priority queues. MinHeap for delayed jobs. LRU caches.


Benchmark Environment

Hardware:

  • Mac Studio, Apple M1 Max
  • 32GB RAM
  • SSD storage

Software:

  • macOS Tahoe
  • Bun 1.3.8

Configuration:

  • Scales: 1,000, 5,000, 10,000, 50,000 jobs
  • Bulk size: 100 jobs per batch
  • Concurrency: 10 workers
  • Payload: 111 bytes
  • Connection pool: 32 connections (TCP mode)

Other Benchmarks

The repository includes additional specialized benchmarks:

BenchmarkPurposeFile
ComprehensiveEmbedded vs TCP at scalebench/comprehensive.ts
BullMQ Comparisonbunqueue vs BullMQ (Redis)bench/comparison/run.ts
ThroughputIndividual operation speedsbench/throughput.bench.ts
WorkerRealistic worker simulationbench/worker.bench.ts
StressProduction validationbench/stress.bench.ts
Million JobsHigh-volume integrity testbench/million-jobs.bench.ts
Terminal window
# Run BullMQ comparison (requires Redis)
redis-server --daemonize yes
bun run start &
bun run bench/comparison/run.ts

Submit Your Results

Run benchmarks on your hardware and share results via GitHub Discussions.

Include:

  • CPU model
  • RAM
  • Bun version
  • OS
  • Benchmark output