liveBook · Manning

Non-cpu-bound service

As explained in Akka in Action, Second Edition

A non-CPU-bound service is an external operation whose latency is dominated by waiting rather than local processor computation.

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

How Akka in Action, Second Edition covers it

How deep it goes
Explains concurrency choices, throttling, capacity limits, and observable timing through runnable HTTP and database examples.
Examples
Uses simulated delays, HTTP quantity validation, and persistence-ID lookups against a containers database.
What it assumes
Assumes basic Akka Streams and asynchronous Scala familiarity while demonstrating external calls, response handling, and database setup.
What you can do after
Apply it via Akka Streams by selecting ordered or unordered concurrency and throttling calls to real services.
How it connects
Connects non-CPU-bound work with Akka Streams, mapAsync, mapAsyncUnordered, Akka HTTP, and database access.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.