Skip to main content

Cloudflare Workers 5-Minute CPU Limit Migration Fix Log

Cloudflare Workers Paid plan 5-minute CPU limit migration: wrangler cpu_ms config, $0.02 per million CPU ms pricing, and break-even thresholds vs containers.

CLOUD & GPU Field Fix Log
Run Workers for up to 5 minutes of CPU-time · Changelog
Run Workers for up to 5 minutes of CPU-time · Changelog Source: developers.cloudflare.com
Field Note · The Short Version 4 min read

Cloudflare Workers Paid plan supports up to 300,000 ms CPU time per request via wrangler cpu_ms, with $0.02 per million CPU ms after 30 million included ms monthly.

Key Numbers & Verified Specs

6 metrics
Metric / Spec Verified Finding Source
Workers Paid CPU time limit per HTTP request 5 minutes (300,000 ms), default 30 seconds developers.cloudflare.com
Workers Paid CPU time billing rate $0.02 per million CPU milliseconds after 30 million included ms monthly developers.cloudflare.com
Workers Paid monthly subscription minimum $5.00 USD per month developers.cloudflare.com
Workers Paid subrequest limit per request 10,000 subrequests developers.cloudflare.com
Workers Paid simultaneous outgoing connections per request 6 connections developers.cloudflare.com
Workers Paid egress charge No charge for data transfer or bandwidth developers.cloudflare.com
Jump to section (4) +

Cost & Platform Limits Table

FeatureWorkers FreeWorkers PaidWorkers Enterprise
CPU time per HTTP request10 ms5 min (default: 30 seconds)5 min (customizable)
CPU time per Cron Trigger10 ms30s (<1h) / 15 min (>=1h)15 min
Memory per isolate128 MB128 MB128 MB
Subrequests per request5010,00010,000+
Simultaneous outgoing connections666
Monthly subscription$0$5.00 minimumContract-based
CPU time billingIncluded$0.02 per million CPU ms after 30M includedContract-based
Requests100,000/dayNo limit (10M included + $0.30 per additional million)Contract-based
Egress / data transferNo chargeNo chargeContract-based
Hourly GPU equivalentN/AN/AN/A

This table anchors the migration decision. The Paid plan raises CPU time from 10 ms to 300,000 ms per request, but the default remains 30 seconds unless you explicitly opt in via wrangler configuration. Cloudflare Workers platform limits document the Error 1102 termination behavior when a Worker consistently exceeds its configured limit. The pricing page confirms zero egress fees and the $5 monthly minimum that includes 30 million CPU ms and 10 million requests Cloudflare Workers pricing.

Measured Bottlenecks & Hidden Billing Traps

I/O-bound workloads often assume network wait time is free. It is, for CPU billing. However, the 128 MB memory ceiling per isolate is unchanged on the Paid plan. Streaming large payloads through TransformStream avoids buffering the full body in memory, but each subrequest still counts against the 10,000 subrequest limit. Six simultaneous outgoing connections per request create connection pool exhaustion under burst concurrency.

The billing trap is subtle: CPU time is billed only when the Worker runs on a cache miss or bypass. Cached responses do not incur CPU charges, but they still count as requests against the 10 million included monthly allotment. Idle compute wakeups are not a separate line item; you pay for actual CPU milliseconds consumed. Per-step Workflows retries consume additional CPU time and request counts, which can silently multiply costs if a retry loop targets a slow external API.

Cold-start behavior adds latency. Workers startup time is 1 second on both Free and Paid plans. A burst of concurrent invocations can exhaust the six-connection limit per request, causing queued subrequests to fail rather than queue.

Production Configuration Snippet

JSONC12 lines
{
  // wrangler.jsonc
  "name": "io-bound-worker",
  "main": "src/index.ts",
  "compatibility_date": "2025-03-25",
  "limits": {
    "cpu_ms": 300000
  },
  "observability": {
    "enabled": true
  }
}
TypeScript18 lines
// src/index.ts
import { createHash } from 'node:crypto';

export default {
  async fetch(request: Request): Promise<Response> {
    const url = new URL(request.url);
    if (url.pathname !== '/hash') {
      return new Response('Not found', { status: 404 });
    }

    const body = await request.arrayBuffer();
    const hash = createHash('sha256').update(body).digest('hex');

    return new Response(hash, {
      headers: { 'content-type': 'text/plain' }
    });
  },
};
Bash5 lines
# curl benchmark measuring CPU time via Workers analytics API
# Replace ACCOUNT_ID, API_TOKEN, and SCRIPT_NAME
curl -X GET "https://api.cloudflare.com/client/v4/accounts/ACCOUNT_ID/workers/scripts/SCRIPT_NAME/analytics" \
  -H "Authorization: Bearer API_TOKEN" \
  -H "Content-Type: application/json" | jq '.result.view[0].cpu_time_ms'
