Cloudflare Workers vs Lambda@Edge
Two edge compute platforms. The decision criteria for picking one.
Cloudflare Workers
V8-based runtime. JavaScript and TypeScript native; WebAssembly for other languages. No cold starts in the traditional sense; isolates spin up in milliseconds.
Global by default. Code runs at every Cloudflare PoP. The platform handles distribution; you deploy once.
Pricing: per-request plus CPU time. Basic tier generous; paid tier predictable. Easier to model cost than Lambda@Edge.
AWS Lambda@Edge
Node.js and Python. Familiar tooling for AWS-native teams. Slower cold starts than Workers; tens to hundreds of milliseconds.
Distributed via CloudFront edge locations. AWS handles distribution. Tightly integrated with CloudFront features (cache key manipulation, origin selection, signed URLs).
Pricing: per-request plus duration. Higher per-request cost than Workers in most scenarios. CloudFront integration is the differentiator.
Performance comparison
Cold start: Workers under 5ms typical. Lambda@Edge 50-200ms typical, depending on runtime and package size.
Memory limits: Workers 128MB. Lambda@Edge 128MB-10GB depending on event type. Heavier compute fits Lambda@Edge.
Execution time: Workers 50ms CPU per request (paid tier 30s wall-clock). Lambda@Edge 5-30 seconds depending on event type.
Integration considerations
AWS-native stack: Lambda@Edge integrates with IAM, CloudFront, S3, the rest of AWS. Permissions and observability work out of the box.
Cloudflare-native or multi-cloud: Workers integrates with Cloudflare Workers KV, R2, Durable Objects, D1. The Cloudflare platform is the home.
If you need to call internal AWS services, Lambda@Edge runs in a VPC less seamlessly than typical Lambda. Plan for cross-cloud egress if going Workers.
Pick by stack and use case
AWS-heavy with CloudFront: Lambda@Edge. The integration savings outweigh the cold-start cost for most use cases.
Multi-cloud, JavaScript-first, latency-sensitive: Workers. The cold start advantage matters for user-facing edge logic.
Migrate when the lock-in cost is worth it. Don't switch existing systems just because the other side advertises a feature; the migration cost rarely pays.