Skip to content

Commit e8e8877

Browse files
n1ru4lenisdenjoadambenhassen
authored
docs: cdn mirror and circuit breaker (#7356)
Co-authored-by: Denis Badurina <badurinadenis@gmail.com> Co-authored-by: Adam Benhassen <adambenhassen@hotmail.com>
1 parent 84b3221 commit e8e8877

File tree

21 files changed

+414
-149
lines changed

21 files changed

+414
-149
lines changed

packages/libraries/apollo/CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@
140140

141141
const supergraphManager = createSupergraphManager({
142142
endpoint: [
143-
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph',
144-
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph'
143+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
144+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
145145
],
146146
key: ''
147147
})
@@ -155,8 +155,8 @@
155155

156156
const supergraphManager = createSupergraphManager({
157157
endpoint: [
158-
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph',
159-
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph'
158+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
159+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
160160
],
161161
key: '',
162162
circuitBreaker: {

packages/web/docs/next-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference types="next/navigation-types/compat/navigation" />
34
/// <reference path="./.next/types/routes.d.ts" />
45

56
// NOTE: This file should not be edited

packages/web/docs/src/app/blog/(posts)/how-we-shipped-cdn-access-tokens-with-cloudflare-workers-and-r2/page.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sequenceDiagram;
3333
participant CDN Storage (R2)
3434
3535
critical Validate Access Token
36-
Client->>+CDN (CF Worker): Request GET /v1/artifact/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl
36+
Client->>+CDN (CF Worker): Request GET /artifacts/v1/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl
3737
CDN (CF Worker)-->>-Client: Responds with 302 presigned URL
3838
end
3939
Client->>CDN Storage (R2): GET: presigned URL
@@ -76,7 +76,7 @@ sequenceDiagram;
7676
participant CDN Storage (R2)
7777
7878
critical Validate Access Token
79-
Client->>+CDN (CF Worker): Request GET /v1/artifact/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl
79+
Client->>+CDN (CF Worker): Request GET /artifacts/v1/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl
8080
CDN (CF Worker)-->>-Client: Responds with 302 presigned URL
8181
end
8282
Client->>CDN Storage (R2): GET: presigned URL
@@ -202,7 +202,7 @@ the token validation method.
202202
Instead of verifying the CDN access token using an encryption secret environment variable, we would
203203
now instead load the R2 key based on the artifact target id being accessed.
204204

205-
E.g. for the URL `/v1/artifact/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl`, we would load the R2 key
205+
E.g. for the URL `/artifacts/v1/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl`, we would load the R2 key
206206
`<bucket-name>/cdn-legacy-keys/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/` and then check the hash stored
207207
in that key, against the provided access key (the `X-Hive-CDN-Key` header value).
208208

@@ -346,7 +346,7 @@ The `privateAccessKeyId` is never stored anywhere on our side, only the hash.
346346
The `"hv2"` prefix is a convenience for us for quickly identifying whether an access key sent to us
347347
is a legacy or new access token.
348348

349-
E.g. for the URL `/v1/artifact/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl`, we would load the R2 key
349+
E.g. for the URL `/artifacts/v1/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/sdl`, we would load the R2 key
350350
`<bucket-name>/cdn-keys/c7ce447c-f5e6-4f13-87b8-d3051ba3fc45/<access-key-id>`.
351351

352352
We can read the `accessKeyId` from the `X-Hive-CDN-Key` header value.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: 'Enhanced CDN and Gateway Reliability'
3+
description:
4+
Major improvements to our CDN infrastructure to ensure higher availability and resilience against
5+
outages.
6+
date: 2025-12-05
7+
authors: [laurin]
8+
---
9+
10+
We understand that the reliability of our High-Availability CDN is critical for your production
11+
GraphQL Gateway. Even a brief outage can have a significant impact.
12+
13+
To further enhance the resilience of our systems, we've introduced two major improvements to
14+
mitigate potential outages of critical components for the Gateway.
15+
16+
### CDN Mirror for High Availability
17+
18+
We now operate a second CDN mirror, `cdn-mirror.graphql-hive.com`, built on AWS CloudFront. This
19+
mirror serves as a complete replica of our primary Cloudflare-based CDN. In the event of an outage
20+
with our main CDN, you can seamlessly switch to the mirror, ensuring your schemas and artifacts
21+
remain available.
22+
23+
Our official SDKs have been updated to automatically handle this fallback when configured with both
24+
endpoints.
25+
26+
### Circuit Breaker for Usage Reporting and CDN requests
27+
28+
Failures are inevitable. To gracefully handle transient issues with our usage reporting service,
29+
we've implemented a Circuit Breaker pattern in our Hive SDKs and the Hive Gateway.
30+
31+
If the client detects a series of failed requests to any origin, it will temporarily stop sending
32+
new request to that origin. This prevents your gateway or service from being overwhelmed with
33+
failing requests and allows it to run stable even if an outage on the CDN or usage reporting occurs.
34+
35+
### Conclusion
36+
37+
These improvements are now available for the Hive JS SDK and JavaScript Hive Gateway. We will soon
38+
also ship these improvements for the Hive Rust SDK, Hive Router and the Apollo Router Hive Plugin.
39+
40+
Please upgrade to the following versions, and adjust your configuration to use the dual CDN.
41+
42+
- Hive Gateway
43+
[`v2.1.22`](https://github.com/graphql-hive/gateway/releases/tag/release-1764767579837)
44+
- [`@graphql-hive/yoga@0.46.0`](https://github.com/graphql-hive/console/releases/tag/%40graphql-hive%2Fyoga%400.46.0)
45+
- [`@graphql-hive/core@0.18.0`](https://github.com/graphql-hive/console/releases/tag/%40graphql-hive%2Fcore%400.18.0)
46+
- [`@graphql-hive/apollo@0.45.0`](https://github.com/graphql-hive/console/releases/tag/%40graphql-hive%2Fapollo%400.45.0)
47+
48+
These updates are part of our ongoing commitment to providing a highly available and reliable schema
49+
registry for your GraphQL APIs.
50+
51+
---
52+
53+
**Further reading:**
54+
55+
- [Running with Hive Console in Production: A High-Availability Guide](/docs/schema-registry/high-availability-resilence)
56+
- [CDN Documentation](/docs/schema-registry/high-availability-cdn)
57+
- [Hive Client Configuration (including Circuit Breaker)](/docs/api-reference/client#circuitbreaker)

packages/web/docs/src/content/api-reference/_meta.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
export default {
22
'graphql-api': 'Public GraphQL API',
33
cli: 'Hive CLI',
4-
client: 'Hive Client Configuration',
4+
client: 'Hive JavaScript Client',
5+
'ruby-client': 'Hive Ruby Client',
6+
'php-client': 'Hive PHP Client',
7+
'rust-client': 'Hive Rust Client',
58
'gateway-cli': 'Hive Gateway CLI',
69
'gateway-config': 'Hive Gateway Configuration',
710
'link-specifications': 'Hive GraphQL Link Spec',

0 commit comments

Comments
 (0)