Routing

Learn how to configure routing strategies and load balancing algorithms for your RPC endpoints.


We provide 2 routing strategies for distributing your incoming RPC requests across multiple Solana RPC endpoints:

  • Primary Routing: The default routing strategy for all RPC methods.
  • Dynamic Routing: Allows you to assign specific endpoints for specific RPC methods.

For each routing strategy, you can set up load balancing algorithms such as:

  • Sequential: Sends requests to RPC endpoints in an ordered sequence.
  • Parallel: Sends requests parallelly to all RPC endpoints.

Routing Strategies

Primary Strategy

Primary strategy refers to the default routing strategy for all RPC methods. All incoming requests will be routed based on the Primary Strategy unless a Dynamic Strategy is defined for a specific RPC method.

  • Go to the "Load Balancer" section in the Ironforge dashboard, select your project, create a new project if you haven't already.
  • You will find the "Routing Strategies" section in the project's page.
  • Select the Sequential or Parallel option for your Primary Strategy.
  • Select the RPC endpoints you want to use for the routing strategy. You can add multiple endpoints and order them based on your preference.
  • Click "Save" to save your changes.
  • You can always come back and edit the routing strategy as needed.

Screenshot of Sequential Algorithm

Dynamic Strategy

Dynamic routing will always take precendence over the Primary Routing strategy. You can assign specific endpoints for specific RPC methods, giving you more control over how requests are routed based on the RPC method.

You can add a Dynamic route by clicking on Add Route in the "Dynamic Strategies" section in the bottom of your project's "Routing Strategies" page.

It will lead you to a new page where you can add the following details:

  • Name: A name for the dynamic route.
  • Cluster: The RPC endpoint cluster to point to, i.e. mainnet-beta, devnet, etc.
  • Routing Algorithm (Sequential or Parallel): The routing algorithm to use for this dynamic route. This routing algorithm will only be used for this specific dynamic route.
  • Endpoints: The RPC endpoints to use for this dynamic route. You can add multiple endpoints and order them based on your preference.
  • RPC Methods: The RPC methods for which this dynamic route should be used. You can add multiple RPC methods.

Screenshot of Dynamic Routing

Now let's move on to the load balancing algorithms.

Load Balancing Algorithms

Both the Primary and Dynamic routing strategies can use the following load balancing algorithms:

Sequential

When a request is made, Ironforge forwards it to the first available RPC endpoint in the configured list.

If the first endpoint responds successfully, Ironforge uses that response. However, if the first endpoint encounters an error or is unavailable, Ironforge automatically moves to the next available endpoint in the sequence. This process continues until a successful response is obtained or all endpoints have been attempted.

You can set the order of the endpoints which should be used for the Sequential algorithm via the user interface.

Parallel

The Parallel routing algorithm is designed for maximizing performance and responsiveness.

When a request is received, Ironforge simultaneously sends it to all available RPC endpoints. Ironforge then uses the response from the first endpoint that responds successfully, discarding the responses from the remaining endpoints. This approach leverages parallel processing to reduce response times.

However, it's important to note that the Parallel algorithm may incur higher costs due to the increased utilization.