Partial Query Caching
Stellate Partial Query Caching enables you to optimally cache your existing queries, resulting in a higher cache hit rate, reduced bandwidth to your origin server and increased stability. Based on the cache rules targeted at certain types and fields of your GraphQL schema that you configured for your service, Partial Query Caching will split any given query into mutliple separate entries that can be cached optimally. In particular, you no longer need to manually split your queries into cacheable and uncacheable parts.
All current GraphQL caching solutions fall short for many use cases. Why? Because they only allow caching whole responses. When a single field in a query cannot be cached or contains user-specific data, this affects the caching of the entire response. (Examples include personalized product prices, up-to-date availability, and AI-powered dynamic recommendations).
With Partial Query Caching, you can:
- Maximize the amount of data that is being cached.
- Send significantly less API traffic to your origin server.
- Eliminate thousands of hours of compute time.
Partial Query Caching bestows a number of advantages on your GraphQL implementation:
- Cache more of your queries - Before Partial Query Caching, having just a single non-cacheable field in your query prevented the whole response from being cached. Now, that doesn’t stop you. If your config includes non-cacheable types and fields, Stellate splits out the fields that are non-cacheable and caches the rest. On subsequent requests, only the non-cacheable parts will be sent to your origin server, thus improving your GraphQL API efficiency.
- Easier caching set up - When starting from zero, coming up with the perfect caching strategy out of the gates is impossible. Partial Query Caching offers a innovative way to incrementally adopt GraphQL edge caching by allowing you to selectively start caching only certain types or fields and then step by step extend your caching config as you go.
- Reduce the load on your origin server - By only sending the parts of the query to the origin that are not found in the cache, Partial Query Caching helps reduce the size of requests your origin needs to handle and consumes less bandwidth. This lowers overall infrastructure costs, and improves stability.
- Improve your caching strategy - Not all types and fields in your GraphQL schema are suitable for caching. Before Partial Query Caching, this limited the effectiveness of your caching strategy as you would need to manually split your queries in order to cache more. But with Partial Query Caching this is now built into Stellate and the user does not need to undertake extra effort (it “just works”).
Given the cache rules from the configuration, Stellate knows which types and fields can be cached for what amount of time, and also which types and fields are not cacheable at all. With Partial Query Caching, Stellate will use that information to split up any incoming query into parts that each have their own set of caching characteristics (
scopes). Each of those parts will get it’s own cache entry, ensuring that all your data is optimally cached, including not being cached at all if it’s defined as non-cacheable.
Queries that benefit most from Partial Query Caching include:
- A query that contains both cacheable and non-cacheable types or fields.
- A query that contains both public data and user-specific data.
- A query that contains both data that is long-term cacheable and data that is short-term cacheable.
Our metrics help you identify such queries. To do so:
- Navigate to the Metrics > Operations page in the Stellate dashboard.
- Add filters to idenfity good queries for Partial Query Caching:
- Filter for Cache State = Cache Pass to see queries that are not being cached, and look out for those who are prevented from being cached by a non-cacheable type or field.
- Filter for individual scopes to see queries that have that scope applied, and look out for fields in that query that would not need to be scoped.
Once you have set up cache rules and enabled Partial Query Caching, it runs automatically on all queries sent to your Stellate service to ensure their data is cached optimally. You can easily monitor the results with our metrics dashboard and adjust your rules. Everything else is automatic.
Are you ready to get started? To set up Partial Query Caching for your Stellate service, follow the steps in Configure Partial Query Caching.
We are dedicated to helping you be successful. If you want to dive deeper into Partial Query Caching and the value you can get from using it, then you can contact customer success at firstname.lastname@example.org.