Documentation Schedule a pilot

Workers

Cloudflare Workers executes customer code in V8 isolates on the Cloudflare network, with bindings to storage, database, queue and inference services. This page documents the execution model, the binding model, the platform limits that constrain design, and pricing as published.

Document control

Dana, technical writer at Integrity
Dana
Technical writer, Integrity Czech Republic s.r.o.

Document control. Vendor: Cloudflare, Inc. Document owner: Dana, technical writer, Integrity Czech Republic s.r.o. Last reviewed: 2026-08-31. Content snapshot of the referenced Cloudflare documentation: 2026-08-28. Figures in this document were verified against the sources listed under References on the dates shown there; Cloudflare changes limits and packaging without notice, so verify at the source before you design against a value.

Overview

Workers is Cloudflare's serverless compute platform. Code is deployed to the network rather than to a region, and an invocation is handled at the data centre that received the request. There are no instances to size and no runtime to patch, but the platform imposes explicit CPU, memory, subrequest and script size limits that shape what can be built on it. Those limits are documented in the Limits and constraints section and should be read before design, not after.

Two usage patterns are common. The first places a Worker in front of an existing origin to handle routing, header manipulation, authentication, personalisation or caching logic, leaving the application where it is. The second builds an application entirely on the platform, using its storage and database services with no conventional origin server.

Scaling is handled by the platform in the sense that no capacity is provisioned per deployment. It is not unbounded: per-invocation CPU time, memory, subrequest counts and per-service quotas apply, and account-level concurrency controls exist. Design against the documented limits rather than against an assumption of unlimited scale.

Architecture

A Worker runs in a V8 isolate rather than in a container or virtual machine. An isolate is a sandboxed JavaScript execution context; many isolates are hosted per process, and starting one is substantially cheaper than starting a container image. This is the basis for the platform's start-up characteristics and for the economics of deploying the same code to every location.

Start-up is not free in all cases. Cold start time depends on script size, on the amount of work performed at module scope, and on whether a WebAssembly module must be instantiated. Large bundles and heavy initialisation produce measurable cold starts.

The execution environment implements web platform APIs: fetch, Request and Response, URL, Web Crypto, streams, WebSocket and a subset of Node.js APIs enabled through the nodejs_compat compatibility flag. Runtime behaviour is pinned by a compatibility date and by compatibility flags declared in the Worker configuration, which is how the platform introduces behavioural changes without breaking deployed code.

Bindings connect a Worker to platform resources. A binding is declared in configuration and injected into the environment object at runtime, so a KV namespace, an R2 bucket, a D1 database, a queue, a Durable Object namespace, an AI model or another Worker is addressed as a capability rather than through a connection string or an embedded credential.

Deployment through the Wrangler CLI publishes a new version. Gradual deployments route a configured percentage of traffic to a new version, which means that during a gradual deployment two versions serve concurrently. Deployment is therefore not atomic in that mode, and code must tolerate both versions running against the same data.

In the Cloudflare request pipeline, security phases execute before a Worker is invoked, so a request blocked by the WAF or by a DDoS rule does not reach Worker code.

Capabilities

CapabilityBehaviourStatus and tierSource
JavaScript and TypeScript runtimePrimary supported runtime, executing in V8 isolates against web platform APIs.Generally available.Runtime APIs
WebAssemblyModules compiled from Rust, C, C++ and other languages, invoked from a JavaScript entry point.Generally available.WebAssembly
Python WorkersPython entry points executing on the platform.Open beta. Requires the python_workers compatibility flag. Not appropriate for a workload that needs a stability commitment.Python Workers
Workers KVEventually consistent global key-value store optimised for high read volume.Generally available.Workers KV
R2Object storage with an S3-compatible API and no egress charge to the internet.Generally available.R2
D1Serverless SQL database built on SQLite.Generally available.D1
Durable ObjectsSingle-instance stateful objects providing strong consistency, transactional storage and WebSocket coordination.Generally available.Durable Objects
Queues, Cron Triggers, WorkflowsAsynchronous message processing, scheduled invocation and durable multi-step execution.Verify individual feature status at the source before relying on it.Queues
Workers AI and VectorizeInference against hosted models, and vector index storage and search.Model and feature status varies; some are in beta. Verify per model.Workers AI
Static assets and WranglerStatic asset hosting for full-stack applications; local development, versioning, gradual deployments and observability through the Wrangler CLI.Generally available.Wrangler

