A non-CPU-bound service spends most of its latency waiting for an external result rather than consuming local processor time. Akka Streams can overlap many such requests, subject to available memory and the service’s capacity. section 16.1.2
Use this pattern when stream stages call external systems:
- Choose mapAsync when preserving input order matters; raise parallelism for independent requests. section 16.1.2
- Choose mapAsyncUnordered when results may arrive in any order; faster queries then avoid waiting behind slower ones. section 16.1.2
- Throttle real services to limit request pressure, and bound concurrency according to downstream capacity. section 16.1.2
Concurrent external filtering
A stream processes 5,000 items through a simulated one-second external operation with mapAsync(1000), completing in under six seconds when resources allow. section 16.1.2
