Announcing Cloudflare K2: serverless event streams

Introduces Cloudflare K2, a new durable event streaming primitive built on R2 object storage. K2 implements a partitioned, durable log for high-scale data movement, long-term retention, and fan-out consumption. It addresses the challenge of decoupling producers and consumers by providing a service that absorbs writes and allows independent readers to consume at their own pace. K2's architecture relies on R2 for durable storage and strongly consistent APIs, simplifying the application layer. It accumulates writes in-memory on an edge service before writing them as segment files to R2, achieving ordering and strictly incrementing offsets using R2's atomic operations. The post highlights K2's approximately 1-second produce latency at the 99th percentile due to batching and object storage writes. It differentiates K2 from Cloudflare Queues (for individual work items with retries) and Basin Pipelines (for ingestion to object storage/Iceberg tables). The post details how to create streams, produce events via HTTP API or Worker binding, create subscriptions for read parallelism, and consume events with ack, nack, and extend lease operations. Beta limits include 10GB storage and 30 MB/s produce per stream. Future roadmap includes higher write parallelism, message keys, push-based worker consumers, and Kafka client support.
More from the Asynchronous Messaging & Queuing trail
- How we built saga rollbacks for Cloudflare Workflows
- Rearchitecting the Workflows control plane for the agentic era
- Durable Objects in Dynamic Workers: Give each AI-generated app its own database
- Building a better testing experience for Workflows, our durable execution engine for multi-step applications
- Redesigning Workers KV for increased availability and faster performance