Configuration model

A Worker is defined by its code and its configuration file, wrangler.jsonc or wrangler.toml. The configuration declares:

Storage choice is the main architectural decision and follows the consistency and access pattern required: KV for high-volume reads of data that tolerates eventual consistency, D1 for relational queries, R2 for objects, Durable Objects where strong consistency or per-entity coordination is required, and Queues where work should be decoupled from the request.

Hold the configuration in version control alongside the code, since bindings and compatibility settings determine runtime behaviour as much as the source does.

Limits and constraints

Values below are from Cloudflare's platform limits documentation, verified 2026-08-31 (https://developers.cloudflare.com/workers/platform/limits/). They change without notice and should be re-checked before a design depends on them.

LimitFreePaid
Requests100,000 per day, 1,000 per minuteBilled per request, no daily cap
CPU time per invocation10 ms30 s default, configurable up to 5 minutes
Memory per isolate128 MB128 MB
Worker size after compression3 MB10 MB
Subrequests per invocation5010,000
Subrequests to internal services per invocation, such as KV, R2 and D11,000Matches the configured limit, default 10,000
Simultaneous outbound connections66
Environment variables per Worker64128
Cron Trigger CPU time10 ms30 s for intervals under 1 hour; 15 minutes for intervals of 1 hour or more

A subrequest is any request the Worker makes with the Fetch API or to a Cloudflare service through a binding, so fetch calls and binding calls consume the same per-invocation budget.

Storage service constraints, retrieved 2026-08-28:

Further constraints:

Plan availability

TierIncluded
Free100,000 requests per day, 10 ms CPU per invocation, 3 MB compressed Worker size, 50 subrequests per invocation, with separate free allowances on KV, D1 and R2.
Workers PaidCloudflare states a minimum of 5 US dollars per month, including 10 million requests and 30 million CPU milliseconds per month, with usage beyond those amounts billed per request and per CPU millisecond. Raises CPU time to 30 seconds by default, Worker size to 10 MB and HTTP subrequests to 10,000.
Platform servicesKV, R2, D1, Durable Objects, Queues, Vectorize and Workers AI are metered separately from Workers requests, each with its own free allowance and unit pricing. R2 charges no egress fee to the internet.
EnterpriseContractual terms, committed usage and support arrangements.

