Skip to main content

Open source · .NET · self-hosted cluster

The distributed coordination layer for .NET

Coordinate .NET services with distributed locks, a consistent key/value store, and ordered ID sequences. Self-hosted, with safe failover and trusted C# functions inside Kahuna Script transactions.

Fenced locks & ordered IDs
Durable & temporary state
Custom C# functions
Jepsen-tested

Inside Kahuna

Coordination, in motion.

Start with three everyday tasks: claim a job, save a value, and get the next invoice number. Follow each request to see what Kahuna does.

INTERACTIVE WALKTHROUGH
STEP 1 OF 6Locking

Both apps ask for the same lock

App A and App B both ask to lock “invoice-2048”. Their requests reach the Kahuna server in charge of that lock: its leader.

  • App node AKahuna 1Lock invoice-2048
  • App node BKahuna 1Lock invoice-2048
Same lock: invoice-2048

Two apps. One lock. One winner.

Both app nodes want to process the same invoice. A lock lets only one own the job at a time.

The lock’s owner is copied across Kahuna servers. Both apps get an answer from the same leader.

Learn about locks
Step 1 of 6

Why Kahuna

Simplify coordination

One owner, consistent state, and ordered IDs for your distributed workflows.

One worker per job

Use leases and fencing tokens to give one worker ownership of a job or tenant.

Consistent shared state

Read current revisions and use transactional compare-and-set for workflows like rate limiting.

Safe, ordered IDs

Allocate numbers and ranges across nodes without races, with idempotent retries.

Custom C# logic

Run trusted C# functions inside Kahuna Script transactions for validation and business rules.

Faster reads, safe failover

Over 116k read requests per second on a local three-node cluster with in-memory storage, plus built-in replication and failover.

See benchmark details →

Your choice of storage

RocksDB for heavy writes, SQLite for smaller deployments, or memory for tests and temporary state.

Where it fits

Use it for shared ownership and control-plane work

Fewer duplicate workers, fewer stale writes, fewer homegrown coordination paths

Good fit

  • Distributed locking for critical sections
  • Reliable shared configuration and metadata
  • Ordered ID allocation across nodes
  • Custom C# functions inside transactions
  • Multi-step workflows with compare-and-set
  • Services that need quorum-backed coordination
  • MIT-licensed Kahuna with no proprietary runtime fees

Not the target

  • A general-purpose analytics database
  • A document store for large unstructured datasets
  • Fire-and-forget eventually consistent pipelines
  • Single-node apps that do not need quorum or leader election

Example

What using it looks like

Start a node, pick storage, and claim a resource

Cluster client

using Kahuna.Client;

var client = new KahunaClient(new[]
{
"https://kahuna-1.internal:8082",
"https://kahuna-2.internal:8082",
"https://kahuna-3.internal:8082"
});

await using KahunaLock jobLock = await client.GetOrCreateLock(
"jobs/invoice-2048",
expiry: TimeSpan.FromSeconds(30),
wait: TimeSpan.FromSeconds(5),
retry: TimeSpan.FromMilliseconds(200)
);

if (jobLock.IsAcquired)
await ProcessInvoice(2048);

What this buys you

One worker owns the job. The cluster replicates the lock state, and the lease expires if the owner dies or stops renewing it.

Clients can connect through any healthy endpoint while Kahuna handles consensus, failover, and the ordered write path behind the API.