Skip to main content

Getting Started

Services that run on many machines keep hitting the same coordination problems: two workers run the same job, a retried request creates a second order number, or instances disagree about a configuration value. Kahuna is an open-source, self-hosted cluster that solves them with three building blocks: distributed locks, a distributed key/value store, and a distributed sequencer.

Kahuna is a Hawaiian word that refers to an expert in any field. Historically, it has referred to doctors and priests, among other experts.

Follow these steps to get started.

  1. Run Kahuna. Start a standalone server with Docker; see Server Installation. For an easy way to run a local cluster, add Kahuna to a .NET Aspire AppHost: one declaration creates the nodes and connects them, with storage and readiness checks.
  2. Do a tutorial. Each tutorial uses the Kahuna CLI against your local server: Key/Value Store, Distributed Locking, Distributed Sequencer.
  3. Pick a building block for your problem from the sections below. Why Kahuna? explains when Kahuna is a good fit and when it is not.

Distributed Locking​

Use a lock when only one process at a time may do something, such as run a scheduled job or apply a database migration. It works like a lock statement shared by all your servers. Each lock has a lease. This means that a crashed holder can't block it forever. Each lock also has a fencing token that lets a protected resource reject a holder whose lease already expired.

See More

Distributed Key/Value Store​

Store small shared state that all instances must read the same way, such as configuration and feature flags. Persistent writes are replicated before they are acknowledged. Revisions and compare-and-set let you update a key, and another client's change isn't overwritten.

See More

Distributed Sequencer​

Allocate increasing values from named sequences, like a database identity column that several services can share. An idempotency key makes retries safe. A retried request gets the same value, and not a new one. Each sequence is ordered separately. Values from different sequences aren't ordered relative to each other. Typical uses are order IDs and invoice numbers, or ordered identifiers in event-driven systems.

See More

Common Use Cases​

The recipes show how to combine these building blocks into common application patterns.


License​

Kahuna is licensed under the MIT License. See the LICENSE file for details.