Cache Warmer
The Cache Warmer is an optimization feature designed to enhance GraphQL Federation performance by precomputing query plans and storing them in the cache. This proactive caching mechanism reduces latency spikes caused by cold starts and ensures that high-traffic applications can handle demand surges without performance degradation.
Cache warming is particularly beneficial in scenarios such as e-commerce flash sales, live broadcasts, and major marketing events, where even minor delays can impact user experience and revenue.
How Cache Warming Works
Cache warming operates by:
Identifying Slow Queries: Telemetry data is used to detect high-latency operations that could cause performance bottlenecks. The system prioritizes queries based on P90 latency measurements, ensuring that the slowest queries are targeted for warming.
Building a Manifest: The system prioritizes the slowest queries and compiles them into a manifest for caching. This manifest is stored in the CDN and fetched whenever the router needs it.
Precomputing Query Plans: The cache warmer precomputes and stores query plans in the router, ensuring immediate availability during peak traffic periods. This precomputing occurs at the start of the router, as well as whenever the router restarts due to a configuration update triggered by a subgraph publish.
Configuration & Customization
Enabling Cache Warming
The feature is available to enterprise customers via the Cosmo interface.
Organizations can activate it at the namespace level to target specific workloads.

Users can configure the maximum number of operations for cache warming.
Operations are managed using a LIFO (Last-In, First-Out) policy, ensuring the latest operation is added while the oldest is removed once the limit is reached.
Router Configuration
To enable the cache warmer in the router, add the following configuration to your router configuration file:
For detailed information on the configuration, click here.
Customization Options
Manually Prioritized Operations
Customers can add operations to the cache manually, ensuring critical queries are always warmed. It can be added using wgc.
For detailed information on this command, click here.
Manual Recompute from Studio
Users can manually recompute slow queries from the Cosmo Studio. Currently, recomputation only occurs when a manual operation is added or when the subgraph is published.

Last updated
Was this helpful?