LLM router failover within one site means a load balancer can send a new inference request to a surviving Router instance at the same client URL. To test it, start a stream through Router A, stop A, then send a fresh request and confirm Router B serves it. Record what the first client received. A complete answer from B can coexist with a partial answer from A.
This drill is for platform teams running a self-hosted LLM gateway with several Hivenet Router instances behind one client endpoint. It assumes a test site, an existing authentication setup, and access to each Router’s metrics. The expected behavior comes from the v0.1.7 deployment reference. Use the drill before a rolling restart or a load balancer change. It gives you three things to check in your own logs: which Router served new traffic, what the user saw in the open stream, and whether rate limits still applied during a separate Valkey outage. The timings come from your test environment.
Clients send HTTP requests to the load balancer. Agents need a separate session with each Router so any instance receiving a request can reach the model backend. A healthy client endpoint says little about that second path. In a two-Router test site, send a small request through each Router using the same client key and model ID. If only one succeeds, fix that discrepancy before testing failover. Record what the load balancer’s health check tests, its timeout, and how many failed checks remove a target. A process that accepts a connection can still lack an eligible agent.
For an explicit agent configuration, supply each Router’s individual gRPC address through --routers. For example, --routers router-a:50051,router-b:50051 names two peers. Replace these names with addresses an agent can reach. Pointing that static list at the client load balancer can leave the agent connected to just one Router. If you use discovery instead, each Router needs its own reachable --advertise-grpc-addr. The deployment guide describes both arrangements.
Both Routers need consistent policies, key configuration, and the site’s agent authentication secret. In v0.1.7, using Valkey for shared limits does not distribute dynamic API key changes. If traffic has only reached A so far, a missing key on B can go unnoticed until B starts serving those requests.
Use distinct, stable --router-id values and the same --sync-site. If you rely on shared limits, configure --sync-store=valkey on both instances. Set --sync-min-routers to the number deployed, which is two in this example. That setting matters when a Router starts before it can reach the store. Keep the load balancer’s client credential forwarding consistent across both routes.
Read hivenet_sync_up and hivenet_sync_peers separately for each Router. With both instances healthy and synchronized, expect a sync-up value of 1 and one other live peer per Router. Next, record the outcome of a short non-streaming request through the client endpoint, including its request ID and which Router handled it. Use a model and key dedicated to the drill so the results are easy to identify. The Router monitoring guide explains how to trace a request.
Use the OpenAI-compatible endpoint your application normally calls. The example below uses Bash and a non-streaming chat request. Set ROUTER_ORIGIN to your HTTPS origin, supply ROUTER_CLIENT_KEY from your usual credential source, and replace test-model with an allowed model name. Keep the prompt short so generation time is a small part of the measurement.
Capture the HTTP status, body, and Router’s X-Request-ID response header. Router assigns this ID to each request. If the client retries the same logical operation, it can reuse a valid UUID in X-Client-Request-ID to find the related attempts in the audit log. A complete response from the expected model is a useful control; the exact word it generates is incidental. Pair the client observation with a Router log entry or a load balancer access log that identifies the selected instance. Repeating this command after stopping A checks the same endpoint, credential, model, and prompt.
Adapt the control request by changing "stream":false to "stream":true, adding --no-buffer to curl, and replacing the one-word prompt with a longer task such as counting from one to fifty in words. First let a stream finish with A healthy. Record how the backend signals completion, typically with data: [DONE]. An initial HTTP 200 and a few tokens only tell you the stream started. See the v0.1.7 streaming reference.
X-Request-ID. A fresh success through B demonstrates that the remaining path works. It does not complete the earlier stream.If the fresh request still reaches A after shutdown, inspect the load balancer’s health-check history and removal delay. An authentication error from B is evidence that traffic reached the surviving Router. Compare key configuration before changing the route. If B accepts the key but has no eligible agent, compare agent connections, model registration, and policy on B. A slower response after the switch warrants a separate check of queue depth and backend load before calling the failover a failure. For an engine that goes down while both Routers stay healthy, use the vLLM backend recovery guide.
For the first run, you need to see the original failure. Set a client timeout and record it. A timeout means the client stopped waiting; the backend might already have processed the request. For a second run, use the retry settings your application ships with and log each attempt. If the user has already seen part of an answer, check what the application displays when a retry generates a new answer. Appending both outputs can repeat text or leave two different answers in the same conversation. Use a prompt without tool calls so a replay cannot repeat an external action during the drill. If the application retries transient failures, bound the attempts and use exponential backoff with jitter so clients recovering together do not all retry at once. Apply this at the layer that owns retries and account for any SDK retries. See the AWS guidance on timeouts and retries.
A Valkey connectivity failure can leave the HTTP endpoint reachable while changing what it admits. In a separate run, leave both Routers and their agents online and interrupt store access in the test environment. After three missed sync intervals, the documented degraded behavior is for each Router to enforce its share of the limits. Watch hivenet_sync_up on each instance. A Router that retains occupancy credits can use them within the degraded rules. A newly started Router with no credits cannot admit occupancy-controlled work until the store answers.
To check enforcement, use a test key with a known, low request-rate limit and a model with spare capacity. Record which attempts each Router admits before and during the store outage. Check any rejection against the Router logs: a capacity rejection and a key rate limit point to different causes. A successful health check or a change in hivenet_sync_up alone does not demonstrate that the limit was enforced.
If a Router cannot read today’s usage for a key with a daily token limit and has not seen that key today, it can return 429 token_limit_exceeded. That error alone does not establish that the client spent its daily allowance. Compare it with the Router’s sync status and whether the same key had already made a request there that day. See the rate limits and quotas guide for the underlying limits.
Restore connectivity and watch each instance return to synchronized operation. Reuse the test key to confirm that the expected policy applies after recovery. If you also need to test a Valkey primary failover, run that as a separate exercise with your own Sentinel and persistence configuration. Disconnecting a Router from a healthy store exercises a different failure.
Record when A stops, when the load balancer removes it, and when a fresh request first completes through B. The gap between the first two events measures how long the load balancer took to remove A in this run. The gap between the first and last includes how often you sent a test request and how long the model took to answer. Keep the probe interval and prompt the same if you compare runs.
Keep the request IDs, the outcome of the interrupted stream, the first successful request through B, and the first successful request through the restored A. Record the load balancer settings alongside any time you measured. A repeat run can then distinguish a change in health-check timing from a change in Router behavior.
A clean shutdown exercises one failure mode. If a node disappears with both a Router and an agent, surviving instances may retain fewer usable occupancy credits until the missing Router returns under its stable identity. Document that case separately. If the failure takes out the entire site, this same-site drill cannot establish recovery. The multi-site routing guide explains when a reachable Router can redirect a client to another site.
Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.