// AKKA.PERSISTENCE

Durable State and Event Sourcing for Actors

Akka.Persistence makes actor state re-entrant — park it when idle, recover it automatically when needed. Because it's event sourced, your state is immutable and replayable, making CQRS a natural fit.

ref: how-it-works

// HOW_IT_WORKS

Event Sourcing in Action

Actors persist state changes as events. On restart, those events replay to rebuild state exactly as it was — no data loss, no manual recovery.

Event sourcing with Akka.Persistence — normal processing and recovery Event sourcing with Akka.Persistence — normal processing and recovery

Normal processing persists events to a journal. Recovery replays from the last snapshot.

ref: code

// IN_CODE

Persist, Project, and React

Persist events, update your state, sync your read model, and execute side effects — all in one pipeline. The async onComplete callback runs after all events are persisted. Read the full case study →

SubscriptionActor.cs
public class SubscriptionActor : ReceivePersistentActor
{
    private SubscriptionState _state = SubscriptionState.Empty;
    public override string PersistenceId { get; }

    public SubscriptionActor(string subscriptionId)
    {
        PersistenceId = $"subscription-{subscriptionId}";

        // Handle commands — process, persist, react
        Command<UpgradeSubscription>(cmd =>
        {
            var events = _state.ProcessUpgrade(cmd);
            PersistAll(events,
                evt => _state = _state.Apply(evt),
                onComplete: async () =>
                {
                    await SyncReadModel();     // sync EF Core projection
                    await SendConfirmation();  // email, notifications
                    Sender.Tell(new UpgradeComplete());
                });
        });

        // Recover state on startup — replay events from journal
        Recover<ISubscriptionEvent>(evt =>
            _state = _state.Apply(evt));

        Recover<SnapshotOffer>(snap =>
            _state = (SubscriptionState)snap.Snapshot);
    }
}
ref: features

// KEY_CAPABILITIES

Persistence Features

Re-entrant State

Don't keep every actor in memory. Persistence lets you park actor state and recover it on demand — database-agnostic, scaling to millions of actors. Perfect for intermittent workloads like user sessions or IoT devices.

Event Sourcing + CQRS

Immutable event logs make it easy to create projections and implement Command Query Responsibility Segregation. We have code samples and guides to get you started.

100k+ Concurrent Queries

Akka.NET v1.5 introduced token bucket throttling for Persistence.Query, enabling 100k+ concurrent queries against SQL Server with zero errors.

10+ Database Engines

Plug in any supported database. Akka.Persistence.Sql (Linq2Db-based) provides cross-database support, or use dedicated providers for specialized needs.

ref: databases

// SUPPORTED_DATABASES

+ community packages for Oracle, RavenDB, DynamoDB, RocksDB, Google Bigtable, LiteDB

ref: customers

// WHO_USES_THIS

NRK (Norwegian Broadcasting Corporation)

Broadcasting / Media — Norway

NRK built a media distribution engine using Akka.NET and F# that has been in production since 2016 — one of the longest-running Akka.NET deployments in the community. They use Persistence with Cluster Sharding for durable media set state, and evolved from RabbitMQ-based delivery to a cleaner "desired state" persistence pattern.

Game Plumbers

Gaming / Unity

Game Plumbing Framework uses Akka.NET persistence to enable Unity game developers to create full-stack multiplayer games. The Akka.NET backend delivers ~5ms per message compared to 40ms+ on AWS Serverless, with negligible additional time for inter-actor hops.

NRK NRK GP Game Plumbers PR Priva GR Grimmloch
ref: newsletter

// STAY_CONNECTED