angelcervera
angelcervera

Reputation: 4199

Disabling journal in AKKA persistence

I'm doing a performance test to an AKKA persistent actor and I want to know the impact writing to the journal.

Simple question but I did not find anything in the documentation:

How to disable the journal from the config file? I'm looking for something like a mock or null journal plugin.

Any idea?

Upvotes: 1

Views: 668

Answers (2)

angelcervera
angelcervera

Reputation: 4199

I created a project with a persistence plugin (journal + snapshots) that basically does not do anything but ignoring.

Of course, using this plugin will not recover after a failure, so your system will not be resilient.

This is the project: https://github.com/angelcervera/akka-persistence-nowhere

How to use it:

  1. Import or add in the classpath
resolvers += "osm4scala repo" at "http://dl.bintray.com/angelcervera/maven" // If 
it's not found in the main maven repository. 
libraryDependencies += "com.acervera.akka" %% "akka-persistence-nowhere" % "1.0.1"
  1. Overwriting your default application.conf
akka {
  persistence {
    journal.plugin = "disable-journal-store"
    snapshot-store.plugin = "disable-snapshot-store"
  }
}

disable-journal-store {
  class = "com.acervera.akka.persistence.nowhere.AkkaPersistenceNowhereJournal"
  plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}

disable-snapshot-store {
  class = "com.acervera.akka.persistence.nowhere.AkkaPersistenceNowhereSnapshotStore"
  plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
}

Upvotes: 1

J0HN
J0HN

Reputation: 26951

AFAIK, there's no akka persistence plugin that just does not do anything - since it basically defeats the purpose of persistence. Note that akka-persistence uses eventsourcing approach, so journal is the "main" storage, and snapshots are an optimization to speed up state recovery after actor crash/restart/etc. So you can't really disable journal completely.

The closest to what you want might be the in-memory persistence, or Local LevelDB persistence.

Also, there's a list of community-built plugins for persistence - you might be able to find something that matches your use case.

However, I would recommend testing the performance of the persistence with the actual persistence plugin you'd be using in production - results vary across different persistence backends (e.g. Cassandra vs. DynamoDb vs. JDBC vs. Mongo, etc.)

Upvotes: 2

Related Questions