liveBook · Manning

Akka

As explained in Akka in Action, Second Edition

Akka is an open-source toolkit for building concurrent, distributed, and resilient applications on the JVM using actor-based abstractions.

Akka is a JVM toolkit for concurrent and distributed applications. It centers the actor programming model as one abstraction for scaling both up across cores and out across servers, while supplying a runtime and supporting tools for scalable deployments. section 1.0 section 1.8

Its core unit is the actor: a small programmable message-processing component. Actors receive immutable messages one at a time, run behavior in response, and can send messages to other actors. Sending is asynchronous, so a sender does not wait for a response. section 1.2

Actor code is separated from thread placement and physical location. A message may be processed on an available local thread or by an actor on another server, allowing deployment placement to change without hardcoding threads or RPC-style networking into business logic. section 1.2 section 1.1

Table 1.1 Differences between the traditional approach and the Akka approach (view table figure)

Objective

Traditional method

Akka method

Scaling

Uses a mix of threads, shared mutable state in a database (create, insert, update, delete), and web service RPC calls

Actors send and receive messages. No shared mutable state. Log of immutable events.

Providing interactive information

Polls for current information

Event-driven: pushes when the event occurs

Scaling out on the network

Synchronous RPC, blocking I/O

Asynchronous messaging, nonblocking I/O

Handling failures

Handles all exceptions; continues only if everything works

Lets the application crash. Isolates the failure, and continues without the failing parts.

Compare an actor-based design with a traditional mix of threads, database state, polling, and synchronous RPC. The actor approach favors immutable events, event-driven updates, asynchronous messaging, and isolation of failed components. section 1.3

Akka supports application structure beyond message delivery. It provides facilities for configuring and scheduling actors, connecting them across a network, and building clusters. Supervision lets one component watch others, choose whether to continue, restart, or stop after failures, and isolate trouble rather than require every part to keep working. section 1.2 section 1.5.4

From wallet to scalable application

A minimal wallet receives deposit messages and first prints each amount. Later variants retain a total in a variable, retain state through behavior, and deactivate or reactivate the wallet. The same message-oriented approach is positioned for interactive applications such as a business chat system handling many simultaneous events. section 2.0 section 1.3

Use Akka’s model when an application needs to:

  • Handle concurrent work through messages instead of entangling threads, locks, and shared mutable state. section 1.1 section 1.3
  • Push interactive updates when events occur instead of polling for current information. section 1.3
  • Keep useful parts running when individual components fail, under supervisory decisions. section 1.5.4

How Akka in Action, Second Edition covers it

How deep it goes
Defines actor messaging and introduces creation, behavior, state, scheduling, distribution, and supervision, while deferring distributed and clustered details.
Examples
Uses a business chat application to compare scaling approaches and a wallet that evolves through deposits, state, and activation.
What you can do after
Build it from scratch by creating actors, sending messages, setting behavior, retaining state, and scheduling delayed messages.
How it connects
Connects actors with immutable messages, asynchronous messaging, supervision, clustering, nonblocking I/O, and the Reactive Manifesto.

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.