Fixed and dynamic worker pools

Oftentimes, processor functions can take quite a bit of time to return. This could be either because the actual payload processing involves CPU-intensive calculations or simply because the function is waiting for an I/O operation to complete (for example, the processor function performed an HTTP request to a remote server and is waiting for a response).

If all stages were linked using the FIFO dispatch strategy, then slowly executing processors could cause the pipeline to stall. If out-of-order processing of payloads is not an issue, we can make much better use of the available system resources by introducing worker pools into the mix. Worker pools is a pattern that can significantly improve the throughput of ...

Get Hands-On Software Engineering with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.