Apache Pekko is an open-source framework designed to simplify the development of concurrent, distributed, resilient, and elastic applications. Leveraging the Actor Model, Pekko offers high-level abstractions for concurrency, allowing developers to focus on business logic rather than low-level implementation details. It originated as a fork of Akka 2.6.x, preceding Akka's adoption of the Business Source License. Two years ago, Pekko entered the incubation phase at the Apache Software Foundation and last year it released version 1.0 while the latest release is 1.0.2.
Modern computer architectures pose challenges such as component crashes, lost messages, and fluctuating network latency, even in well-managed data center environments. Pekko addresses these challenges by providing multi-threaded behavior without the necessity of low-level concurrency constructs like atomics or locks. It also streamlines communication between systems and their components by providing transparent remote communication capabilities. This eliminates the need for developers to write and maintain complex networking code and offers a clustered, high-availability architecture that scales dynamically based on demand, enabling the creation of resilient and scalable applications.
The actor model, upon which Pekko is built, provides a level of abstraction that simplifies the development of correct concurrent, parallel, and distributed systems. Actors, the fundamental units of computation in Pekko, encapsulate state, behavior, a mailbox, child actors, and a supervisor strategy behind an actor reference. This abstraction allows developers to think about their code in terms of communication between actors, similar to exchanges in a large organization.
In the actor model, actors communicate by sending messages to each other, without transferring the thread of execution. This non-blocking communication enables actors to accomplish more in the same amount of time compared to traditional method calls. Actors behave similarly to objects in that they react to messages and return execution when they finish processing the current message. Upon reception of a message, an Actor can do the following three fundamental actions: send a finite number of messages to Actors it knows; create a finite number of new Actors; and designate the behavior to be applied to the next message.
The image below describes the Pekko actor hierarchy:
Pekko is designed as a modular application and encompasses different modules to provide extensibility. The main components are: Pekko Persistence enables actors to persist events for recovery on failure or during migration within a cluster that provides abstractions for developing event-sourced applications; Pekko Streams module provides a solution for stream processing, incorporating back-pressure handling seamlessly and ensuring interoperability with other Reactive Streams implementations; the connectors modules include connectors for integrating with other systems such as Kafka and Cassandra; Http and gRPC modules provide HTTP and gRPC capabilities and a series of different utilities for operating and managing Pekko clusters.