# Cloudflare Edge Compute
−Run code at the network edge — closer to users, lower latency, globally distributed by default. This document gives operational guidance for Cloudflare Workers (including Durable Objects and SQLite-backed storage) and summarizes recent platform signals you must test for (Gen 13 servers, FL2 stack, and SQLite storage billing).
+Run code at the network edge — closer to users, lower latency, globally distributed by default. This document gives operational guidance for Cloudflare Workers (including Durable Objects and SQLite-backed storage) and summarizes recent platform signals you must test for (Gen 13 / FL2 and Durable Objects SQLite billing).
## When to use
@@ −19 +19 @@
- Anything that needs persistent TCP connections to databases without connection pooling
- Large batch jobs, queue consumers, or unbounded background workers (use dedicated serverless/VMs or Cloudflare Workers with Durable Objects carefully)
- Tasks requiring filesystem access or native binaries
+- Relying on FinalizationRegistry or WeakRef for critical cleanup. Cloudflare added FinalizationRegistry to Workers but explicitly warns against depending on it in production — prefer deterministic cleanup and explicit resource management (see FinalizationRegistry guidance below).
## Core concepts
@@ −28 +29 @@
### Runtime differences and limits
+- Cloudflare Workers (V8 isolate): typical max wall time 30 s (paid); response body limit 100 MB; keep subrequest fan-out modest (<10) where possible. V8 runtime receives periodic updates; use compatibility dates/flags to opt into behavior changes (see Compatibility dates below).
−- Cloudflare Workers (V8 isolate): typical max wall time 30 s (paid); response body limit 100 MB; subrequest guidance: keep fan-out low (<10) where possible. V8 runtime receives periodic updates; use compatibility dates/flags to opt into behavior changes (see Compatibility dates below).
+- Storage: KV, R2, D1, Durable Objects (SQLite-backed Durable Objects are GA and incur storage billing for paid plans beyond included limits — monitor usage).
−- Storage: KV, R2, D1, Durable Objects (SQLite-backed Durable Objects are GA and provide larger persistent options — monitor SQLite storage usage to avoid unexpected billing).
+Notes and hard signals (select):
+- Gen 13 servers + FL2 (Cloudflare, 2026-03-23): Cloudflare launched Gen 13 servers based on AMD EPYC Turin CPUs and deployed a Rust-based FL2 request stack to remove cache dependence and increase edge compute throughput. Test for higher per-PoP concurrency and rebenchmark latency-sensitive code paths (https://blog.cloudflare.com/gen13-launch/).
+- SQLite-backed Durable Objects billing (Cloudflare Changelog, 2025-12-12): storage billing for SQLite-backed Durable Objects was announced with a target date of January 7, 2026; Workers Free plan accounts are not charged. Monitor SQLite storage and follow the Durable Objects pricing page for limits and rates (https://developers.cloudflare.com/changelog/post/2025-12-12-durable-objects-sqlite-storage-billing/).
+- FinalizationRegistry available but discouraged (Cloudflare Blog, 2025-06-11): Cloudflare enabled the FinalizationRegistry API in Workers but published guidance warning developers not to rely on it for deterministic resource cleanup due to unpredictability in garbage collection timing in constrained environments. Prefer explicit cleanup APIs and resource lifetime management (https://blog.cloudflare.com/we-shipped-finalizationregistry-in-workers-why-you-should-never-use-it/).
−Notes and hard signals:
+- Compatibility dates & flags: Cloudflare uses a compatibility_date to gate backwards-incompatible runtime fixes. Set and test compatibility_date in Wrangler or the dashboard before upgrading (https://developers.cloudflare.com/workers/configuration/compatibility-dates/).
−- Gen 13 servers + FL2 stack (Cloudflare, Mar 23, 2026): Cloudflare shipped Gen 13 servers and a new Rust-based FL2 request stack to optimize for core density and increase edge compute throughput (https://blog.cloudflare.com/gen13-launch/). Test your Workers under higher concurrency assumptions and measure tail latency; workloads sensitive to per-core cache locality should be validated against Gen 13.
−- SQLite-backed Durable Objects billing (Dec 12, 2025 announcement; billing target in Jan 2026): Storage billing for SQLite-backed Durable Objects was enabled with a target date in January 2026. Monitor Durable Objects’ SQLite storage usage in the dashboard and follow pricing/limits in the Durable Objects docs (https://developers.cloudflare.com/changelog/post/2025-12-12-durable-objects-sqlite-storage-billing/).
−- Compatibility dates & flags: Cloudflare uses a compatibility date to gate backwards-incompatible runtime fixes. Set and occasionally update the compatibility_date in Wrangler or the dashboard and test thoroughly before deploying (https://developers.cloudflare.com/workers/configuration/compatibility-dates/).
### Request lifecycle
@@ −48 +50 @@
1) Scaffold
−```bash
npm create cloudflare@latest my-worker -- --template=javascript
cd my-worker
−```
2) wrangler.toml (set compatibility_date)
−```toml
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2026-04-01" # set to the current date for access to latest runtime features; test before upgrading
−```
−3) Minimal worker handler
+3) Minimal worker handler (TypeScript)
−```typescript
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const url = new URL(request.url);
@@ −80 +77 @@
return new Response(body, { headers: { "X-Cache": "MISS" } });
}
};
−```
4) Deploy
−```bash
npx wrangler deploy
−```
## Durable Objects & SQLite-backed DOs (operational guidance)
- SQLite-backed Durable Objects are GA and provide a transactional local DB per object. They are useful for coordination, leader election, materialized views, and small datasets with complex queries.
+- Billing: Storage billing for SQLite-backed Durable Objects was announced (Dec 12, 2025) and enabled with a target date of January 7, 2026. Developers on Workers Paid plans with usage beyond included limits will incur charges; Free plan customers are not charged. Monitor usage in the Durable Objects page in the dashboard and optimize or delete unused data ahead of billing windows (https://developers.cloudflare.com/changelog/post/2025-12-12-durable-objects-sqlite-storage-billing/).
+- Size & limits: consult the Durable Objects pricing and limits page. For large blobs, prefer R2; for SQL workloads that need global availability, consider D1 or managed external DBs.
−- Billing: SQLite storage billing was announced (Dec 12, 2025) and enabled in January 2026. Free-tier accounts are not charged; paid plans should monitor storage usage and optimize or delete unused data ahead of billing windows (https://developers.cloudflare.com/changelog/post/2025-12-12-durable-objects-sqlite-storage-billing/).
+- Migration tips: when moving from in-memory patterns to SQLite-backed DOs, provide a migration path that exports current state to the DO, validate under load, and measure both request latency and storage billing impact.
−- Size & limits: refer to the Durable Objects pricing and limits page. For large blobs, prefer R2; for SQL workloads that need global availability, consider D1 or external managed DBs.
−- Migration tips: to move from in-memory patterns to SQLite-backed DOs, add a migration path that exports current state to the new DO and validate under load; measure request latency and compute billing (DO compute and storage charges are separate).
−## Testing & performance guidance (Gen 13/FL2 specifically)
+## Testing & performance guidance (Gen 13 / FL2 specifically)
- Assume higher per-PoP concurrency — run load tests that increase concurrent requests per PoP and measure tail latency (p95/p99).
+- For workloads that previously relied on L3 cache locality, benchmark on Gen 13 hardware assumptions: FL2 was designed to remove cache dependence, but verify hot-path latency.
+- Watch CPU-bound tasks: Gen 13 increases available cores and may change optimal concurrency; re-evaluate rate-limiting and backpressure.
−- If your workload previously relied on L3 cache locality, benchmark on Gen 13 hardware assumptions: FL2 was designed to remove cache dependence; still validate hot-path latency.
+- Subrequests and fan-out: keep subrequests modest; aggressive fan-out under higher concurrency increases the chance of hitting subrequest or connection limits.
−- Watch CPU-bound tasks: Gen 13 increases available cores, which may make previously rejected concurrency patterns feasible — but billing and per-invocation limits still apply.
−- Subrequests and fan-out: keep subrequests modest; more aggressive fan-out under higher concurrency increases the chance of running into subrequest or connection limits.