Load Balancing
Learn how to configure load balancing and failover behavior in Nexus.
Default behavior
If you omit the relay
parameter, Nexus will default to cycling requests between providers. The default maxAttempts
is 3, and the default order
is sequential
. This means that Nexus will send requests to the first provider in the list, and if it fails, it will try the next provider, and so on. If all providers fail, Nexus will return an error response.
Request cycling
If you configure Nexus with multiple providers that support the same chain, Nexus will by default cycle requests between them. If a request to one provider fails, Nexus will try the next provider in the list. This is useful for load balancing and failovers. You can configure this behavior through the relay
parameter.
Disabling request cycling
If you want to disable request cycling, you can set the failure.kind
parameter to fail-immediately
. This will cause Nexus to send requests to the first provider in the list, and if it fails, Nexus will return an error response.
Load balancing
If you want to load balance requests between providers, you can set the order
parameter to random
. This will cause Nexus to send requests to a random provider in the list. This setting also impacts failure recovery. When failure.kind
is set to cycle-requests
, Nexus will cycle requests between providers in random order. Load balancing weights can be configured at the NodeProvider level.
Was this page helpful?