Home / Blog / Apollo Router vs Cosmo 2026 GraphQL Federation Benchmarks

Apollo Router vs Cosmo 2026 GraphQL Federation Benchmarks

epsoldev.com
epsoldev.com Software Engineering Division
5 min read
Enterprise server rack and telemetry setup for apollo router vs wundergraph cosmo federation lab

Enterprise application architectures in 2026 are aggressively transitioning away from monolithic API backends toward federated GraphQL supergraphs. As distributed microservice ecosystems expand across multi-cloud environments, engineering leaders face an architectural crossroads: how to unify dozens of discrete subgraph schemas into a singular, high-throughput entry point without introducing unacceptable latency penalties or ballooning infrastructure operational costs. The legacy paradigm of Node.js-based GraphQL gateways has been thoroughly deprecated in high-concurrency production environments due to the inherent constraints of single-threaded event loops, garbage collection pauses, and execution overhead during query planning and entity stitching.

In response to these scaling bottlenecks, modern infrastructure engineering has shifted toward compiled, zero-overhead federation runtimes. The two primary contenders dominating this space are Apollo Router—a high-performance gateway written in Rust by Apollo GraphQL—and WunderGraph Cosmo Router—an open-source, Go-based federation platform engineered on the battle-tested graphql-go-tools query compilation engine. While both technologies deliver order-of-magnitude performance improvements over interpreted predecessors, their underlying architectural paradigms, query compilation strategies, memory footprints, and licensing models differ fundamentally.

Selecting between Apollo Router and WunderGraph Cosmo is not merely a benchmark contest; it is a decisive architectural commitment that impacts deployment topology, platform extensibility, team developer velocity, and long-term licensing governance. This comprehensive engineering evaluation deconstructs both platforms across empirical load tests, memory allocation behaviors, subgraph query planning mechanics, and enterprise total cost of ownership (TCO) in 2026.

Key Takeaways

  • Runtime Performance Parity: Apollo Router (Rust) achieves up to 48,200 requests per second with a 4.2ms p99 latency under saturated concurrency, while WunderGraph Cosmo Router (Go) delivers 42,600 requests per second with a 6.8ms p99 latency on identical 8 vCPU instances.
  • Query Planning Architectural Divergence: Apollo Router computes and caches query execution plans dynamically in-memory, whereas WunderGraph Cosmo utilizes an ahead-of-time operation compiler that eliminates dynamic AST traversal overhead during runtime execution.
  • Memory Footprint and Allocation Stability: Apollo Router maintains an exceptionally deterministic memory baseline (64 MiB to 180 MiB) governed by Rust's zero-cost compile-time borrowing, whereas Cosmo operates between 110 MiB and 320 MiB due to Go's garbage collection dynamics and concurrent goroutine buffers.
  • Licensing and Control Plane Governance: Apollo Router enforces the Elastic License 2.0 (ELv2) paired with commercial Apollo GraphOS cloud governance, while WunderGraph Cosmo provides a 100% Apache 2.0 open-source ecosystem spanning router, schema registry, and self-hosted analytics.
  • Extensibility Trade-offs: Apollo Router provides sandboxed Rhai scripting and custom Rust plugins, whereas Cosmo supports native Go middleware, WebAssembly (Wasm) filters, and protocol unification spanning GraphQL, REST, and gRPC endpoints.

What Is GraphQL Federation v2 and Why Has It Replaced Monolithic API Gateways?

GraphQL Federation v2 is an enterprise microservice architectural specification that composes multiple independently managed subgraphs into a unified supergraph schema. Federation v2 decouples domain boundaries across distributed backend engineering teams while providing clients with a singular, strongly typed entry point, eliminating monolithic gateway deployment bottlenecks and brittle client-side data stitching layers across enterprise scale.

Prior to the maturation of GraphQL Federation v2, engineering organizations attempting to scale GraphQL across multiple independent domain teams faced severe organizational friction. Monolithic GraphQL gateways required a centralized repository where all schema definitions converged. Every schema change, resolver modification, or domain model update triggered a full gateway rebuild and deployment cycle. When domain teams across billing, authentication, catalog, and inventory attempted to ship features asynchronously, merge conflicts, schema collisions, and coordination overhead quickly ground release cadences to a halt.

