Skip to content

perf(worker): shut down public previews and trim detail loads#657

Merged
tiankaima merged 1 commit into
mainfrom
agent/worker-cpu-performance-audit
Jul 25, 2026
Merged

perf(worker): shut down public previews and trim detail loads#657
tiankaima merged 1 commit into
mainfrom
agent/worker-cpu-performance-audit

Conversation

@tiankaima

Copy link
Copy Markdown
Member

Goal

Cut Worker CPU by removing the public preview ingress that bypasses the zone WAF, then trim unused work from catalog detail requests. In a fixed production two-hour baseline, stale version and branch aliases produced 95.82% of requests and 98.75% of Worker CPU; the active production version used only 1.25% of total CPU.

Changed Surfaces

  • Disable public workers.dev, version, and alias preview URLs while retaining the production custom domain.
  • Disable automatic invocation logs that retain raw request metadata; keep sampled custom logs and traces.
  • Normalize every direct calendar-feed credential segment in API observability paths.
  • Remove unused comment counts and latest-comment queries from course, teacher, and section detail loaders.
  • Disable SvelteKit hover data preloads on detail tab navigation.
  • Add direct loader, config, path-normalization, and browser regression coverage.

Evidence

  • Production Workers Analytics baseline: 22,275 requests and 4,428.0 CPU seconds over two hours; stale preview aliases accounted for 4,372.5 CPU seconds.
  • Canonical checks passed: Biome, Svelte check with 0 errors and 0 warnings, three TypeScript projects, and Vitest with 1,530 tests.
  • Fresh isolated database verification passed: 49 migrations, seed, and integration suite with 239 passed and 13 skipped.
  • Full Playwright suite passed: 750 passed, 1 skipped, 0 failed.
  • Production build and Wrangler deploy dry run passed.

Docs / Contracts

README and observability documentation now describe disabled public preview routing and automatic invocation logs. Public REST, GraphQL, and MCP contracts are unchanged.

Risk Areas

  • Online PR/version preview URLs intentionally become inaccessible; non-production builds still upload versions for build validation.
  • The production custom domain and routes remain enabled.
  • Automatic invocation logs become unavailable, but privacy-safe custom logs, traces, and Workers Analytics remain enabled.
  • No Prisma schema, migration, authentication, API, or data-shape change.

Cleanup

The isolated test databases and ignored build/browser artifacts were removed. The worktree contains only the committed changes.

Disable workers.dev preview routing that accounts for most production CPU, keep raw invocation metadata out of observability logs, and remove unused detail-page comment queries and hover preloads.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
life-ustc 6794fd8 Commit Preview URL

Branch Preview URL
Jul 25 2026, 10:23 PM

@github-actions

Copy link
Copy Markdown

@tiankaima
tiankaima merged commit 4c1ed61 into main Jul 25, 2026
15 checks passed
@tiankaima
tiankaima deleted the agent/worker-cpu-performance-audit branch July 25, 2026 22:35
github-actions Bot pushed a commit that referenced this pull request Jul 25, 2026
## [1.77.16](v1.77.15...v1.77.16) (2026-07-25)

### Performance Improvements

* **worker:** shut down public previews and trim detail loads ([#657](#657)) ([4c1ed61](4c1ed61))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.77.16 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant