Back to docsRecipe

Load shedding

When your licensing backend is under pressure, Nimbus gracefully degrades instead of crashing. This recipe covers circuit breakers, token buckets, and offline grace caches so your users never see a hard failure.

Circuit breaker

Wrap every outbound call to KeyAuth or your own API in a three-state breaker: closed → open → half-open. After five consecutive failures, trip the breaker for 30 seconds. During the open state, return a cached license verdict immediately.

Token bucket

Rate-limit license validation attempts per machine GUID. A bucket of 10 tokens refilling at 1 token/second prevents a runaway client from hammering your infrastructure. Excess requests get a 429 with a Retry-After header.

Offline grace cache

Sign a local cache entry with HMAC-SHA256 using a key derived from the machine fingerprint. The cache stores the last known license state and a TTL. If the breaker is open or the network is unreachable, Nimbus trusts the cache for up to 72 hours.

Exponential backoff

Retry with jitter: base delay 200ms, cap at 30s, full jitter on each attempt. This spreads retry storms across your fleet and prevents thundering-herd wake-ups after an outage.

Next: read the full implementation guide in the loader source at src/loader/resilience.cpp