liveBook · Manning

Unbounded pool

As explained in Clojure: The Essential Reference

An unbounded thread pool is an executor configuration that can create workers without a fixed upper limit as tasks require them.

An unbounded thread pool creates workers as tasks require them, without a fixed upper limit. In Clojure agents, send-off uses one for workloads involving potentially long input/output operations, while send uses a fixed-size pool for shorter CPU-intensive work. section 14.6

The flexibility has a cost: uncontrolled use can make an application lag or run out of memory. Choose it for workload characteristics, not merely because tasks are asynchronous. section 14.6

Concurrent slow agent actions

Two agents run slow updates through send-off. Each update sleeps for the requested duration before incrementing its value; await waits for both actions to finish. The example demonstrates why blocking or lengthy operations benefit from the unbounded pool. section 14.6

How Clojure: The Essential Reference covers it

How deep it goes
Explains workload selection and operational risks, but does not detail worker-creation internals.
Examples
Demonstrates two agents running sleeping updates concurrently and awaiting their completion.
What it assumes
Assumes familiarity with Clojure agents, send, and send-off; distinguishes their executor strategies.
What you can do after
Apply send-off to agent workloads whose operations may block or run for a long time.
How it connects
Connects send-off with agents, fixed-size thread pools, CPU-bound tasks, and input/output operations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.