Cloudflare has opened K2, a serverless event streaming service, in public beta. The service builds event streams on R2 object storage, with Cloudflare naming about one second of produce latency at p99.
That figure describes producing events, not full delivery to a consumer. One beta user reported end-to-end delivery latency of p95 2.5 seconds and p99 7.5 seconds. A team representative said the tail latency was higher than expected and that Consume API performance still needed work.
Builds Event Streams Around Object Storage
K2 began as infrastructure for Basin Pipelines, which needed durable storage for events before its pull-based processing engine read and transformed them. The source says Cloudflare could not use Apache Kafka for that role because Pipelines run across more than 335 cities, on small slices of ephemeral machines connected over the public internet.
Instead, Cloudflare built on R2. The source describes R2 as providing eleven nines with strongly consistent APIs. By placing push replication and consensus in the storage layer, the application layer can scale compute and storage separately.
Object storage does not support appending to an existing object, a challenge for a log. K2 holds writes in memory at an edge service, pauses briefly to collect more events, then writes a batch as a segment file. R2 atomic operations provide ordering and incrementing offsets without a separate coordination service.
Builds Event Streams With a Latency and Cost Trade-Off
The brief pause before writing a segment is part of the latency trade-off. A Hacker News commenter who identified himself as K2’s tech lead said systems that do not require sub-100ms latency are moving toward object storage. He also said his team works next to the R2 team and can develop the products together.
Another commenter, who disclosed working on s2.dev, argued that some uses need lower latency. He cited roughly 50ms p99 acknowledgment latency in the same region for his service, which uses stateful backend processes that continuously flush multi-tenant objects. He also pointed to faster object storage tiers, while noting that single-zone systems still need quorum writes for regional durability.
Pricing drew a separate concern. K2’s listed rate is $0.04 per GB produced and the same amount consumed. One commenter calculated that a simple case with one consumer would cost $0.08 per GB, with fan-out potentially raising costs quickly. Retention is listed separately at $0.02 per GB per month, and the source says nothing is billed during beta.
The same commenter said object storage could make K2 cheaper than self-managed or hosted Kafka options, particularly for longer retention. Cloudflare’s stated trade-off is roughly one-second p99 produce latency against systems using local disk replication. Readers comparing infrastructure choices can also review Cloudflare’s DNS cache redesign and this site’s coverage of cloud architecture and performance.
Builds Event Streams With a Different Consumer API
K2 uses a lease-based consume API rather than Kafka’s API. A consumer polls a subscription and receives a batch leased for five minutes. It can acknowledge the batch, negatively acknowledge it for redelivery, or extend the lease.
The tech lead said the design supports greater read parallelism for Workers that can parallelize but are individually less powerful. A Worker binding sends batches, and the result indicates whether a failed produce request is worth retrying. K2 represents data as bytes, leaving encoding to the application.
Kafka compatibility is on the roadmap. The tech lead said he was not a fan of the Kafka API, describing it as both too low-level for ordinary users and too high-level for deep integration with stream-processing engines.
During beta, each stream is limited to 10GB of storage and 30 MB/s produce, with a form available for increases. Message keys and key-based ordering, multi-gigabyte-per-second write parallelism, push-based Worker consumers, a lower-latency express tier and Kafka client support are listed as future work. Streams can be created through the dashboard, API, Wrangler or cf command-line interface. For broader context on delivery networks, see coverage of CDN policy.
The beta’s next test is whether improvements to the Consume API narrow the gap between K2’s produce figure and the end-to-end delays users report.
InfoQ’s K2 report details the beta, architecture, pricing and user feedback.