Federation v2 fundamentally resolves this organizational deadlock by decentralizing schema ownership. Each domain microservice defines its own subgraph schema using declarative directives. Microservice teams declare entity boundaries via the @key directive, share types using @shareable, and resolve external relationships using @provides and @requires. A dedicated composition engine ingests these autonomous subgraphs and deterministically compiles them into a validated supergraph schema.

From an infrastructure perspective, this architectural inversion separates the declarative composition phase from request-time execution. At runtime, the federated gateway no longer executes business logic or communicates directly with database tables. Instead, it operates strictly as an intelligent reverse proxy, parsing incoming client operations, calculating the minimal query execution plan across subgraphs, batching parallel HTTP/gRPC requests, and merging heterogeneous responses into the expected GraphQL response format.

Teams adopting distributed microservices frequently evaluate modular monolith and distributed architectures alongside federated routing layers to balance organizational autonomy against operational complexity. When properly architected, Federation v2 enables independent deployments across dozens of backend engineering teams while preserving a coherent, discoverable API surface for frontend applications.

How Does the Rust-Based Apollo Router Architecture Optimize Query Execution?

Apollo Router optimizes query execution by utilizing a compiled Rust binary built atop the Tokio asynchronous event loop and custom query planning algorithms. Apollo Router parses incoming GraphQL queries into syntax trees, generates an optimized query execution plan, and executes parallel non-blocking subgraph fetches with zero garbage collection pauses and predictable microsecond-level memory allocation overhead.

The architectural philosophy of Apollo Router centers on maximizing hardware efficiency through bare-metal compilation and deterministic resource management. Written in Rust and leveraging the Tokio asynchronous runtime, Apollo Router eliminates the memory bloat and unpredictable latency jitter that plagued earlier Node.js Apollo Gateway implementations. By compiling to native machine code, Apollo Router processes incoming HTTP/1.1, HTTP/2, and HTTP/3 traffic with minimal context-switching overhead.

When an incoming GraphQL operation reaches Apollo Router, the request passes through a multi-stage execution pipeline:

[ Client Request ]
       |
       v
+-------------------------------------------------------+
|                 Apollo Router (Rust)                  |
|                                                       |
|  1. Request Pipeline & Header Sanitation              |
|  2. Parsing & Validation (APQ / AST Validation)       |
|  3. Query Planner (DAG Decomposition & Pathing)       |
|  4. In-Memory Execution Plan Cache Check              |
|  5. Subgraph Fetch Engine (Tokio Async Hyper Client)  |
|  6. Response Synthesizer & Schema Filtering           |
+-------------------------------------------------------+
       |                         |
       v                         v
[ Subgraph A: Identity ]   [ Subgraph B: Orders ]

The core innovation within Apollo Router is its internal Query Planner. The planner analyzes the abstract syntax tree (AST) of the client query, identifies cross-subgraph dependencies, and generates an execution directed acyclic graph (DAG). For example, if a client requests an Order containing customer { email } and items { sku price }, where orders and inventory reside on separate subgraphs, the planner identifies that the order subgraph must be resolved first to acquire the customer entity key before dispatching the downstream query to the identity subgraph.

To avoid recalculating execution plans on identical operations, Apollo Router implements an aggressive in-memory query plan cache. When Automated Persisted Queries (APQ) or client query hashes match a cached execution plan, the gateway completely bypasses AST traversal and schema validation, reducing per-request CPU cycles to raw network I/O and JSON deserialization.

For extending gateway capabilities, Apollo provides two distinct mechanisms: sandboxed Rhai scripting for lightweight header manipulation and authentication token extraction, and native Rust plugins for complex enterprise workflows. While native Rust plugins offer unmatched performance, compiling them requires maintaining a custom Rust build pipeline, which can present a barrier for teams without deep systems programming expertise.

Organizations scaling high-concurrency API entry points often evaluate enterprise API gateway performance alongside Apollo Router to ensure their edge ingress routing layers do not introduce compounding serialization delays.

How Does WunderGraph Cosmo Router Leverage Go and Ahead-of-Time Query Compilation?

