liveBook · Manning

Virtual node

As explained in Akka in Action, Second Edition

A virtual node is a logical position in a consistent-hashing partition that is assigned to a physical routee.

A virtual node is a logical position in a consistent-hashing partition. The router derives a message key, hashes it, selects a virtual node, and then selects that node’s routee. section 6.3.4

Virtual nodes support two operational goals:

  • Distribute messages more evenly across routees. section 6.3.4
  • Allow routes to be added or removed without assigning hash codes directly to routees. section 6.3.4
  • Configure their quantity through a factor multiplied by the number of routees. section 6.3.4

Routing messages by identifier

An aggregator can define mapping(command) = command.id, while a group router uses withConsistentHashingRouting(10, Aggregator.mapping). Messages with the same identifier produce the same hash and therefore reach the same routee. section 6.3.4

Figure 6.7 Steps the consistent hashing router follows to decide which routee to select
CH06_F07_Abraham2

Trace the four routing steps from message key to hash, virtual node, and selected routee. section 6.3.4

How Akka in Action, Second Edition covers it

How deep it goes
Explains key extraction, hashing, virtual-node selection, routee selection, benefits, and configuration without exposing router internals.
Examples
Uses aggregator identifiers, a mapping function, and a factor-ten consistent-hashing group-router configuration.
What it assumes
Assumes routees and messages, while establishing message-key extraction and virtual-node selection within the routing process.
What you can do after
Operate/configure an Akka group router that maps identifiers consistently and controls virtual-node count through a factor.
How it connects
Connects consistent hashing with message keys, routees, group routers, ServiceKey, and mapping functions.

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.