💡 Note: You are viewing the
nextbranch with upcoming features. For stable releases, check themasterbranch.
A comprehensive benchmarking suite for RedisSMQ message queue system, measuring throughput, latency, and end-to-end performance under various workloads.
This benchmark suite provides tools to measure RedisSMQ performance across different scenarios:
- Producer Throughput - Measure message production rates
- Consumer Throughput - Measure message consumption rates
- End-to-End Throughput - Measure complete system performance with concurrent producers and consumers
Note: These benchmarks are for performance testing and should be run in a controlled environment. Always test with production-like data and conditions.
- Node.js 20+
- Redis server running (default: localhost:6379)
npm install redis-smq@next redis-smq-common@next redis-smq-benchmarks@next --saveBenchmarks can be configured using environment variables:
| Variable | Description | Default |
|---|---|---|
BENCH_MESSAGES |
Total messages to process | 100000 |
BENCH_PRODUCERS |
Number of producer worker threads | 0 |
BENCH_CONSUMERS |
Number of consumer worker threads | 0 |
BENCH_SHOW_PROGRESS |
Benchmark progress reporting | 0 |
REDIS_HOST |
Redis server host | localhost |
REDIS_PORT |
Redis server port | 6379 |
REDIS_DB |
Redis server database | 0 |
# Run with custom configuration
REDIS_HOST=127.0.0.1 \
BENCH_PRODUCERS=10 \
BENCH_CONSUMERS=5 \
npx redis-smq-benchmarksMeasures how quickly producers can enqueue messages.
Features:
- Even distribution of messages across producers
- Real-time progress reporting
- Individual producer statistics
- Aggregate throughput calculation
Usage:
BENCH_MESSAGES=50000 BENCH_PRODUCERS=4 npx redis-smq-benchmarksMeasures how quickly consumers can process messages.
Features:
- Pre-fills queue with messages
- Even distribution across consumers
- Individual consumer statistics
- Complete consumption tracking
Usage:
BENCH_MESSAGES=50000 BENCH_CONSUMERS=4 npx redis-smq-benchmarksMeasures complete system performance with concurrent producers and consumers.
Features:
- Concurrent producer and consumer execution
- Production vs consumption phase tracking
- System backlog monitoring
- Complete throughput analysis
Usage:
BENCH_MESSAGES=100000 BENCH_PRODUCERS=8 BENCH_CONSUMERS=8 npx redis-smq-benchmarksEach benchmark provides detailed metrics:
- Messages processed per worker
- Time taken per worker
- Throughput per worker (messages/second)
- Total messages processed
- Total time elapsed
- Overall throughput
- Average time per worker
- Production throughput
- Consumption throughput
- System backlog (produced vs consumed)
- End-to-end latency
Starting end-to-end throughput benchmark...
Queue: benchmarking/queue-1767808640925 | Messages: 100000 | Producers: 10 | Consumers: 5
Setting up producers and consumers...
========== E2E BENCHMARK COMPLETE ==========
Production Phase:
Total produced: 100000
Production time: 3.35s
Production throughput: 29824 msg/s
Consumption Phase:
Total consumed: 100000
Consumption time: 6.37s
Consumption throughput: 15689 msg/s
End-to-End:
Total time: 6.37s
Overall throughput: 15689 msg/s
System backlog: 0 messages
Status: All messages processed successfully ✓
============================================
- Worker-Based Architecture: Each producer/consumer runs in its own worker thread
- Even Distribution: Messages are evenly distributed across all workers
- Real-time Monitoring: Progress updates during execution
- Graceful Shutdown: Clean termination of all resources
- Extensible: Easy to add new benchmark types
- Worker Count: Increase worker count to leverage multi-core CPUs
- Redis Configuration: Ensure Redis has sufficient memory and connection limits
- Network: Local Redis provides the best performance. Network latency impacts throughput
- Throughput Plateau: Point where adding more workers doesn't increase throughput
- CPU Utilization: Monitor CPU usage during benchmarks
- Memory Usage: Watch for memory leaks in long-running tests
RedisSMQ Benchmarks is released under the MIT License.