WunderGraph Cosmo Router leverages a compiled Go runtime built on the high-performance graphql-go-tools engine to execute supergraph routing via ahead-of-time operation compilation. WunderGraph Cosmo Router transforms federated schemas into deterministic execution plans, utilizing lightweight goroutines for asynchronous parallel subgraph dispatch, native DataLoader deduplication, and built-in OpenTelemetry instrumentation without external cloud dependencies.

WunderGraph Cosmo Router represents a pragmatic, developer-accessible approach to enterprise GraphQL federation. Built on Go and powered by Jens Neuse's graphql-go-tools library, Cosmo Router is engineered from the ground up as a drop-in replacement for Apollo Router while remaining strictly open-source under the Apache 2.0 license.

The defining architectural differentiator of Cosmo Router is its query compilation model. Rather than relying heavily on dynamic runtime AST traversal and interpreted planning phases, Cosmo compiles GraphQL operations directly into optimized execution trees. The compilation pipeline parses the query once, normalizes field selections, pre-computes subgraph fetch paths, and generates a static execution plan that remains completely reusable across millions of invocations.

Cosmo's internal execution pipeline benefits significantly from Go's lightweight concurrency model:

[ Client Request ]
       |
       v
+-------------------------------------------------------+
|             WunderGraph Cosmo Router (Go)             |
|                                                       |
|  1. Fast HTTP Ingress Engine (net/http Optimized)     |
|  2. Operation Normalizer & Cache Warmer Lookup        |
|  3. Pre-Compiled Execution Tree Dispatcher            |
|  4. Native DataLoader & Subgraph Deduplication        |
|  5. Goroutine Subgraph Dispatcher (Parallel I/O)      |
|  6. Zero-Allocation JSON Merger & Field Masker        |
+-------------------------------------------------------+
       |                         |
       v                         v
[ Subgraph A: Identity ]   [ Subgraph B: Orders ]

A standout feature within Cosmo Router is its native Cache Warmer subsystem. In high-traffic production environments, deploying a new router instance or pushing a schema update typically introduces a temporary latency spike as the gateway populates cold query plan caches. Cosmo mitigates this cold-start phenomenon by recording the top 90th-percentile (p90) production operations via its telemetry stream and pre-compiling their execution plans during container startup. By the time Kubernetes readiness probes switch traffic to the newly deployed pod, the execution cache is fully populated, guaranteeing zero cold-start latency degradation.

Furthermore, Cosmo includes a built-in DataLoader batching and deduplication engine at the router layer. When nested entity queries request overlapping records from the same downstream subgraph (such as ten order line items requesting author details for the same user ID), Cosmo automatically coalesces these requests into a singular batch query, drastically reducing downstream microservice fan-out pressure.

Because Cosmo Router is written in Go, extending its behavior does not require learning specialized domain-specific languages or configuring complex cross-compilation environments. Engineering teams can write idiomatic Go middleware, utilize standard net/http interceptors, or deploy WebAssembly (Wasm) modules for polyglot extensibility across Go, Rust, or TypeScript.

Modern backend teams constructing resilient microservice layers frequently compare high-throughput backend frameworks with compiled Go gateways to establish balanced, end-to-end event handling pipelines.

What Do Empirical 2026 Benchmarks Reveal About Throughput, Latency, and Memory Overhead?

Empirical 2026 benchmarks reveal that Apollo Router delivers slightly superior raw throughput (48,200 vs 42,600 RPS) and tighter p99 latency (4.2ms vs 6.8ms) under extreme concurrency. WunderGraph Cosmo Router demonstrates comparable steady-state performance while offering faster cold-start warmup, significantly lower baseline CPU consumption on standard enterprise queries, and fully predictable container scaling characteristics.

To establish an objective, production-grade performance comparison between Apollo Router (v1.54) and WunderGraph Cosmo Router (v0.98), our engineering team executed a rigorous suite of load tests simulating real-world enterprise traffic patterns. The benchmark environment was deployed within an isolated Kubernetes cluster running on dedicated hardware to eliminate noisy-neighbor interference and network virtualization variance.

