Benchmarking GraphQL Federation Gateways - September 2025 Edition

Benjamin RabierBenjamin Rabier

Benchmarking GraphQL Federation Gateways

Last year we demonstrated the Grafbase Gateway's excellent performance with the graphql-gateways-benchmark from The Guild. Now we're back with an expanded test suite that goes beyond simple throughput measurements. Our September 2025 benchmarks evaluate five federation gateways: Grafbase Gateway, Apollo Router, Cosmo Router, Hive Gateway, and Hive Router. In addition to the original benchmark, we have additional scenarios that mirror production challenges: complex query planning, massive response payload and request de-duplication.

Our benchmark suite runs on a Linux machine with an AMD Ryzen 9 7950X3D (16 cores) and 94 GiB of RAM. To ensure fair and reproducible results:

  • All gateways run in Docker containers with --network host to minimize overhead
  • CPU boost is disabled to prevent frequency scaling from skewing results
  • Subgraphs are optimized for speed and serve responses mostly from cache
  • Every request includes a unique authorization header to prevent gateways from abusing the repetitive nature of the benchmark, except for the de-duplication scenario.

We use K6 for load testing, running each scenario for 60 seconds. The benchmarks measure:

  • Response latencies, count/rate through K6.
  • Resource usage (CPU & MEM) through docker stats during the load test.
  • Requests per core.s / per GB.s is computed from the maximum CPU / MEM.
  • Total count of subgraph requests is measured by the subgraphs themselves and reported through K6.

In the following tables we always show the maximum CPU & memory used but the average is also available in the full report.

Gateways:

  • Grafbase Gateway 0.49.0
  • Apollo Router 2.6.0. For the disabled cache variant we used the following: which is a bit before 2.6.0.
  • Cosmo Router 0.249.0
  • Hive Gateway 1.16.3
  • Hive Router 0.0.8

The full benchmark suite is open source at github.com/grafbase/graphql-federation-benchmarks. The whole report and charts will be generated by the embedded CLI app and you can choose to run specific gateways/scenarios.

All the data presented here comes from the auto-generated full report.

The many-plans scenario uses 7 subgraphs with very similar schemas and executes deep queries to stress the query planner, forcing it to consider many possible paths. It's particularly relevant for measuring cold-start performance after gateway re-deployments as many queries will need to be planned from scratch. We have ran the gateways both with and without caching:

many-plans-latencies many-plans-efficiency

Without Planning Cache:

GatewayP50 (ms)P95 (ms)P99 (ms)CPU maxMEM maxRequests/core.sRequests/GB.s
Grafbase Gateway19.520.621.9108%134 MiB46.9387.2
Cosmo Router372.1380.3383.6178%83 MiB1.533.2
Apollo Router3338.93385.23405.2101%4101 MiB0.30.1
Hive Gateway
Hive Router

With Planning Cache:

GatewayP50 (ms)P95 (ms)P99 (ms)CPU maxMEM maxRequests/core.sRequests/GB.s
Grafbase Gateway2.02.32.6167%56 MiB282.58558.2
Apollo Router9.310.511.9175%801 MiB56.8126.9
Cosmo Router17.919.720.4513%79 MiB10.7717.6
Hive Gateway
Hive Router

We have also tested Hive Gateway and Hive Router, but neither managed to return a valid response. Hive Router was particularly slow only being able to return a single response within the 60s load test.

Note that query planning is a complex problem, this benchmark is only one worst case scenario. But, it has the benefit of having no simple workarounds, the planner really has to consider many different paths and some are better than others. On that regard here are the number of subgraph requests executed by each gateway:

GatewaySubgraph Requests
Grafbase Gateway~78
Cosmo Router~190
Apollo Router203

The Grafbase Gateway generated the least subgraph requests, providing a better query plan. Both Grafbase Gateway and Cosmo Router have inflight request de-duplication activate by default. Grafbase gateway used 80 requests without de-duplication. We have never tested Cosmo Router without and Apollo Router with it in this case. An improvement for the future!

The big-response scenario tests how gateways handle large GraphQL responses (~8MiB) containing a mix of lists, objects, strings, floats, and integers. K6 runs with a single virtual user to measure best-case latencies.

Latencies:

big-response-latencies

GatewayP50 (ms)P95 (ms)P99 (ms)
Hive Router25.529.632.3
Grafbase Gateway29.933.936.2
Cosmo Router72.383.087.1
Apollo Router123.9132.0137.5
Hive Gateway161.6176.9190.8

Resources:

big-response-efficiency

