Blazing iconBlazing
Coming SoonDev Preview

This content is part of an upcoming preview program. Request early access

Parallel Execution

Edit on GitHub

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

Python

Parallelization Benefits

Sequential vs Parallel

Sequential execution (4 tasks × 1s each = ~4 seconds):

Python

Parallel execution (4 tasks × 1s each = ~1 second):

Python

Real-World Example

Python

Task with Delays

Even tasks with delays benefit from parallelization:

Python

Best Practices

1. Batch Task Creation

Python

2. Use gather() for Results

Python

3. Monitor Concurrency

Python

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

Source

Based on test suite examples:

  • tests/test_infrastructure.py::test_parallel_fetches
  • tests/test_infrastructure.py::test_parallel_with_delays