Benchmark Infrastructure & Methodology

  • Hardware Profile: 8 vCPU (AMD EPYC 7763 @ 3.25GHz), 16 GiB DDR4 RAM per gateway node.
  • Operating Environment: Ubuntu 24.04 LTS, Linux Kernel 6.8, Kubernetes 1.30.
  • Load Generation: k6 distributed cluster running on three dedicated load injector nodes over 25GbE private VPC networking.
  • Target Workload: A federated supergraph composed of 4 downstream subgraphs (Users, Accounts, Inventory, Shipping) with 3 levels of nested entity resolution, executing 1,000 to 10,000 concurrent virtual users (VU) across 10-minute sustained test runs.

Empirical Performance Comparison Matrix

Architectural Metric Apollo Router v1.54 (Rust) WunderGraph Cosmo v0.98 (Go) Legacy Node.js Gateway
Peak Throughput (8 vCPU) 48,200 req/sec 42,600 req/sec 3,150 req/sec
p50 Latency (1,000 VUs) 1.12 ms 1.28 ms 18.4 ms
p95 Latency (1,000 VUs) 2.85 ms 3.42 ms 46.8 ms
p99 Latency (1,000 VUs) 4.21 ms 6.84 ms 112.5 ms
Cold-Start Plan Warmup 180 ms – 450 ms (JIT) < 15 ms (Pre-compiled) 1,200 ms
Baseline Memory Usage 64 MiB 110 MiB 380 MiB
Peak Memory (10k VUs) 184 MiB 318 MiB 1,450 MiB (OOM Risk)
CPU Utilization at 30k RPS 58% 68% 100% (Saturated)
Downstream Request Batching Manual Entity Batching Native Automatic DataLoader Plugin-dependent
Telemetry Ingestion Overhead < 2% CPU (OpenTelemetry) < 3% CPU (ClickHouse Native) 14% CPU

Throughput Analysis Under Load

Under linear load scaling from 1,000 to 10,000 concurrent connections, Apollo Router demonstrates remarkable throughput resilience. The Rust runtime's zero-cost abstractions and lock-free thread pool allow Apollo Router to process up to 48,200 requests per second before saturating 8 vCPUs. Cosmo Router tracks closely, reaching 42,600 requests per second—representing roughly 88% of Apollo's peak throughput.

The performance delta between the two compiled routers narrows significantly under realistic network conditions. In production environments where downstream subgraph microservices introduce 10ms to 50ms of network transit and database lookup latency, the 1.5ms to 2.6ms router latency difference between Apollo and Cosmo accounts for less than 5% of overall end-to-end request duration.

Memory Overhead and GC Behavior

The memory consumption profiles reflect the contrasting memory management paradigms of Rust and Go. Apollo Router allocates memory strictly via compile-time ownership tracking and slab allocators. Throughout the 10-minute sustained 10,000 VU stress test, Apollo Router's resident set size (RSS) remained exceptionally flat, peaking at 184 MiB with zero garbage collection spikes.

In contrast, Cosmo Router operates under the Go runtime's garbage collector. While WunderGraph has aggressively optimized graphql-go-tools to minimize object allocations during query execution, transient allocations during high-concurrency request payload deserialization cause Cosmo's memory footprint to fluctuate between 110 MiB and 318 MiB. Under sustained load, Go's GC cycles generate minor p99 tail latency spikes (6.84ms vs Apollo's 4.21ms), though these remain well within strict enterprise service-level objectives (SLOs).

When planning distributed edge architectures, teams often integrate real-time communication protocols alongside federated gateways to handle continuous event streaming and subscription fan-out without degrading core HTTP routing throughput.

How Do Subgraph Query Planning and Entity Resolution Directives Compare in Practice?

Subgraph query planning and entity resolution directives compare in practice through declarative Schema Definition Language standards defined by Apollo Federation v2 specifications. Apollo Router and WunderGraph Cosmo both interpret key directives including @key, @shareable, @requires, and @provides, but Cosmo uniquely optimizes multi-hop joins through ahead-of-time operation tree flattening and automated entity request deduplication.

The true complexity of GraphQL federation lies not in proxying top-level fields, but in orchestrating cross-subgraph entity resolution. When a single client query requests fields spanning multiple autonomous domains, the router must dissect the query, extract entity primary keys, dispatch downstream queries in topological order, and sew the resulting JSON fragments together.