GatewayCPU maxMEM maxRequests/core.sRequests/GB.s
Hive Router81%178 MiB44.0204.7
Grafbase Gateway89%82 MiB34.6385.7
Cosmo Router267%144 MiB5.095.6
Apollo Router97%569 MiB8.114.2
Hive Gateway122%569 MiB4.910.8

Both Hive Router and Grafbase Gateway demonstrate excellent performance for large payloads with Cosmo following.

The long-lived-big-response scenario is a variant of the previous one that includes an additional small subgraph requests that takes 100ms. This forces gateways to keep responses in memory longer to have a better measure of how efficient memory use is for response data. The load test is executed with 10 VUs.

Latencies:

long-lived-big-response-latencies

GatewayP50 (ms)P95 (ms)P99 (ms)
Hive Router141.0159.1167.6
Grafbase Gateway159.3181.1193.5
Cosmo Router205.5241.5258.3
Apollo Router302.4385.3466.3
Hive Gateway1665.32543.43342.1

Resources:

long-lived-big-response-efficiency

GatewayCPU maxMEM maxRequests/core.sRequests/GB.s
Hive Router245%568 MiB28.4125.2
Grafbase Gateway234%365 MiB26.2172.1
Apollo Router510%2563 MiB6.312.8
Cosmo Router991%934 MiB4.852.5
Hive Gateway133%766 MiB4.47.9

We see similar results as before. Cosmo's memory consumption increased significantly, Hive Gateway didn't on the contrary. However, Hive Router continued to de-duplicate requests despite unique authorization headers, making this comparison not entirely equivalent. We could have disabled here, but didn't think of it at the time of the benchmark. Hive Router would likely consume more resources without.

This scenario executes the complex query from The Guild's graphql-gateways-benchmark, requiring multiple subgraph requests with duplicate patterns. We have two variants:

  • query: a constant throughput of 500 requests/s with a unique authorization header to prevent abusing the repetitive nature of the bench.
  • deduplication: a constant throughput of 1000 requests/s with de-duplication enabled on all gateways and a constant authorization header.

Query Latencies:

query-latencies

GatewayP50 (ms)P95 (ms)P99 (ms)Avg Subgraph Requests
Hive Router40.446.447.51.28
Grafbase Gateway45.447.247.913.0
Cosmo Router46.948.849.98.01
Apollo Router48.250.251.016.0
Hive Gateway1314.41725.010926.47.00

Here again Hive-router used inflight request deduplication despite the random authorization header. Contrary to before, here there might duplicate subgraph requests, and it's definitely a good strategy to de-duplicate them for the same gateway request. We think that's what Cosmo does here. So whether we disable or enable Hive router de-duplication, it's not an apples to apples comparison.

Interestingly Grafbase Gateway does more requests than Cosmo here, this is because we don't detect and use the pattern provided by the fragments which is something we're working on adding soon.

Query Resources:

query-efficiency

GatewayCPU maxMEM maxRequests/core.sRequests/GB.s
Hive Router50%170 MiB998.93008.6
Grafbase Gateway71%78 MiB704.86560.9
Apollo Router295%184 MiB169.12779.9
Cosmo Router349%65 MiB143.17857.5
Hive Gateway141%703 MiB94.1192.8

Deduplication Latencies:

deduplication-latencies

GatewayP50 (ms)P95 (ms)P99 (ms)Avg Subgraph Requests
Hive Router39.946.147.30.65
Grafbase Gateway41.547.148.20.89
Cosmo Router43.651.654.10.63
Hive Gateway1326.11775.311125.87.00
Apollo Router

Deduplication Resources:

deduplication-efficiency

GatewayCPU maxMEM maxRequests/core.sRequests/GB.s
Hive Router83%199 MiB1206.45135.3
Grafbase Gateway120%106 MiB832.49634.4
Cosmo Router599%97 MiB166.910543.9
Hive Gateway142%765 MiB93.3176.9
Apollo Router

Both Hive Router and Cosmo achieve the lowest number of subgraph requests per gateway requests, with Grafbase following behind. For some reason Apollo router had errors with query de-duplication enabled.

These benchmarks demonstrate that Grafbase Gateway delivers exceptional performance across diverse workloads. With the lowest memory footprint, fastest query planning, and competitive latencies, it's engineered for production environments where efficiency and reliability matter.

The full benchmark suite is open source at github.com/grafbase/graphql-federation-benchmarks. We encourage the community to run these benchmarks in their own environments and contribute additional scenarios.

As always, the best benchmark is one that reflects your specific workload. We're committed to continuous improvement and welcome feedback on scenarios that matter to your use cases.

Get Started

Start building your federated graph now.