This content is part of an upcoming preview program. Request early access
Parallel Execution
Execute multiple tasks concurrently for maximum throughput
Blazing Batch automatically parallelizes task execution across distributed workers. Learn how to leverage this for maximum performance.
Basic Parallel Execution
Execute Multiple Tasks
Parallelization Benefits
Sequential vs Parallel
Sequential execution (4 tasks × 1s each = ~4 seconds):
Parallel execution (4 tasks × 1s each = ~1 second):
Real-World Example
Task with Delays
Even tasks with delays benefit from parallelization:
Best Practices
1. Batch Task Creation
2. Use gather() for Results
3. Monitor Concurrency
Performance Characteristics
| Workers | Tasks | Sequential Time | Parallel Time | Speedup | |---------|-------|----------------|---------------|---------| | 4 | 4 | 4s | ~1s | 4x | | 4 | 8 | 8s | ~2s | 4x | | 4 | 100 | 100s | ~25s | 4x | | 10 | 100 | 100s | ~10s | 10x |
Next Steps
- Error Handling - Handle task failures
- Concurrency Patterns - Advanced patterns
- Basic Task Execution - Fundamentals
Source
Based on test suite examples:
tests/test_infrastructure.py::test_parallel_fetchestests/test_infrastructure.py::test_parallel_with_delays