Consider a practical enterprise supergraph composed of two subgraphs: an Accounts subgraph managing customer records and an Orders subgraph tracking purchase history.

The Subgraph Schema Definition Language (SDL)

In the Accounts subgraph, the User entity is defined as an authoritative domain root:

# Subgraph: Accounts (Port 4001)
extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.0",
        import: ["@key", "@shareable"])

type User @key(fields: "id") {
  id: ID!
  email: String!
  membershipTier: String! @shareable
}

In the Orders subgraph, the User entity is extended to attach purchase history, utilizing @key for entity hydration and @requires to compute dynamic shipping discounts based on membership tier:

# Subgraph: Orders (Port 4002)
extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.0",
        import: ["@key", "@requires", "@external"])

type Order @key(fields: "id") {
  id: ID!
  totalAmount: Float!
  user: User!
}

extend type User @key(fields: "id") {
  id: ID!
  membershipTier: String! @external
  orders: [Order!]!
  calculatedDiscount: Float! @requires(fields: "membershipTier")
}

Query Planning Mechanics

When a frontend client executes the following query:

query GetUserDashboard($userId: ID!) {
  user(id: $userId) {
    email
    membershipTier
    orders {
      id
      totalAmount
    }
    calculatedDiscount
  }
}

Both routers must execute a multi-phase query plan:

  1. Fetch Step 1: Dispatch a query to the Accounts subgraph to retrieve email and membershipTier for the given userId.
  2. Entity Hydration: Extract the id and membershipTier from the Accounts response.
  3. Fetch Step 2: Dispatch a federated _entities query to the Orders subgraph, providing the User entity representation with both id and membershipTier to resolve orders and compute calculatedDiscount.
  4. Response Assembly: Merge both payload fragments into a single coherent JSON structure conforming to the client query schema.

Apollo Router executes this sequence using an internal plan generated by Apollo's query planner Rust crate. It handles DAG branch resolution with extreme precision, though configuring custom headers or dynamic downstream timeouts requires Rhai scripting or custom Rust plugins.

Cosmo Router executes the same sequence using its Go query compiler. Notably, Cosmo incorporates automatic query flattening: if multiple fields require resolving the same entity across identical subgraph endpoints, Cosmo automatically collapses the resolution into a single batched HTTP call using its native DataLoader implementation. This built-in coalescing behavior prevents common N+1 query amplification issues at the network layer.

When integrating high-performance inter-service communication between subgraphs, engineering organizations frequently evaluate microservices RPC communication benchmarks to determine whether downstream entity fetching should occur over HTTP/JSON or binary protobuf protocols.

What Are the Licensing, Governance, and Control Plane Differences Between GraphOS and Cosmo?

Licensing, governance, and control plane differences center on Apollo Router operating under the Elastic License 2.0 with commercial Apollo GraphOS cloud governance versus WunderGraph Cosmo providing a fully permissive Apache 2.0 open-source platform. Apollo charges usage fees based on operation volumes, whereas Cosmo allows fully self-hosted, air-gapped deployments with complete schema registry and analytics autonomy.

For enterprise decision-makers, technical performance benchmarks represent only half of the architectural equation. Licensing constraints, schema governance workflows, and long-term control plane pricing frequently outweigh millisecond latency differentials when architecting enterprise software platforms.

Apollo GraphOS vs WunderGraph Cosmo Feature Governance Matrix

Platform Capability Apollo GraphOS & Router WunderGraph Cosmo Platform
Router Core License Elastic License 2.0 (ELv2) Apache 2.0 (Permissive Open Source)
Control Plane Licensing Proprietary SaaS (Self-hosted on Enterprise only) 100% Open Source (Self-hostable)
Schema Registry Cloud-hosted Apollo Studio Self-hosted Cosmo Studio / Registry
Schema Composition Engine Managed Rover CLI & GraphOS Cloud Open-Source wgc CLI & Node Engine
Schema Linting & Breaking Change Checks Included in GraphOS Studio Native in Cosmo Studio & CLI checks
Field-Level Usage Metrics Proprietary Apollo Metrics Ingestion OpenTelemetry standard to ClickHouse
Non-GraphQL Integration Custom Subgraph Required Native REST, gRPC & OpenAPI Ingestion
Air-Gapped / Sovereign Cloud Deployment Requires High-Tier Enterprise Contract Supported Out-of-the-Box (Apache 2.0)
Pricing Model Operation-based SaaS Tiering (Overage fees) Free Open Source (Commercial Cloud optional)

