.. | ||
batch_task.lua | ||
main.rs | ||
README.md |
Minimal Rhailib Benchmark
A simplified, minimal benchmarking tool for rhailib performance testing.
Overview
This benchmark focuses on simplicity and direct timing measurements:
- Creates a single task (n=1) using Lua script
- Measures latency using Redis timestamps
- Uses existing worker binary
- ~85 lines of code total
Usage
Prerequisites
- Redis running on
127.0.0.1:6379
- Worker binary built:
cd src/worker && cargo build --release
Run Benchmark
# From project root
cargo bench
Expected Output
🧹 Cleaning up Redis...
🚀 Starting worker...
📝 Creating single task...
⏱️ Waiting for completion...
✅ Task completed in 23.45ms
🧹 Cleaning up...
Files
simple_bench.rs
- Main benchmark binary (85 lines)batch_task.lua
- Minimal Lua script for task creation (28 lines)Cargo.toml
- Dependencies and binary configurationREADME.md
- This file
How It Works
- Cleanup: Clear Redis queues and task details
- Start Worker: Spawn single worker process
- Create Task: Use Lua script to create one task with timestamp
- Wait & Measure: Poll task until complete, calculate latency
- Cleanup: Kill worker and clear Redis
Latency Calculation
latency_ms = updated_at - created_at
Where:
created_at
: Timestamp when task was created (Lua script)updated_at
: Timestamp when worker completed task
Future Iterations
- Iteration 2: Small batches (n=5, n=10)
- Iteration 3: Larger batches and script complexity
- Iteration 4: Performance optimizations
Benefits
- Minimal Code: 85 lines vs previous 800+ lines
- Easy to Understand: Single file, linear flow
- Direct Timing: Redis timestamps, no complex stats
- Fast to Modify: No abstractions or frameworks
- Reliable: Simple Redis operations