Summary
Athena renders the widgets of our partner sites (rankings, brand cards, bonuses, call-to-action buttons, match previews) inside Cloudflare Workers, with its data held in Cloudflare Workers KV. A Workers or KV incident therefore removes widgets from every site at once, and there is no fallback today.
This proof of concept runs the unmodified Athena production code on Google Cloud, using workerd, the open-source runtime behind Cloudflare Workers. Cloudflare remains in front for DNS, TLS and edge security, and keeps serving images through Cloudflare Images. Everything related to Workers moves to infrastructure we operate.
- Athena master, unmodified
- 117 widgets, 54 types
- 8 live Umbrella syncs
- 2 Sanity webhooks
- 51/51 images via Cloudflare Images
- 0 production writes
Scope
The POC answers one question: can the Athena Workers run outside Cloudflare, with the same code and the same output, without depending on Cloudflare KV for their data?
- In scope: the four Athena gateways, the widgets, tracking links and asset Workers, the Umbrella sync Worker (
tracking-links-cron), the Sanity sync Worker (external-endpoint), KV-backed data. - Out of scope: moving DNS, TLS, WAF or image storage (Cloudflare Images) off Cloudflare, changes to the Athena repository, production traffic.
- Environment: GCP project
nextwork-staging, zoneeurope-west1-b. One edge VM (e2-standard-2) and one control VM (e2-medium).
Architecture
Two virtual machines. The edge VM serves traffic and renders widgets; the control VM owns the primary copy of the data and keeps it current.
| Component | Host | Role |
|---|---|---|
| nginx | edge VM | Origin TLS endpoint behind the Cloudflare proxy; restores the client IP from Cloudflare ranges. Balances the two workerd processes, caps concurrent renders at 30 and serves the origin page without widgets when overloaded. |
| workerd | edge VM | Runs the Athena production bundles, one process per vCPU. Bindings are generated from the production wrangler.toml. |
| Entry Worker | edge VM | Rebuilds request.cf (country, region, city, timezone) from Cloudflare headers so Athena sees the same request object as in production. |
| Egress guard | both VMs | workerd globalOutbound Worker. Maps site domains to their origins and rejects any write towards production systems. |
| KV adapter | both VMs | Same interface as Workers KV (get, list, put, delete, bulk get), backed by Redis. Compiled Go binary on the edge. |
| Redis | both VMs | Primary on the control VM; read-only replica plus a local writable cache on the edge. |
| Umbrella sync | control VM | Production tracking-links-cron in workerd, triggered by 8 systemd timers at the production intervals. |
| Sanity sync | control VM | Production external-endpoint in workerd, fed by two Sanity webhooks that mirror the production ones. Uses a read-only (Viewer) Sanity token. |
| Webhook receiver | control VM | nginx and an entry Worker that verify Sanity's HMAC signature before any delivery reaches external-endpoint. Only the two webhook routes are exposed. |
| D1 stand-in | control VM | Read-only copy of the 27-row sanityConfig table (Sanity type to KV namespace, key and GROQ query), exported once from production. |
| Widget cache purge | edge VM | Empties the POC widget cache within seconds of each Sanity delivery, signalled from the control VM through Redis replication. POC-only rule. |
Request path
- dnsResolutionCloudflare DNS, unchanged. The hostname is proxied.
- cloudflareEdge securityTLS termination, WAF and DDoS protection,
CF-IPCountryheader. No Worker route is attached to the hostname. - nginxEdge VMAccepts public traffic from Cloudflare IP ranges only and forwards it to workerd.
- entryRequest contextThe entry Worker attaches the
cfobject, then hands the request to the Athena gateway through a service binding. - gatewayAthena gatewayFetches the raw page from the site origin and streams it through HTMLRewriter, replacing each
<bw-widget>tag with server-rendered markup. - dataData accessKV reads resolve to the Redis replica on the same VM; writes go to the local cache. Images are served by Cloudflare Images, as in production.
- responseDeliveryThe completed page returns to the visitor through Cloudflare.
The trace line under each page title shows which of these hops served the page, read from its response headers.
Data sources
Cloudflare KV is an intermediate store. Every dataset has an upstream source outside Cloudflare, which the POC reads directly where possible.
| Dataset | System of record | POC status |
|---|---|---|
| Rankings, brands, bonuses, tracking links, payment methods, game providers, website configurations | Umbrella GraphQL API (GCP) | Live, every 10 to 30 min |
| Site configuration, translations, compliance, matches, banners | Sanity | Live via webhooks, confirmed 19 Nov |
| Images and logos | Cloudflare Images (uploaded from Sanity by production) | Unchanged, served by Cloudflare Images |
| Sports odds | Odds providers | Seed copy of 17 Nov |
Tracking links missing from KV (/go) | Vulcan tracking-links API (Cloud Run, GCP) | Looked up on demand, as in production |
| Widget and page caches | Computed by Athena | Rebuilt locally |
Sanity content follows the production mechanism. Each published change triggers one of two webhooks, filtered exactly like the production ones. The receiving code re-reads the changed document with its production GROQ query and rebuilds the documents that reference it. There is no polling: Sanity API usage is proportional to edits, and zero when nothing changes.
Athena caches each rendered widget, for 30 minutes in most cases. The cache does not record which documents a widget was built from, so production cannot invalidate it selectively: a Sanity edit takes up to 30 minutes to reach the sites. The POC empties its whole widget cache within seconds of each delivery, which is practical at POC scale (about 100 widgets) but not in production.
Rationale
- Resilience. Removes the single point of failure on Cloudflare Workers and KV, and provides a failover target per domain.
- No rewrite. The same bundles run in both environments, so rendered output and business rules stay identical and there is a single codebase to maintain.
- Cost control. Workers and KV are billed per request, at roughly 1.7 billion requests per month. VMs are a fixed cost. A full cost model is part of the next phase. Images stay on Cloudflare Images.
- Incremental adoption. Cloudflare keeps DNS, TLS and security. Only widget rendering moves, domain by domain, with immediate rollback by restoring the Worker route.
Cloudflare services
| Service | Current use | In the POC |
|---|---|---|
| Workers | Widget rendering, click redirects | Replaced by workerd on GCE |
| Workers KV | Widget data | Replaced by Redis, behind an adapter with the same interface as Workers KV |
| Cloudflare Images | Logo storage and resizing | Retained |
| D1 | Sanity-to-KV mapping (sanityConfig) | Replaced by a read-only copy |
| Queues, Durable Objects, Analytics Engine | Logging, counters, background jobs | Sunk locally; GCP equivalents to define |
| DNS | Name resolution | Retained |
| Proxy and TLS | Edge termination | Retained |
| WAF and DDoS protection | Edge security | Retained |
| Static asset cache | Performance | Retained |
Image delivery: Sanity CDN evaluated, not adopted
Images stay on Cloudflare Images. The Sanity CDN was evaluated as an alternative; the measured comparison is kept for reference.
| Option | Billing model | Measured volume (30 days) | Estimate |
|---|---|---|---|
| Cloudflare Images | $1 per 100,000 images delivered, plus $5 per 100,000 images stored | 55.6M deliveries | up to $556 / month + storage |
| Sanity CDN | 100 GB included (Growth plan), then $0.30 per GB | ≈ 210 GB at 3.8 KB average | ≈ $33 / month |
List prices from the Cloudflare and Sanity documentation (19 Nov 2026). The Sanity estimate assumes every request reaches Sanity; the Cloudflare cache in front of the site domains serves repeat requests. Break-even, calculated from the two list prices: Sanity costs more only above an average of about 33 KB per image, or 35 KB counting the 100 GB included.
A further option is to reduce Cloudflare to DNS only, with TLS and edge security provided on Google Cloud. It is a separate decision, covered in the report.
Production safety
The POC reads production data and never writes to production. This is enforced at the network layer, not by convention.
- All outbound traffic from workerd goes through the egress guard. On the control VM, only Umbrella GraphQL queries are allowed. On the edge VM, the Cloudflare API, Sanity mutations, GraphQL mutations and outbound e-mail are rejected.
- Validated against 10 test cases, write attempts included: 10 passed.
- In operation, no request has been blocked: the Athena code does not attempt production writes. The counter is published on the dashboard.
- Sanity is accessed with a Viewer (read-only) token. Webhook deliveries without a valid signature are rejected. The production monthly cleanup jobs, which delete Sanity documents, are never scheduled by the POC.
- Logs, click counters and analytics events stay on the VMs.
/goclicks are not reported to production; only links missing from KV are looked up from the Vulcan tracking-links API, a read.
Resources created outside the staging project, for testing only: the Cloudflare Pages project athena-poc-test, the DNS records poc-athena.umbrella-showcase.com and poc-sanity-hook.umbrella-showcase.com, and two Sanity webhooks.
Results
| Objective | Status |
|---|---|
| Athena production bundles run on workerd without code changes | Validated |
| Widgets rendered end to end through Cloudflare and the edge VM | 117 widgets, 54 types |
| Umbrella data refreshed without Cloudflare KV | 8 syncs at production intervals |
| Images served through the POC path | 51 of 51, from Cloudflare Images |
| No writes to production systems | 0 blocked, 10 of 10 guard tests |
| Sanity-to-KV mapping served without Cloudflare D1 | Validated, 27 types |
| Sanity content refreshed without Cloudflare KV | Confirmed on 19 Nov, both webhooks |
A standalone demo website shows the result as a visitor sees it: an ordinary site, hosted on its own Cloudflare Pages project, whose widgets are all rendered by the POC.
See the widget catalogue for every rendered widget, and the dashboard for live health and data freshness.
Load test
One edge VM with 2 vCPUs serves 12 pages per second carrying 50 widgets each. When overloaded, it serves the site's own page without widgets instead of making visitors wait.
Method: test pages with 30 and 50 real widgets (a 50-widget page is about 800 KB of HTML), loaded from the control VM over HTTPS on the internal network, 30 seconds per scenario, widget cache warm. Rendering calls neither Umbrella nor Cloudflare Images, so production was not loaded.
| Scenario | Before optimisation | After optimisation |
|---|---|---|
| 30 widgets, 10 connections | 13.0 pages/s, median 0.73 s | 19.0 pages/s, median 0.51 s |
| 50 widgets, 10 connections | 8.4 pages/s, median 1.16 s | 12.0 pages/s, median 0.80 s |
| 50 widgets, 25 connections | 8.0 pages/s, median 2.77 s | 12.0 pages/s, median 1.89 s |
| 50 widgets, 80 connections (overload) | about 6 s per page | 216 responses/s, median 0.27 s, 0 errors |
/go click links, 10 connections | not measured | 251 redirects/s, median 39 ms |
The optimisations: a compiled KV adapter (its share of CPU fell from 31% to 13.5%), one workerd process per vCPU, and an nginx cap of 30 concurrent renders with a fallback to the origin page. In the overload run, 184 pages were fully rendered and 6,293 were served without widgets. The /go test rotated through 31 real links taken from the widgets: 30 of them resolved from KV; calls to the production Vulcan API were blocked for the duration of the test so that it was not loaded.
Production traffic and sizing
| Gateway traffic, last 7 days | Requests per second |
|---|---|
| Median hour | 348 |
| 95% of hours | 578 |
| Normal peak | 615 |
| Burst, 12 Nov 11:00 to 13:00 UTC | up to 12,329 |
At about 600 pages per second, a fleet of roughly 50 such VMs would be needed if every page carried 50 widgets (75 before the optimisations). Real pages carry fewer widgets on average, and a short cache of finished pages would cut the need further; both remain to be measured. A burst like 12 November is absorbed by degrading and by Cloudflare rate limiting, not by standing capacity. Source: Cloudflare Workers analytics.
Limitations and next steps
Not yet demonstrated
- Output parity with production on high-traffic sites, page by page.
- Capacity at production scale: one edge VM serves 12 pages/s with 50 widgets, so the normal peak needs a fleet with autoscaling.
- Selective widget-cache invalidation usable in production: requires a change in the Athena code.
- Automatic refresh of sports odds.
- Images still depend on Cloudflare Images. During a Workers outage, production stops copying new Sanity images to Cloudflare Images; they appear once production recovers.
- Umbrella load: the POC polls Umbrella in parallel with production, at the same intervals, which doubles the sync load during the POC.
- Running cost compared with the current Cloudflare invoice.
Next steps
- Connect sports odds.
- Propose selective widget-cache invalidation on Sanity updates to the Athena team.
- Compare POC and production output on a sample of real sites.
- Measure the average number of widgets per page on real sites, add a short finished-page cache, then produce a cost model with autoscaling.
- Decide on the target: standby failover, or progressive migration by domain.
Internal page, not indexed. Updated 19 November 2026.