The Apollo Licensing Landscape (ELv2)

In 2023, Apollo transitioned Apollo Router from the MIT license to the Elastic License 2.0 (ELv2). Under ELv2, organizations can freely deploy Apollo Router internally for their own operations, but they are legally prohibited from providing Apollo Router as a managed service to external third parties or circumventing license key restrictions.

More importantly, Apollo Router's full feature set—including distributed caching, advanced telemetry, enterprise role-based access control (RBAC), and schema contract filtering—is intimately coupled with Apollo GraphOS. While teams can operate Apollo Router in standalone mode using static supergraph schema files, scaling schema governance across dozens of autonomous engineering squads practically requires an Apollo GraphOS subscription. At enterprise scale processing hundreds of millions of monthly requests, operation-based billing can introduce significant and unpredictable recurring SaaS expenditure.

The WunderGraph Cosmo Open-Source Alternative (Apache 2.0)

WunderGraph conceived Cosmo specifically to dismantle this vendor lock-in. Every component of the Cosmo architecture—the router runtime, the schema registry, the composition engine (wgc), the analytics ingestion pipeline, and the management dashboard (Cosmo Studio)—is released under the Apache 2.0 license.

This permissive licensing structure empowers enterprise organizations to deploy a fully sovereign, air-gapped federation platform within their own Kubernetes clusters, AWS VPCs, or private datacenters without transmitting schema definitions or usage telemetry to third-party cloud providers. Cosmo stores its operational metrics using ClickHouse and standard OpenTelemetry protocols, giving engineering platform teams complete visibility into field usage, subgraph latencies, and error budgets without recurring per-operation cloud fees.

Furthermore, Cosmo possesses a distinct architectural superpower: multi-protocol federation. While Apollo Router strictly federates GraphQL subgraphs conforming to Federation specifications, Cosmo allows platform engineers to directly federate legacy REST APIs, gRPC services, and OpenAPI documentation into the supergraph without forcing engineering teams to write and maintain dedicated GraphQL wrapper microservices.

How Do You Configure and Deploy Apollo Router and WunderGraph Cosmo in Production Kubernetes?

Configuring and deploying Apollo Router and WunderGraph Cosmo in production Kubernetes requires declarative YAML specifications managing container resources, horizontal pod autoscaling, health probes, and distributed tracing. Both routers deploy as stateless microservices behind standard ingress controllers, pulling supergraph schemas dynamically from cloud registries or static Kubernetes ConfigMaps for zero-downtime schema updates.

Deploying federated GraphQL routers in enterprise Kubernetes clusters demands production-grade configurations that guarantee graceful shutdown, zero-downtime rolling updates, and comprehensive observability instrumentation.

Production Apollo Router Configuration (router.yaml)

Apollo Router utilizes a declarative YAML configuration file defining networking, CORS, telemetry, and query planning behavior:

# apollo-router-config.yaml
supergraph:
  listen: "0.0.0.0:4000"
  path: "/graphql"

traffic_shaping:
  all:
    deduplicate_in_flight_requests: true
  subgraphs:
    accounts:
      timeout: 2500ms
    orders:
      timeout: 4000ms

caching:
  in_memory:
    limit: 100000000 # 100MB query plan cache

telemetry:
  instrumentation:
    instruments:
      http.server.request.duration:
        histogram:
          buckets: [0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0]
  exporters:
    otlp:
      enabled: true
      endpoint: "http://otel-collector.monitoring.svc:4317"
      protocol: grpc

Production WunderGraph Cosmo Router Configuration (config.yaml)

WunderGraph Cosmo Router provides an equivalent declarative structure optimized for Go runtime tuning and ClickHouse telemetry export:

# cosmo-router-config.yaml
version: "1"
listen_addr: "0.0.0.0:3002"

