The Best GraphQL CDN Solutions: Detailed Analysis
While REST APIs have a selection of different CDN options, GraphQL APIs traditionally had to build their own solution to get the benefits of a CDN.
Fortunately, a GraphQL CDN now exists to automate GraphQL caching and provide detailed observability metrics necessary to reduce cloud costs and proactively find and solve common performance challenges that negatively impact revenue.
Below, we’ll walk you through what to look for in a GraphQL CDN and how to use it to improve your bottom line.
What is a GraphQL CDN?
A GraphQL CDN is a type of CDN (content delivery network) specifically tailored to GraphQL requests.
It improves website performance, reliability and the user’s experience by storing the website content across a network of servers and sending only the data stored geographically closest to the end user’s location.
The Challenges of Caching GraphQL Data
One of the most impactful capabilities that a CDN enables is data caching.
Caching significantly improves website performance, reduces server load, and ultimately reduces cloud costs by storing a copy of the data at the edge server closest to the user..
However, caching data for GraphQL is tricky as GraphQL uses POST requests, which aren’t cacheable by default.
Therefore, the CDNs REST users can implement don’t work out of the box for GraphQL users.
Traditionally, the only option to cache GraphQL queries was to build your own caching infrastructure. Unfortunately, this isn’t a great solution for a few reasons:
It’s expensive to build your own caching solution as it takes many hours of highly specialized engineering talent to build. In fact, many teams don’t have engineers with this knowledge on staff.
Even after building a caching infrastructure, it won’t offer key observability metrics to identify and proactively solve issues. For example, you might have basic metrics, like error and latency averages, but you won’t be able to drill down and identify where those issues are occurring and which subset of users they’re impacting. This makes it difficult to prioritize issues by revenue impact.
Purging data is also challenging as most in-house caching infrastructures don’t offer an intuitive method to automatically purge data. As a result, teams have to purge all data at once, causing the cache hit rate to drop to zero. This influx of uncached requests hitting the servers is not only expensive from a cloud cost perspective, but can also overload the servers and cause them to go down altogether. As a result, you lose revenue from users who were actively trying to use the website when it went down, and the poor user experience will also negatively impact your brand’s reputation.
To solve these problems, we built the first GraphQL CDN solution, Stellate.
Below, we’ll introduce you to Stellate and give you an overview of the criteria you can use to evaluate any future GraphQL CDN solution that may be available.
Best GraphQL CDN Solution
Stellate is the first GraphQL CDN that offers simple GraphQL edge caching.
It works with any GraphQL API and sits between the GraphQL client and GraphQL backend to reduce strain on your backend.
The best part is that you don’t have to switch servers or rewrite your code.
By caching GraphQL requests, you can reduce server load, which ultimately reduces cloud infrastructure costs. Caching data also improves website performance and reliability by shielding your API from major traffic spikes, which helps you increase revenue by reducing downtime and improving site speed.
In addition to automatically caching your data, Stellate offers detailed observability metrics. Instead of just showing you latency, errors, and cache leaks, it shows you when and where they occur so you can quickly identify, prioritize, and solve the highest impact issues.
You can also set alerts to be notified immediately of any high impact issues.
It also offers automatic and manual cache purging to prevent you from purging all data at once, causing the cache hit rate to drop to zero.
Edge caching is a great method to further improve website performance as it leverages a network of servers distributed across the globe and serves the data geographically closest to the end user. By reducing the distance the data must travel to reach the end user, your website visitors will experience faster load times.
Therefore, Stellate offers edge caching with a network of 98 different servers distributed across the world.
So if you have a website visitor in Spain, they’ll receive their data from our server in Madrid whereas your website visitors in Australia will receive their data from our server in Brisbane, Sydney, Melbourne, Adelaide or Perth depending on which is closest.
Edge caching is one of the key reasons we’re able to help websites deliver faster load times, which delivers a better user experience and can increase conversion rates. Faster load times also aid SEO efforts, as site speed is a key ranking factor.
A key challenge with maintaining your own GraphQL caching solution is that there isn’t an intuitive method to purge cached data which has been updated. If you purge it all at once, you’ll likely overload your backend servers, which will either slow down your website or cause it to go down altogether.
To solve this problem, Stellate offers both automatic and manual cache data purging out of the box.
Automatic purging occurs when data is transformed through your GraphQL endpoint, by means of a mutation. For instance, if Stellate sees that a blog post has been updated, it can identify the outdated blog post via its ID and automatically purge it from the servers.
Alternatively, you can use manual purging to purge data by a query, field, name of an operation, or other type of tag. This is useful when data is updated outside of your API and doesn’t pass through Stellate to trigger an automatic purge.
Ultimately, this ensures users always have up-to-date information and you never have to purge all data at once.
Stellate offers all the observability metrics you need to improve caching, and it goes far beyond just providing basic averages. It also allows you to drill down and discover where various issues occur and which users are most affected.
This allows you to prioritize issues by revenue impact and solve them faster.
Below we’ll discuss a few of these metrics in detail.
Stellate measures latency for all cached requests and you can filter the dashboard by location to identify which users are most impacted by latency issues.
You can also drill down and identify where latency issues occur on the website to prioritize and solve them by impact. For example, latency issues on product pages are much more critical than latency issues on the About Us page.
Maximum Cache Hit Rate
You can also see the maximum cache hit rate or the percentage of requests that could be served by the cache rather than retrieved from the original server, which helps you identify the biggest opportunities to improve website performance.
With maximum cache hit rate data, you won’t waste time optimizing a cache hit rate that can’t be improved much more. In addition, it surfaces areas that can be significantly improved.
Observability metrics allow you to see the biggest impact issues, but some issues (like a cache leak revealing customer credit card information) require immediate attention.
Therefore, Stellate also offers alerting that allows you to set specific alerts by parameter, such as the number of requests per country and even the number of unique IP addresses for each cacheable request.
Implement a GraphQL CDN Today
At the time of this writing, Stellate is the only GraphQL CDN that exists to help you cache GraphQL data.
However, even if other solutions arise, this criteria can help you evaluate what you should look for as you’re selecting a GraphQL CDN.
To learn more about how Stellate can help improve your website’s performance and significantly reduce cloud costs, try it out today for free!