Cloudflare K2: serverless event streams

(blog.cloudflare.com)

73 points | by elffjs 3 hours ago

7 comments

  • psanford 1 hour ago
    Object store is quickly becoming the new core data substrate. Lets build kafka, but on s3. Lets build github, but on s3. It feels like we going to see more and more "object-store first" systems in the next few years.

    I am excited about this future. Give me stateless servers and a storage bucket over having to manage systems with disks any day.

    I do wonder if we will see an expansion of the s3 api to support more of these use cases. S3 added a janky file append operation to their new express-one-zone bucket type, and limited to 10k total file append operations. I wonder what else we will get in the next few years.

    • necubi 1 hour ago
      Definitely agree that every data system that doesn't need <100ms latency is moving to object storage.

      > I do wonder if we will see an expansion of the s3 api to support more of these use cases

      This is actually an area where I think we have a big leg up on folks building on top of S3. My team (which built K2) sits next to the R2 team, and we have the opportunity to co-evolve the products in mutually beneficial ways.

    • 6thbit 32 minutes ago
      doesn't that make egress fees egregious? or still cheaper than disks?
      • cj 1 minute ago
        You can download objects from S3 from EC2 without traversing the public internet using things like gateway endpoints [0] which avoids s3 egress fees. But doesn't avoid egress fees from EC2 to the end user.

        [0] https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpo...

      • vmg12 21 minutes ago
        This all depends on the cloud you are building on and if the data ever leaves the datacenter.
    • Onavo 1 hour ago
      People like S3 because they have hard engineering guarantees around bit rot and work well as a high level abstraction of a network filesystem with all of the low level failure recovery built-in. You don't have to worry about doing your own RAID configs. The bigger question is whether non-AWS services can offer the same level of guarantees. I have heard horror stories for example when it comes to downtime on Hetzner's S3 object store.

      I am currently using Cloudflare R2 right now and if you see their forums, there's always the occasional post about objects going missing.

  • kirillkosolapov 15 minutes ago
    How does this solution differ from AutoMQ and WarpStream? I’ve worked with one of them, and it is indeed a serverless solution built on top of S3.

    As far as I know, Kafka itself already supports offloading some data to S3 for long-term storage.

    Based on the articles—which I didn't fully grasp—I’m wondering if there are additional benefits mentioned, such as multi-region distribution (though I find it hard to imagine how that would be implemented).

  • necubi 1 hour ago
    I'm the author of the post and tech lead for K2. Happy to answer any questions!
    • aniketsauravv 1 hour ago
      Great product, congratulation on launch. Are you using this internally in any way?
      • necubi 56 minutes ago
        Yes! We originally built K2 to serve as the ingestion layer for Basin Pipelines [0], our stream processing product. We have a number of other teams building new products on top of it at the moment which I can't talk about yet :)

        [0] https://developers.cloudflare.com/basin-pipelines/

  • loufe 1 hour ago
    If I was a serious Cloudflare customer I would be seriously concerned about the security of my infrastructure with them. Yes LLMs can code fast but this is an almost frenetic pace of releasing new products, all with fewer staff.
    • owenthejumper 9 minutes ago
      They've always been this fast. The trick is that they release beta products a lot. Kind of classic "lean" (does anyone remember that?)

      My bigger concern would be their increasing grip on a lot of the market, and eventually becoming a monopoly (or part of the big tech "duopoly")

    • vmg12 1 hour ago
      They are working on a set of primitives that make building this kind of software easier. With AI, runtimes matter more than ever and languages matter less.
    • threatofrain 1 hour ago
      I find this release relieving because it fills a hole that was really needed. Another hole would be a proper database and improvements to D1.
    • NicoJuicy 1 hour ago
      That's just perception. At the same time they were hiring 1 k. People and hired 2 k. People the year before ( interns).

      There was just more news about it than with other companies ( I think they let go about 2 k. People a year ago).

      ( Not saying it's good, just a little perception balance)

  • thepaulmcbride 46 minutes ago
    This sounds like a super interesting product, but I'm always reluctant to build on anything that isn't a portable industry standard.
    • ameliaquining 41 minutes ago
      Presumably the Kafka-compatible API that they say is in the works will address this?
      • necubi 37 minutes ago
        Yep. I'm not personally a huge fan of the kafka API — I think it's simultaneously too low level for normal users and too high level to deeply integrate into other systems (like stream processing engines), and requires a complex client library to use effectively.

        We went with a simpler and more user friendly consume API, that also allows much higher levels of read parallelism (particularly important if you're using something like Workers, which parallelize well but aren't very powerful individually).

        But we know many companies are invested in the Kafka ecosystem, and we want to provide an easy on (and if necessary, off) ramp for them.

  • theredsix 1 hour ago
    What's the benefits of this over traditional GKE pub/sub, kafka or another queuing service?
    • necubi 1 hour ago
      Google PubSub is a great product. The primary benefit of K2 is cost, particularly for longer retention periods. Being backed by object storage means that we can store data extremely cheaply compared to disk backed solution, and we pass that on in our pricing.

      Compared to self-hosted or cloud-hosted Kafka (e.g., Amazon MSK or Confluent), K2 is much cheaper, and fully serverless. There are no clusters to manage or scale, and consistent performance even as you vastly increase the amount of data.

      The main downside is produce (and end to end) latency is higher (around 1s p99) than systems that rely on local disk replication, like Kafka.

      So it's great if you're trying to move a huge amount of data around, or for use cases where cost is more important than latency.

    • freakynit 1 hour ago
      Ha setup and management is costly. K2 relieves you off that by charging you 0.04/0.04/GB read/write and 0.02/GB/month storage. Pretty useful if your volume is not into multi-GB's a month. GKE pub/sub seems pretty costly by comparison.
  • ipkstef 48 minutes ago
    i was trying to understand why i would use this over their current offerings of queues, and im really sick so my brain isn't working. so i ran it through ai

      You need...                                            | Use
      -------------------------------------------------------|-------
      “Make sure this job gets done”                         | Queue
      retries / dead-letter handling                         | Queue
      delayed jobs                                           | Queue
      distribute jobs among workers                          | Queue
      “Record that this event happened”                      | K2
      multiple independent systems reading the same events   | K2
      replay old events                                      | K2
      ordered event streams                                  | K2
      Kafka-like architecture                                | K2