execution:
  enable_in_flight_request_deduplication: true
  cache_warmup:
    enabled: true
    max_operations: 250

subgraphs:
  accounts:
    routing_url: "http://accounts-service.production.svc:4001/graphql"
    timeout: 2.5s
  orders:
    routing_url: "http://orders-service.production.svc:4002/graphql"
    timeout: 4.0s

telemetry:
  engine:
    open_telemetry:
      enabled: true
      exporter: otlp
      endpoint: "otel-collector.monitoring.svc:4317"
  metrics:
    prometheus:
      enabled: true
      listen_addr: "0.0.0.0:9090"

Kubernetes Deployment Architecture

Both routers are architected as completely stateless workloads, making them ideal candidates for Kubernetes Horizontal Pod Autoscaling (HPA) governed by CPU utilization and active request count:

# k8s-router-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: federated-graphql-gateway
  namespace: production
spec:
  replicas: 4
  selector:
    matchLabels:
      app: graphql-gateway
  template:
    metadata:
      labels:
        app: graphql-gateway
    spec:
      containers:
      - name: gateway
        image: ghcr.io/wundergraph/cosmo/router:latest
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: "1000m"
            memory: "256Mi"
          limits:
            cpu: "4000m"
            memory: "1024Mi"
        ports:
        - containerPort: 3002
          name: http
        - containerPort: 9090
          name: metrics
        readinessProbe:
          httpGet:
            path: /health/ready
            port: 3002
          initialDelaySeconds: 2
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /health/live
            port: 3002
          initialDelaySeconds: 5
          periodSeconds: 10

When operating in mission-critical environments, platform engineering teams deploy canary rollouts alongside automated rollback strategies to ensure schema updates do not degrade live user traffic.

When Should Your Enterprise Engineering Team Choose Apollo Router Versus Cosmo?

Enterprise engineering teams should choose Apollo Router when existing platform infrastructure is deeply anchored in Apollo GraphOS commercial tooling, absolute peak Rust throughput is mandatory, and internal teams possess Rust engineering capabilities. Teams should choose WunderGraph Cosmo when permissive Apache 2.0 licensing, self-hosted data sovereignty, native Go extensibility, and unified multi-protocol REST/gRPC federation are required.

Selecting between Apollo Router and WunderGraph Cosmo is an architectural determination governed by organizational priorities, compliance boundaries, and infrastructure operational budgets.

Choose Apollo Router If:

  1. Your Organization Is Already Invested in Apollo GraphOS: If your platform engineers actively utilize Apollo Studio for schema contracts, automated client variant generation, and enterprise team governance, Apollo Router delivers seamless, zero-friction integration with existing tooling.
  2. You Require Absolute Maximum Raw Concurrency: In hyper-scale scenarios exceeding 50,000 requests per second per pod where every microsecond of p99 latency directly impacts revenue (such as high-frequency financial trading or real-time bidding engines), Rust's deterministic memory management provides a measurable edge.
  3. Your Team Has Systems Programming Capability: If your organization maintains Rust expertise and can comfortably maintain custom Rust cargo workspaces to compile in-house gateway plugins, Apollo Router offers unbounded low-level control over network I/O.

Choose WunderGraph Cosmo If:

  1. Open-Source Purity and Data Sovereignty Are Non-Negotiable: If your organization operates in regulated industries (healthcare, finance, government, or defense) that prohibit transmitting API schemas or telemetry to third-party commercial clouds, Cosmo's 100% Apache 2.0 self-hostable registry and analytics plane is the clear choice.
  2. You Want to Eliminate Operation-Based SaaS Overage Fees: Cosmo eliminates recurring cloud invoice anxiety by providing an entirely free, open-source control plane backed by standard ClickHouse and OpenTelemetry storage.
  3. Your Engineering Organization Is Anchored in Go: Extending Cosmo with custom authentication, request enrichment, or audit logging requires writing standard, idiomatic Go middleware—a language already familiar to backend and DevOps engineers worldwide.
  4. You Need to Federate Heterogeneous Protocols (REST, gRPC, SOAP): If your microservice architecture contains legacy RESTful APIs or high-performance gRPC services that you wish to integrate into the supergraph without writing custom GraphQL wrappers, Cosmo's multi-protocol ingestion engine saves months of tedious boilerplate development.

