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 . 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.
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?
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
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 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.
Websocket support? Will there be a pattern to support websocket connections through middleware in apollo router for gateway connections? Javascript as a backend technology makes my co-workers cringe…
Just to to be sure there’s an understanding of what’s JavaScript: the Apollo Router is written in Rust and the Apollo Gateway is written in Rust. Hopefully your team will find solace in that since they’d be avoiding JavaScript!
Just to clarify again: Router and Gateway are different incarnations — the former in Rust and the latter in JavaScript!
With regards to WebSockets: We’re looking at this. It would be good to understand how you use them today. If you’re not using them today, it’d be good to understand specifically what you expect from them and what you’d be hoping for versus another long-held connection (e.g., event streams using HTTP + server-sent events). Could you elaborate?