Introducing the Apollo Router - our Federation runtime in Rust!

We’re excited to unveil our next-generation GraphQL Federation runtime: the Apollo Router. The Apollo Router is written in Rust, and it is fast . :zap: Early benchmarks show that the Router adds less than 10ms of latency to each operation, and it can process 8x the load of the JavaScript Apollo Gateway. Packaged as a standalone, multi-threaded binary, the Router can use all available CPU cores without needing to run multiple instances on a single machine.

Getting Started:

We’d love to hear what you think! :pray:

1 Like

Looks super cool!

Possibly some silly questions but the docs make it seem like Router is a separate executable that runs by itself.

Is there a plan to have it be a npm package similar to Gateway? Will it eventually integrate into Gateway? Replace it? Or be an alternative?

I’m struggling to grasp how this would be used practically when it seems that it would be pretty common to have gateway-level code and configuration that would be specific to a business such as secret management, authorization, logging, non-managed or custom-managed federation (thinking about the ongoing thread/discussion about replacing serviceList).

Am I completely off my rocker or missing the point here? :slight_smile:

Hi @andrewmcgivery :wave:

Yes, the Apollo Router is a separate binary executable (written in Rust) that is a higher-performance alternative to the Apollo Gateway (written in JavaScript) that performs the same federated graph routing functions:

  • accepts client requests
  • plans and executes those requests across subgraphs
  • returns responses back to the client

The Apollo Gateway is quite fast and horizontally scalable today, but to get a 10x performance improvement we needed to write the Apollo Router in a lower-level systems language like Rust. We’ve aimed to make the Router as backwards compatible as possible, but there will be a new extensibility model – one we hope will be language-neutral as well!

The Apollo Gateway, written in JavaScript, will continue to be supported in both the 0.x Gateway npm package and the new 2.x Gateway npm package with support for Apollo Federation 2 (currently in alpha).

The Apollo Router and Apollo Gateway v2.x share the same query planning engine to ensure consistency across both graph routing implementations (Gateway and Router). This should make migration from the Gateway to the Router transparent to all subgraph teams, since all subgraphs that compose into supergraphs today will continue to work in both the Apollo Gateway and the new Apollo Router.

The Apollo Gateway is written in JavaScript and supports gateway-level code, configuration, and plugins that are centered around the JavaScript ecosystem. This enables integration with custom secret management, authorization, logging, and so forth – which are typically handled by the graph platform developers that own building and deploying the Gateway itself.

The Apollo Router, written in Rust, will also offer a well-defined extensibility model, but also more natively supported features to reduce the amount of custom code where possible. We’re aiming keep the simple things simple and make the advanced things possible with the right mix of declarative configuration (for more built-in features) and programmatic extensibility. The Router team is currently exploring WebAssembly (WASM) as a leading option to enable language-neutral programmatic extensibility – something used by other high-performance networking projects like Envoy.

We’d love your feedback on Gateway customizations that need to be supported in the Router, so if you have a few minutes here’s a survey that would help us ensure all your key use cases are met should you decide to upgrade from the Gateway to the higher performance Router!