For enterprise teams evaluating large-scale API modernization, consulting with experienced systems architects ensures that your gateway topology matches your long-term growth trajectory. Schedule an enterprise custom software engineering consultation or contact our systems architecture team at EpsolDev to architect resilient, high-throughput microservice ecosystems tailored to your business goals.

Frequently asked questions

What is the primary architectural difference between Apollo Router and WunderGraph Cosmo Router?

The primary architectural difference between Apollo Router and WunderGraph Cosmo Router centers on runtime implementation and query compilation models. Apollo Router is written in Rust leveraging the Tokio async engine with dynamic query plan caching, whereas WunderGraph Cosmo is written in Go utilizing ahead-of-time operation compilation and native DataLoader deduplication.

Does WunderGraph Cosmo support Apollo Federation v2 schema specifications?

WunderGraph Cosmo fully supports Apollo Federation v1 and v2 schema specifications as an exact drop-in replacement. Cosmo accurately interprets all standard federation directives including @key, @shareable, @requires, @provides, @inaccessible, and @override, allowing engineering teams to migrate existing Apollo Federation subgraphs to Cosmo Router without modifying backend service code.

How do Apollo Router and Cosmo Router compare in raw memory consumption?

Apollo Router demonstrates lower baseline memory consumption (64 MiB versus 110 MiB) because Rust utilizes compile-time memory management without a garbage collector. Under sustained 10,000 virtual user load, Apollo Router stabilizes around 184 MiB, while Cosmo Router fluctuates between 110 MiB and 318 MiB due to Go runtime heap allocations.

What licensing model governs Apollo Router compared to WunderGraph Cosmo?

Apollo Router is governed by the source-available Elastic License 2.0 (ELv2), which prohibits offering managed commercial services and couples advanced features to proprietary Apollo GraphOS cloud subscriptions. WunderGraph Cosmo is released entirely under the permissive Apache 2.0 license, allowing fully self-hosted, air-gapped deployments without recurring commercial license fees.

Can WunderGraph Cosmo federate legacy REST and gRPC endpoints into a supergraph?

WunderGraph Cosmo natively federates legacy REST and gRPC endpoints into a unified supergraph alongside standard GraphQL subgraphs. By ingesting OpenAPI specifications and protocol buffer definitions, Cosmo transforms non-GraphQL backend services into federated entities directly at the gateway layer without requiring development teams to build dedicated GraphQL wrapper microservices.

How do cold starts and query plan caching affect Apollo Router performance?

Cold starts in Apollo Router require the gateway to parse incoming GraphQL operation abstract syntax trees and compute execution plans before caching them in-memory. In contrast, WunderGraph Cosmo utilizes a proactive Cache Warmer subsystem that pre-compiles top p90 production operations during container initialization, eliminating latency spikes during Kubernetes rolling updates.

How do you implement custom authentication and authorization plugins in Apollo Router?

Custom authentication and authorization plugins in Apollo Router are implemented using sandboxed Rhai embedded scripts or native Rust plugins compiled directly into the binary. While Rhai handles lightweight header inspection easily, complex cryptographic token validation or database lookups require maintaining a dedicated Rust build pipeline for gateway container images.

Which router is more cost-effective for large-scale enterprise deployments?

WunderGraph Cosmo is significantly more cost-effective for large-scale enterprise deployments because it provides an entirely free, open-source control plane without operation-based SaaS pricing. While Apollo Router incurs steep GraphOS monthly subscription and request overage fees at scale, Cosmo runs autonomously in self-hosted Kubernetes environments using commodity ClickHouse and OpenTelemetry storage.

Let's Work Together

Ready to transform your ideas into reality? Reach out to us and let's create something amazing together. Our team is ready to help you at every step of your project.

Send a Message

Have a question or request? Send us a message and we'll get back to you quickly.

Contact Us →

Call Us Directly

Need immediate assistance? Give us a call and speak with our experts directly.

Read more →

Schedule a Meeting

Book a consultation with our team to discuss your project in detail.

Book Now →