Terraform13 lines
# Terraform snippet for Cloudflare Workers route and zone configuration
resource "cloudflare_worker_script" "io_bound" {
  name     = "io-bound-worker"
  content  = filebase64("dist/worker.js")
  module   = true
  compatibility_date = "2025-03-25"
}

resource "cloudflare_worker_route" "io_bound_route" {
  zone_id = var.zone_id
  pattern = "${var.hostname}/hash*"
  script_name = cloudflare_worker_script.io_bound.name
}

The cpu_ms value of 300000 opts into the full 5-minute CPU budget. Without this key, Workers default to 30 seconds of CPU time even on the Paid plan. Cloudflare's changelog announcement confirms that buggy code protection is the reason for the conservative default.

Migration Checklist & Break-Even Thresholds

  1. Verify current average CPU time per request in Workers analytics. If average is under 30 ms, the Free plan may remain cheaper despite the 10 ms hard limit causing failures on spikes.
  2. Set cpu_ms in wrangler.jsonc to match observed p99 CPU time plus 20% headroom, not automatically 300,000 ms.
  3. Configure a Workers spending limit to block new invocations at a defined dollar threshold.
  4. Test Error 1102 handling by intentionally saturating CPU in a staging Worker.
  5. Audit subrequest counts against the 10,000 limit for I/O-bound fan-out patterns.

Break-even math: At $0.02 per million CPU milliseconds, 30 million included CPU ms covers roughly 4.29 million requests at 7 ms average CPU time (30,000,000 / 7 = 4,285,714). Beyond that, each additional million CPU ms costs $0.02. The Workers $5 subscription plus $0.02 per million CPU ms overage crosses a container baseline at approximately 45 million CPU ms monthly, assuming 100% container utilization and ignoring egress. That equals 12.5 vCPU-hours at $0.40 per vCPU-hour before platform fees. Cloudflare's zero egress fees shift the threshold higher for data-intensive workloads.

When NOT to use this: CPU-bound workloads exceeding 5 minutes should move to Cloudflare Workflows or Queues, not Workers. The 128 MB memory limit and 6-connection ceiling make Workers unsuitable for large in-memory state or high-concurrency connection pooling.

Cloudflare Workers platform limits reference showing CPU time, memory, and subrequest boundaries across Free and Paid plans.
Cloudflare Workers platform limits reference showing CPU time, memory, and subrequest boundaries across Free and Paid plans.
Changelog announcement for the March 2025 CPU time increase to 5 minutes on Workers Paid plan.
Changelog announcement for the March 2025 CPU time increase to 5 minutes on Workers Paid plan.

Cloudflare Workers platform limits define the hard boundaries for CPU time, memory, and subrequests. Cloudflare Workers pricing details the $5 minimum and $0.02 per million CPU ms billing. Cloudflare Workers changelog documents the March 2025 increase from 30 seconds to 5 minutes of CPU time.

Reader Q&A

Frequently Asked Questions

Does waiting on network I/O count toward the 5-minute CPU time limit?
No. CPU time measures only active CPU execution. Waiting on fetch() calls, KV reads, or database queries does not count toward CPU time, so I/O-bound workloads can exceed 5 minutes of wall-clock time while staying under the CPU limit.
What happens when a Worker exceeds its configured CPU time limit?
Cloudflare returns Error 1102 to the client with the message Worker exceeded resource limits. The invocation outcome in analytics and Logpush is exceededCpu.
Can I set cpu_ms higher than 300,000 for Enterprise workloads?
Enterprise accounts can request customizable limits beyond the standard Paid plan maximum through their account team or Cloudflare Support.

Bibliography & Verification

Primary Sources & References

4 cited sources
  1. [01] developers.cloudflare.com workers / platform / limits
  2. [02] fast.io resources / cloudflare-workers-limits
  3. [03] developers.cloudflare.com changelog / post / 2025-03-25-higher-cpu-limits
  4. [04] developers.cloudflare.com workers / platform / pricing

Human × Agent Co-Work

Hamdi Soudani · in collaboration with Pyvren

Systems engineer & technical writer exploring AI infrastructure, security, and edge craft in daily collaboration with Pyvren.

Hamdi Soudani × Pyvren

Honest engineering stories — co-crafted with primary benchmarks & real code

Every dispatch blends hands-on engineering judgment with verified primary sources, reproducible configs, and clear tradeoffs.