liveBook · Manning

Agglomeration

As explained in Grokking Concurrency

Agglomeration is the combination of smaller computational tasks into larger units to reduce coordination and communication costs.

Planning a road trip is easier when related jobs belong to one person: booking accommodations and researching places to visit can be coordinated without checking in about every small decision. Concurrent tasks can be grouped for the same reason. section 13.2

Agglomeration combines smaller tasks into larger ones after the work has been divided and the necessary communication identified. The aim is to make the design faster or simpler on the processors that will run it. When two tasks that exchange data become one task, their exchange no longer needs communication between tasks. This is an increase in locality. section 13.6 section 13.2

More grouping is not always better:

  • Too many tiny tasks can burden the scheduler; grouping tasks assigned to one processor can reduce that overhead. section 7.9
  • Combining a long-running task with short ones may leave the short tasks waiting. Balance communication savings against uneven workloads and implementation simplicity. section 13.6

Word counting with map/reduce

A map task can combine its local (word, 1) pairs into fewer intermediate pairs before sending them to reduce tasks. That local aggregation cuts communication. The reduce work can then be agglomerated into one larger reduce task; fewer messages do not, by themselves, make every grouping worthwhile. section 13.12 section 13.6

How Grokking Concurrency covers it

How deep it goes
Explains grouping, locality, scheduler pressure, and uneven-workload trade-offs, but does not provide an agglomeration implementation.
Examples
Illustrates coordination with snow shoveling and salting, then shows local aggregation and reduce-task grouping in word counting.
What it assumes
Assumes tasks have been partitioned and their communication identified before grouping them for execution.
What you can do after
Practice/perform task grouping by weighing communication savings against uneven workloads and implementation simplicity.
How it connects
Links task decomposition and communication to processor mapping, locality, and load balancing.

Related concepts

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