Problem
You have a complex task that can be broken into independent subtasks. Processing them sequentially would be slow, but you need to combine all results for a final answer.Solution
The fan-out/fan-in pattern (also known as map-reduce) lets you:- Fan-out: Submit multiple independent jobs in parallel
- Wait: Collect results from all subtasks
- Fan-in: Synthesize the results into a final output
wrk returns immediately and flw blocks until completion, you can parallelize the work while maintaining sequential synthesis.
Example
Research a technology from multiple angles:How It Works
- Each
wrkcall returns a job ID immediately - The daemon processes jobs in parallel (up to
NRVNA_WORKERS) flwblocks until each job completes- The final synthesis job combines all results
Use Cases
- Research: Investigate multiple aspects of a topic
- Analysis: Process different data sources independently
- Comparison: Evaluate multiple options in parallel
- Translation: Process multiple languages simultaneously