Accurate as of 2026-08-28 against Cloudflare public pricing documentation (https://developers.cloudflare.com/workers/platform/pricing/). Prices, included amounts and limits change without notice. Model cost against the per-service pricing pages for every service in the design, not against the Workers request price alone.

Deployment

Prerequisites.

Staged validation. Implement the workload against a staging environment with its own bindings and its own data, and exercise it with representative traffic. Measure CPU time per invocation, memory use and subrequest count against the tier limits, and measure cold start behaviour with the production bundle size rather than a trimmed one. Confirm that observability output reaches the intended destination before any production traffic is routed.

Configuration.

  1. Declare bindings and set the compatibility date explicitly; do not rely on a default.
  2. Move all credentials to Worker secrets, and confirm none remain in the repository or the configuration file.
  3. Configure separate staging and production environments with distinct storage resources, so a deployment error cannot write to production data.
  4. Set up CI so that deployment is performed by the pipeline with a scoped API token, not from a developer workstation.
  5. Add rate limiting in front of publicly reachable Worker routes, and add caching where the response permits it, so that request volume and therefore cost are bounded.
  6. Model cost against expected traffic using the per-service pricing pages, including storage operation classes, and set billing alerts.

Cutover. Route production traffic progressively using gradual deployments or a route covering a subset of paths. Because two versions serve concurrently during a gradual deployment, verify that the new version is compatible with data written by the previous one, and with data the previous one will continue to write during the rollout.

Verification.

Rollback. Revert traffic to the previous version through the deployment interface, or remove the route so requests reach the origin directly. Keep the previous version deployed rather than deleted until the new version has run through a full traffic cycle. Where a schema or data format changed, verify that the previous version can still read data written by the new one before rolling back.

Operational considerations

Instrument CPU time, error rate and subrequest counts per route, not only request volume. Limit-related failures appear under load and are invisible in a low-traffic staging environment.

Keep the compatibility date under review. Leaving it fixed indefinitely means the Worker runs against increasingly old runtime behaviour; advancing it without testing changes behaviour. Treat an advance as a change with its own validation.

Watch storage operation counts alongside request counts. A design that performs several KV or D1 operations per request has a cost profile driven by those operations, and a caching change can alter the bill substantially in either direction.

Rotate Worker secrets on a schedule and hold them only in the platform secret store. Because bindings replace connection strings, a leaked secret is usually an application credential rather than a platform one, but the rotation obligation is the same.

Design Durable Object keys so that load distributes across objects. A single object handling a disproportionate share of traffic becomes a throughput ceiling that no amount of platform scaling addresses.

Failure modes to plan for: a dependency upgrade pushing the bundle past the size limit, a code path that occasionally exceeds the CPU limit for large inputs, KV write contention on a single key, an upstream service that is slow enough to hold subrequests open, and a gradual deployment left partially rolled out.

Known caveats

Interoperability

Workers execute after the security phases of the Cloudflare request pipeline, so WAF, DDoS and Bot Management decisions are applied before Worker code runs. A blocked request never reaches a Worker.

Workers interact with the CDN through the Cache API and through Cache Rules. Where both a Cache Rule and Worker cache logic act on the same request, the documented traffic sequence determines precedence.

R2 can serve as an origin for the CDN and backs Cache Reserve, so object storage, caching and compute compose without a conventional origin server.

Service bindings allow one Worker to invoke another without a network round trip, which supports splitting an application into separately deployed units while keeping call latency low.

Turnstile validation can be performed from a Worker, allowing challenge verification at the edge rather than in the application backend.

Access can be placed in front of a Worker route so that requests are authenticated and authorised before invocation, without the Worker implementing authentication itself.

FAQ

Is a full application migration required to adopt Workers? No. A common adoption path places a Worker on a route in front of an existing origin to handle redirects, caching logic, authentication or personalisation, while the application remains where it is. Migration of the application itself is a separate decision.

What does the CPU limit actually measure? Time spent executing code, not total request duration. Awaiting a subrequest does not consume CPU time, so a request may last longer than the CPU limit without exceeding it.

Which storage service should hold session or coordination state? Durable Objects, where strong consistency or per-entity coordination is required. KV is eventually consistent and rate limited per key, which makes it unsuitable for rapidly mutating single-key state.

Which parts of a Workers application are portable to another platform? Code written against web standard APIs, data in R2 through the S3-compatible API, and D1 schemas and queries in SQLite's dialect are largely portable. Durable Objects and other platform-specific services require re-architecture.

References

Content snapshot: 2026-08-28.

Changelog

DateChangeAuthor
2026-08-31Rewritten as a technical reference. Added limits and plan availability tables with sources.Integrity documentation team
2026-08-28Initial publication.Integrity documentation team

Contents

464 pages mirrored from the Cloudflare documentation for workers.

Pages

Best practices

Workers Cache

CI/CD

Configuration

Databases

Demos and architectures

Examples

Framework guides

Getting started

Languages

Local development

Observability

Platform

Reference

Runtime APIs

Static Assets

Testing

Tutorials

Versions & deployments

Vite plugin

Wrangler

Request your free pilot

Schedule a pilot