Frequently Asked Questions

Apache Pekko Project

Where does the name Pekko come from?

The former name of this project, Akka, is a goddess in the Sámi (the native Swedish population) mythology. She is the goddess that stands for all the beauty and good in the world. Pekko builds on this foundation and is the Finnish god of farming & protector of the crops.

Resources with Explicit Lifecycle

Actors, ActorSystems, Materializers (for streams), all these types of objects bind resources that must be released explicitly. The reason is that Actors are meant to have a life of their own, existing independently of whether messages are currently en route to them. Therefore you should always make sure that for every creation of such an object you have a matching stop, terminate, or shutdown call implemented.

In particular you typically want to bind such values to immutable references, i.e. final ActorSystem system in Java or val system: ActorSystem in Scala.

JVM application or Scala REPL “hanging”

Due to an ActorSystem’s explicit lifecycle the JVM will not exit until it is stopped. Therefore it is necessary to shutdown all ActorSystems within a running application or Scala REPL session in order to allow these processes to terminate.

Shutting down an ActorSystem will properly terminate all Actors and Materializers that were created within it.

Actors

Why OutOfMemoryError?

It can be many reasons for OutOfMemoryError. For example, in a pure push based system with message consumers that are potentially slower than corresponding message producers you must add some kind of message flow control. Otherwise messages will be queued in the consumers’ mailboxes and thereby filling up the heap memory.

Cluster

How reliable is the message delivery?

The general rule is at-most-once delivery, i.e. no guaranteed delivery. Stronger reliability can be built on top, and Pekko provides tools to do so.

Read more in Message Delivery Reliability.

Running on recent Java versions

Which JVM flags do I need on recent Java versions?

Pekko 2.x requires Java 17 or later and most applications need no extra JVM flags. A few modules reach into JDK internals and need a flag, depending on which parts of Pekko you use. This list may not be complete, so check the page of each module you use:

  • Artery remoting and Cluster: --add-opens=java.base/sun.nio.ch=ALL-UNNAMED for Aeron (UDP), and --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED because of Agrona 2.x. See Artery and the migration guide.
  • LMDB, used by the Distributed Data durable store and by Cluster Sharding with remember-entities-store=ddata: --add-opens=java.base/sun.nio.ch=ALL-UNNAMED and --add-opens=java.base/java.nio=ALL-UNNAMED. See Distributed Data and Cluster Sharding.
  • LevelDB persistence: --add-opens=java.base/java.nio=ALL-UNNAMED. See Persistence.
  • The virtual thread dispatcher (Java 21 or later): --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED and --add-opens=java.base/java.lang=ALL-UNNAMED. See Dispatchers.
  • Pekko 1.x on newer JDKs (reported for Java 23 and later): the JDK prints warnings that sun.misc.Unsafe methods will be removed. --sun-misc-unsafe-memory-access=allow silences them. Pekko 2.x has moved its own use of sun.misc.Unsafe to VarHandles, see the 2.0 release notes, but a library such as Agrona may still use it.

Pass the flags to the java command, or through JAVA_TOOL_OPTIONS or your build tool’s JVM options. These flags are about the JDK, not Pekko: other libraries on your classpath may need their own.

Debugging

How do I turn on debug logging?

To turn on debug logging in your actor system add the following to your configuration:

pekko.loglevel = DEBUG

Read more about it in the docs for Logging.