Skip to content
Sıfırıncı Dakika
Latest

Cloudflare K2 announced: serverless event streams in public beta

SoftwareLaunchUpdated: 1 min read
Cloudflare Blog

In brief

Cloudflare announced K2, a durable event streaming service for its Developer Platform, now in public beta. K2 stores events as an ordered log that consumers can read at their own pace. Built on R2 object storage, it scales to vast data volumes.

  • Durable, ordered event log
  • Fully serverless and horizontally scalable
  • Long-term retention support
  • Consumer groups or fan-out to all consumers
  • Partitioned log built on R2 object storage
  • Available in public beta

What is K2?

Cloudflare added a new event streaming service called K2 to its Developer Platform. It is currently in public beta. K2 decouples producers from consumers by safely buffering the data flow between them.

In traditional RPC architectures, producers and consumers must align in both timing and scale. If a consumer falls behind or a downstream service goes down, events can be dropped. K2 solves this by placing a durable log in the middle.

How it works

K2 stores events as an ordered log. Consumers can read it in different ways: they can split reads across a consumer group or deliver all messages to all consumers. The service is fully serverless and supports long-term retention, so data is not lost even during long consumer downtime.

Why not Kafka?

Cloudflare first built K2 out of a need for a durable buffer at the edge, initially for Basin Pipelines. Pipelines runs on Cloudflare's edge infrastructure spanning more than 335 cities. In that environment, machines are small and short-lived, and networking is often over the public internet. That makes running traditional distributed systems software like Kafka difficult.

Instead, Cloudflare leaned on a state primitive it already had: R2 object storage. R2 combines high durability with strongly consistent APIs. Offloading replication and consensus to the storage layer makes the application layer far simpler, cheaper, and faster.

A log on top of object storage

R2, like other object stores, does not support appends; instead, complete files must be written. K2 first accumulates writes in memory on an edge service, then after a short wait writes all events as a single segment file. Ordering and strictly incrementing offsets are achieved using R2's atomic operations without a separate coordination service.

Why it matters

For teams working with cloud infrastructure, K2 offers an easier-to-manage alternative to Kafka for event streaming. It's worth trying for those who want to scale without losing data.

Sources

  1. Cloudflare BlogFirst reported byPrimary source
    Announcing Cloudflare K2: serverless event streams

Related stories