Back to docsRecipe
Backpressure handling
When your loader phones home faster than the licensing server can respond, you need backpressure. This recipe shows the token-bucket pattern we ship inside the Meridian C++ runtime.
Token bucket at a glance
- 1.Capacity — max burst size (e.g. 5 requests).
- 2.Refill rate — tokens added per second (e.g. 1 token / 2 s).
- 3.Take — consume 1 token per outbound call. If bucket is empty, queue or drop.
Circuit breaker integration
Pair the token bucket with a circuit breaker. After three consecutive failures, open the circuit for 30 seconds. All requests during the open state fail fast — no wasted threads, no cascading timeouts.
Offline grace cache
When the server is unreachable, fall back to an HMAC-signed grace cache stored on disk. The cache is valid for a configurable window (default 72 hours) and prevents the loader from blocking the user during transient outages.