UP | HOME

Akka

Akka is a foundational framework (set of reusable abstractions)

A typical use case for stream processing is consuming a live stream of data (K-Lines, an OrderBook, etc.) that we want to extract or aggregate some other data from as it goes, without slowing down - pseudo real-time.

Conceptually we can do transformations, like traditional map, scan, filter and then consumption (updating some moving averages, etc).

At least in theory, with asynchronous (reactive) non-blocking processing we always must be way faster than any internet connection, and this is why we are using this bloated framework and JVM.

We delegate all that enormous complexity of implementations to the JVM, Scala and Akka developers and communities respectively, hoping (because it is impossible to know, leave alone understand all the details) that they did everything right.

At least the design is very good - declarative, functional DSLs and message-passing Actors instead of method calls (actual non-blocking communication) with dynamic buffers inside and back-pressure coordination (via messages).

It will be beautiful if they spend some effort to make at least design minimal and “perfect” (when there is nothing to remove), but corporate code tends to go in opposite direction, adding more and more features.

Anyway.

Streams

Presumably they have learned from Spark and Kafka and the Twitter stack.

Akka Streams implicitly implement pervasive flow control, all operators respect back-pressure (advanced internal back-pressure signaling).

They use asynchronous message-passing (just alike Actors) and queues (everything runs non-blocking in a thread-pool) under the hood, and every node on a graph is essentially an Actor.

The package provides a rich DSL with lots of pre-defined Sources, Sinks and stream /transformation operators.

Everything is a value (an instance of a class), declarative, reusable and composable. Conceptually similar to directed graphs, could have “forks” and “joins”.

The core types are:

  • Source, literally (a “Producer”)
  • Flow (the abstract middle part, without a /Source)
  • Sink (a “Consumer”)

Agents

Author: <schiptsov@gmail.com>

Email: lngnmn2@yahoo.com

Created: 2023-08-08 Tue 18:31

Emacs 29.1.50 (Org mode 9.7-pre)