
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Fri, 10 Apr 2026 13:11:55 GMT</lastBuildDate>
        <item>
            <title><![CDATA[A New Hope for Object Storage: R2 enters open beta]]></title>
            <link>https://blog.cloudflare.com/r2-open-beta/</link>
            <pubDate>Wed, 11 May 2022 13:01:00 GMT</pubDate>
            <description><![CDATA[ R2 Object Storage is now in open beta, available for all customers to test and deploy! ]]></description>
            <content:encoded><![CDATA[ <p></p><p>In September, we <a href="/introducing-r2-object-storage/">announced</a> that we were building our own <a href="https://www.cloudflare.com/developer-platform/products/r2/">object storage solution: Cloudflare R2</a>. R2 is our answer to egregious <a href="https://www.cloudflare.com/learning/cloud/what-is-object-storage/">egress charges</a> from incumbent cloud providers, letting developers store as much data as they want without worrying about the cost of accessing that data.</p><p>The response has been overwhelming.</p><ul><li><p><b>Independent developers</b> had bills too small for cloud providers to negotiate fair egress rates with them. Egress charges were the largest line-item on their cloud bills, strangling side projects and the new businesses they were building.</p></li><li><p><b>Large corporations</b> had written off multi-cloud storage - and thus multi-cloud itself - as a pipe dream. They came to us with excitement, pitching new products that integrated data with partner companies.</p></li><li><p><b>Non-profit research organizations</b> were paying massive egress fees just to share experiment data with one another. Egress fees were having a real impact on their ability to collaborate, driving silos between organizations and restricting the experiments and analyses they could run.</p></li></ul><p>Cloudflare exists to help build a better Internet. Today, the Internet gets what it deserves: R2 is now in <a href="https://developers.cloudflare.com/r2/get-started/">open beta</a>.</p><p>Self-serve customers can <a href="https://dash.cloudflare.com/?to=/:account/r2/plans">enable R2</a> in the Cloudflare dashboard. Enterprise accounts can reach out to their CSM for onboarding.</p>
    <div>
      <h2>Internal and external APIs</h2>
      <a href="#internal-and-external-apis">
        
      </a>
    </div>
    <p>R2 has two APIs: an API accessible only from within Workers, which we call the In-Worker API, and an S3-compatible API, which exposes your bucket on a URL of the form <a href="http://account.r2.cloudflarestorage.com/bucket">bucket.account.r2storage.com</a>. Before you can make requests to R2, you’ll need to be authenticated — R2 buckets are private by default.</p>
    <div>
      <h3>In-Worker API</h3>
      <a href="#in-worker-api">
        
      </a>
    </div>
    <p>With the in-Worker API, a bucket is “bound” to a specific Worker, which can then perform PUT, GET, DELETE and LIST operations against the bucket.</p>
    <div>
      <h3>S3-compatible API</h3>
      <a href="#s3-compatible-api">
        
      </a>
    </div>
    <p>For the S3-compatible API, authentication is done the same way as on S3: SigV4 against an R2 URL. SigV4 signs requests using a secret key to authenticate them to R2. This means public access to R2 over the Internet is only possible today by hosting a Worker, connecting it to R2, and routing requests through it.</p><p>The easiest way to test the S3-compatible API is to use an S3 client. One of the most popular S3 clients is the <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">boto3</a> SDK.</p><p>In Python, copy the following script and fill in the <code>account_id</code>, <code>access_key</code>, and <code>secret_access_key</code> fields with your R2 account credentials.</p>
            <pre><code>main.py
import boto3

s3 = boto3.resource('s3',
  endpoint_url = 'https://&lt;accountid&gt;.r2.cloudflarestorage.com',
  aws_access_key_id = '&lt;access_key_id&gt;',
  aws_secret_access_key = '&lt;access_key_secret&gt;'
)

print('Buckets:')
for bucket in s3.buckets.all():
  print(' - ', bucket.name)

bucket = s3.Bucket('my-bucket-name')

print('Objects:')
for item in bucket.objects.all():
  print(' - ', item.key)
</code></pre>
            
    <div>
      <h3>Features</h3>
      <a href="#features">
        
      </a>
    </div>
    <p>R2 comes with support for all basic create/read/update/delete S3 features through both of its APIs.</p><p>During the open beta period, we’re targeting R2 to sustain 1,000 GET operations per second and 100 PUT operations per second, per bucket. R2 supports objects up to approximately 5 TB in size, with individual parts limited to 5 GB of data.</p><p>R2 provides strongly consistent access to data. Once a PUT is confirmed by R2, future GET operations will always reflect the new key/value pair. The only exception to this is when deleting a bucket. For a short period of time following deletion, the bucket may still exist and continue to allow reads/writes.</p>
    <div>
      <h2>Pricing</h2>
      <a href="#pricing">
        
      </a>
    </div>
    <p>When we initially announced R2, we included preliminary pricing numbers. One of our main goals with R2 has been to serve the developers who can’t negotiate large discounts with cloud vendors. To that end, we’re also announcing a forever-free tier that lets developers start building on R2 with no charges at all.</p><p><a href="https://r2-calculator.cloudflare.com/">R2 charges</a> depend on the total volume of data stored and the type of operation performed on the data:</p><ul><li><p>Storage is priced at \$0.015 / GB, per month.</p></li><li><p>Class A operations (including writes and lists) cost \$4.50 / million.</p></li><li><p>Class B operations cost \$0.36 / million.</p></li></ul><p>Class A operations tend to mutate state, such as creating a bucket, listing objects in a bucket, or writing an object. Class B operations tend to read existing state, for example reading an object from a bucket. You can find more information on pricing and a full list of operation types in the <a href="https://developers.cloudflare.com/r2/platform/pricing/">docs</a>.</p><p>Of course, there is no charge for egress bandwidth from R2. You can access your bucket to your heart’s content.</p><p>R2’s forever-free tier includes:</p><ul><li><p>10 GB-months of stored data</p></li><li><p>1,000,000 Class A operations, per month</p></li><li><p>10,000,000 Class B operations, per month</p></li></ul><p>Free usage resets each month. While in the open beta phase, R2 usage over the free tier will be billed.</p>
    <div>
      <h2>Future plans</h2>
      <a href="#future-plans">
        
      </a>
    </div>
    <p>We’ve spent the past six months in closed beta with a number of design partners, building out our storage solution. Backed by Durable Objects, R2’s novel architecture delivers both high availability and consistent performance.</p><p>While we’ve made great progress on R2, we still have plenty left to build in the coming months.</p>
    <div>
      <h3>Improving performance</h3>
      <a href="#improving-performance">
        
      </a>
    </div>
    <p>Our first priority is to <b>improve performance and reliability</b>. While we’ve thrown internal usage and our design partner’s demands at R2, there’s no substitute for live production traffic.</p><p>During the open beta period, R2 can sustain a maximum of 1,000 GET operations per second and 100 PUT operations per second, per bucket. We’ll look to raise these limits as we get comfortable operating the system. If you have higher needs, reach out to us!</p><p>When you create a bucket, you won’t see a region selector. Our vision for R2 includes automatically globally distributed storage, where R2 seamlessly places each object into the storage region closest to where the request comes from. Today, R2 primarily stores data in North America, which can lead to higher latencies when accessing content from other regions. We’ll first look to address this by adding additional regions where objects can be created, before adding automatic migration of existing objects across regions. Similar to what we’ve built with <a href="/supporting-jurisdictional-restrictions-for-durable-objects/">jurisdictional restrictions for Durable Objects</a>, we’ll also enable restricting where an R2 bucket places data to comply with privacy regulations.</p>
    <div>
      <h3>Expanding R2’s feature set</h3>
      <a href="#expanding-r2s-feature-set">
        
      </a>
    </div>
    <p>We’ll then focus on expanding R2 capabilities beyond the basic S3 API. In the near term, we’re focused on delivering:</p><ul><li><p>Support for TTLs, so data can automatically be deleted from buckets over time.</p></li><li><p>Public buckets, so a bucket can be exposed to the internet without writing a Worker</p></li><li><p>Pre-signed URL support, which delegates read and write access for a specific key to a token.</p></li><li><p>Integration with <a href="https://www.cloudflare.com/cdn/">Cloudflare’s cache</a>, to scale read requests and provide global distribution of data.</p></li></ul><p>If you have additional feature requests that aren’t listed above, we want to hear from you! Join our <a href="https://discord.gg/cloudflaredev">Discord</a> and share what you need to make R2 your new, zero-cost egress <a href="https://www.cloudflare.com/learning/cloud/what-is-object-storage/">object store</a> in the r2-open-beta channel.</p> ]]></content:encoded>
            <category><![CDATA[Platform Week]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Storage]]></category>
            <category><![CDATA[Developers]]></category>
            <guid isPermaLink="false">5fCtFTYh1FJq6paCxwp296</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Durable Objects Alarms — a wake-up call for your applications]]></title>
            <link>https://blog.cloudflare.com/durable-objects-alarms/</link>
            <pubDate>Wed, 11 May 2022 12:59:17 GMT</pubDate>
            <description><![CDATA[ Durable Object alarms let you call a function at a defined point in the future, unlocking deeper use-cases for Durable Objects like reliable queuing ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Since we launched Durable Objects, developers have leveraged them as a novel building block for distributed applications.</p><p>Durable Objects provide globally unique instances of a JavaScript class a developer writes, accessed via a unique ID. The Durable Object associated with each ID implements some fundamental component of an application — a banking application might have a Durable Object representing each bank account, for example. The bank account object would then expose methods for incrementing a balance, transferring money or any other actions that the application needs to do on the bank account.</p><p>Durable Objects work well as a stateful backend for applications — while Workers can instantiate a new instance of your code in any of Cloudflare’s data centers in response to a request, Durable Objects guarantee that all requests for a given Durable Object will reach the same instance on Cloudflare’s network.</p><p>Each Durable Object is single-threaded and has access to a stateful storage API, making it easy to build consistent and highly-available distributed applications on top of them.</p><p>This system makes distributed systems’ development easier — we’ve seen some impressive applications launched atop Durable Objects, from collaborative whiteboarding tools to conflict-free replicated data type (CRDT) systems for coordinating distributed state launch.</p><p>However, up until now, there’s been a piece missing — how do you invoke a Durable Object when a client Worker is not making requests to it?</p><p>As with any distributed system, Durable Objects can become unavailable and stop running. Perhaps the machine you were running on was unplugged, or the datacenter burned down and is never coming back, or an individual object exceeded its memory limit and was reset. Before today, a subsequent request would reinitialize the Durable Object on another machine, but there was no way to programmatically wake up an Object.</p><p>Durable Objects Alarms are here to change that, unlocking new use cases for Durable Objects like queues and deferred processing.</p>
    <div>
      <h3>What is a Durable Object Alarm?</h3>
      <a href="#what-is-a-durable-object-alarm">
        
      </a>
    </div>
    <p>Durable Object Alarms allow you, from within your Durable Object, to schedule the object to be woken up at a time in the future. When the alarm’s scheduled time comes, the Durable Object’s <code>alarm()</code> handler will be called. If this handler throws an exception, the alarm will be automatically retried using exponential backoff until it succeeds — alarms have guaranteed at-least-once execution.</p>
    <div>
      <h3>How are Alarms different from Workers Cron Triggers?</h3>
      <a href="#how-are-alarms-different-from-workers-cron-triggers">
        
      </a>
    </div>
    <p>Alarms are more fine-grained than Cron Triggers. While a Workers service can have up to three Cron Triggers configured at once, it can have an unlimited amount of Durable Objects, each of which can have a single alarm active at a time.</p><p>Alarms are directly scheduled from and invoke a function within your Durable Object. Cron Triggers, on the other hand, are not programmatic — they execute based on their schedules, which have to be configured via the Cloudflare Dashboard or centralized configuration APIs.</p>
    <div>
      <h3>How do I use Alarms?</h3>
      <a href="#how-do-i-use-alarms">
        
      </a>
    </div>
    <p>First, you’ll need to add the <code>durable_object_alarms</code> compatibility flag to your <code>wrangler.toml</code>.</p>
            <pre><code>compatibility_flags = ["durable_object_alarms"]</code></pre>
            <p>Next, implement an <code>alarm()</code> handler in your Durable Object that will be called when the alarm executes. From anywhere else in your Durable Object, call <code>state.storage.setAlarm()</code> and pass in a time for the alarm to run at. You can use <code>state.storage.getAlarm()</code> to retrieve the currently set alarm time.</p><p>In this example, we implemented an alarm handler that wakes the Durable Object up once every 10 seconds to batch requests to a single Durable Object, deferring processing until there is enough work in the queue for it to be worthwhile to process them.</p>
            <pre><code>export default {
  async fetch(request, env) {
    let id = env.BATCHER.idFromName("foo");
    return await env.BATCHER.get(id).fetch(request);
  },
};

const SECONDS = 1000;

export class Batcher {
  constructor(state, env) {
    this.state = state;
    this.storage = state.storage;
    this.state.blockConcurrencyWhile(async () =&gt; {
      let vals = await this.storage.list({ reverse: true, limit: 1 });
      this.count = vals.size == 0 ? 0 : parseInt(vals.keys().next().value);
    });
  }
  async fetch(request) {
    this.count++;

    // If there is no alarm currently set, set one for 10 seconds from now
    // Any further POSTs in the next 10 seconds will be part of this kh.
    let currentAlarm = await this.storage.getAlarm();
    if (currentAlarm == null) {
      this.storage.setAlarm(Date.now() + 10 * SECONDS);
    }

    // Add the request to the batch.
    await this.storage.put(this.count, await request.text());
    return new Response(JSON.stringify({ queued: this.count }), {
      headers: {
        "content-type": "application/json;charset=UTF-8",
      },
    });
  }
  async alarm() {
    let vals = await this.storage.list();
    await fetch("http://example.com/some-upstream-service", {
      method: "POST",
      body: Array.from(vals.values()),
    });
    await this.storage.deleteAll();
    this.count = 0;
  }
}</code></pre>
            <p>Once every 10 seconds, the <code>alarm()</code> handler will be called. In the event an unexpected error terminates the Durable Object, it will be re-instantiated on another machine, following a short delay, after which it can continue processing.</p><p>Under the hood, Alarms are implemented by making reads and writes to the storage layer. This means Alarm <code>get</code> and <code>set</code> operations follow the same rules as any other storage operation – writes are coalesced with other writes, and reads have a defined ordering. See <a href="/durable-objects-easy-fast-correct-choose-three/">our blog post</a> on the caching layer we implemented for Durable Objects for more information.</p>
    <div>
      <h3>Durable Objects Alarms guarantee fault-tolerance</h3>
      <a href="#durable-objects-alarms-guarantee-fault-tolerance">
        
      </a>
    </div>
    <p>Alarms are designed to have no single point of failure and to run entirely on our edge – every Cloudflare data center running Durable Objects is capable of running alarms, including migrating Durable Objects from unhealthy data centers to healthy ones as necessary to ensure that their Alarm executes. Single failures should resolve in under 30 seconds, while multiple failures may take slightly longer.</p><p>We achieve this by storing alarms in the same distributed datastore that backs the Durable Object storage API. This allows alarm reads and writes to behave identically to storage reads and writes and to be performed atomically with them, and ensures that alarms are replicated across multiple datacenters.</p><p>Within each data center capable of running Durable Objects, there are multiple processes responsible for tracking upcoming alarms and triggering them, providing fault tolerance and scalability within the data center. A single elected leader in each data center is responsible for detecting failure of other data centers and assigning responsibility of those alarms to healthy local processes in its own data center. In the event of leader failure, another leader will be elected and become responsible for executing Alarms in the data center. This allows us to guarantee at-least-once execution for all Alarms.</p>
    <div>
      <h3>How do I get started?</h3>
      <a href="#how-do-i-get-started">
        
      </a>
    </div>
    <p>Alarms are a great way to build new distributed primitives, like queues, atop Durable Objects. They also provide a method for guaranteeing work within a Durable Object will complete, without relying on a client request to “kick” the Object.</p><p>You can get started with Alarms now by enabling Durable Objects in the Cloudflare <a href="https://dash.cloudflare.com/">dashboard</a>. For more info, check the developer docs or jump in our Discord.</p> ]]></content:encoded>
            <category><![CDATA[Platform Week]]></category>
            <category><![CDATA[Durable Objects]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Notifications]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">5FKrh4z1ggyDYSTMgbDku6</guid>
            <dc:creator>Matt Alonso</dc:creator>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing Relational Database Connectors]]></title>
            <link>https://blog.cloudflare.com/relational-database-connectors/</link>
            <pubDate>Mon, 15 Nov 2021 13:59:29 GMT</pubDate>
            <description><![CDATA[ Customers can connect to a Postgres or MySQL database directly from their Workers using a Cloudflare Tunnel today. In the future, you can use Database Connectors to achieve this natively using a standardized Socket API. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>At Cloudflare, we’re building the best compute platform in the world. We want to make it easy, seamless, and obvious to build your applications with us. But simply making the best compute platform is not enough — at the heart of your applications are the data they interact with.</p><p>Cloudflare has multiple data storage solutions available today: <a href="/introducing-workers-kv/">Workers KV</a>, <a href="/introducing-r2-object-storage/">R2</a>, and <a href="/introducing-workers-durable-objects/">Durable Objects</a>. All three follow Cloudflare’s design goals for Workers: global by default, infinitely scalable, and delightful for developers to use. We’ve partnered with third-party storage solutions like Fauna, MongoDB and Prisma, who have built data platforms that align beautifully with our design goals and written tutorials for databases that already support HTTP connections.</p><p>The one area that’s been sorely missed: relational databases. Cloudflare itself runs on relational databases, and we’re not alone. In April, we asked <a href="https://workers.cloudflare.com/node">which Node libraries</a> you wanted us to support, and <b>four of the top five requests</b> were related to databases. For this Full Stack Week, we asked ourselves: how could we support relational databases in a way that aligned with our design goals?</p><p>Today, we’re taking a first step towards that world by announcing support for relational databases, including Postgres and MySQL from Workers.</p><p>Connecting to a database is no simple task — if it were as easy as passing a connection string to a database driver, we would have already done it. We’ve had to overcome several hurdles to reach this point, and have several more still to conquer.  </p><p>Our goal with this announcement is to work with you, our developers, to solve the unique pain points that come from accessing databases inside Workers. If you’d like to work with us, fill out <a href="https://www.cloudflare.com/database-connectors-early-access">this form</a> or join us <a href="https://discord.gg/rH4SsffFcc">on Discord</a> — this is just the beginning. If you’d just like to grab the code and play around, use this <a href="https://developers.cloudflare.com/workers/tutorials/query-postgres-from-workers-using-database-connectors">example</a> to get started connecting to your own database, or check out our demo.</p>
    <div>
      <h3>Why are Database Connectors so hard to build?</h3>
      <a href="#why-are-database-connectors-so-hard-to-build">
        
      </a>
    </div>
    <p>Serverless database connections are challenging to support for several reasons.</p><p>Databases are needy — they often require TCP connections, since they assume long-lived connections between an application server and the database. The Workers runtime doesn’t currently support TCP connections, so we’ve only been able to support HTTP-based databases or proxies.</p><p>Like a relationship, establishing a connection isn’t quite enough. Developers use client libraries for databases to make submitting queries and managing the responses easy. Since the Workers runtime is not entirely Node.js compatible, we need to either roll our own database library or find one that does not use unsupported built-in libraries.</p><p>Finally, databases are sensitive. It often takes external libraries to manage shared connections between an application server and a database, since these connections tend to be expensive to establish.</p>
    <div>
      <h3>Moving past these challenges</h3>
      <a href="#moving-past-these-challenges">
        
      </a>
    </div>
    <p>Our approach today gives us the foundation to address each of these challenges in creative ways going forward.</p><p>First, we’re leveraging <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup">cloudflared</a> to create a secure tunnel between Cloudflare and a private network within your existing infrastructure. Cloudflared already supports proxying HTTP to TCP over WebSockets — Our challenge is providing interfaces that look like the socket interfaces existing libraries expect, while rewiring the implementations to redirect reads and writes to our websocket. This method is fast, safe, and secure; but limiting in that we lack control of where to direct the final connections. This is a problem we will solve soon, but until then our approach is essential to gathering latency and performance data to see where else we need to improve.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/vVs0KefQQxbNEt3VsNHHj/41225487a689b82c04c9ef7beb7d8ae2/unnamed-10.png" />
            
            </figure><p>Next, we’ve created a shim-layer that adapts the socket API from a popular runtime to connect directly to databases using a WebSocket. This allows us to bundle code as-is, without forking or otherwise making significant changes to the database library. As part of this announcement, we’ve published a <a href="https://developers.cloudflare.com/workers/tutorials/query-postgres-from-workers-using-database-connectors">tutorial</a> on how to connect to and query a Postgres database from your Workers, using existing Cloudflare technology and a driver from the growing community at Deno. We’re excited to work with the upstream maintainers, on expanding support.</p><p>Finally, we’re most excited for how this approach will let us begin to manage connection pooling and connection establishment overhead. While our current tech demo requires setting up the Cloudflare Tunnel on your own infrastructure, we’re looking for customers who’d like to pilot a model where Cloudflare hosts the tunnel for you.</p>
    <div>
      <h3>Where we’re going</h3>
      <a href="#where-were-going">
        
      </a>
    </div>
    <p>We’re just getting started. Our goal with today’s announcement is to find customers who are looking to build new applications or migrate existing applications to Workers while working with data that’s stored in a relational database.</p><p>Just as Cloudflare started by providing security, performance, and reliability for customer’s websites, we’re excited about a future where Cloudflare manages database connections, handles replication of data across cloud providers and provides low-latency access to data globally.</p><p>First, we’re looking to add <a href="/introducing-socket-workers/">support for TCP into the runtime natively</a>. With native support for TCP we’ll not only have better support for databases, but expand the Workers runtime to work with data infrastructure more broadly.</p><p>Our position in the network layer of the stack makes providing performance, security benefits and extremely reduced egress costs to global databases all possible realities. To do so, we’ll repurpose the HTTP to TCP proxy service that we’ve currently built and run it for developers as a connection pooling service, managing connections to their databases on their behalf.</p><p>Finally, our network makes caching data and making it accessible globally at low latency possible. Once we have connections back to your data, making it globally accessible in Cloudflare’s network will unlock fundamentally new architectures for distributed data.</p>
    <div>
      <h3>Take our connectors for a spin</h3>
      <a href="#take-our-connectors-for-a-spin">
        
      </a>
    </div>
    <p>Want to check things out? There are three main steps to getting up-and-running:</p><ol><li><p>Deploying cloudflared within your infrastructure.</p></li><li><p>Deploying a database that connects to cloudflared.</p></li><li><p>Deploying a Worker with the database driver that submits queries.</p></li></ol><p>The Postgres tutorial is available <a href="https://developers.cloudflare.com/workers/tutorials/query-postgres-from-workers-using-database-connectors">here</a>.</p><p>When you’re all done, it’ll look a little something like this:</p>
            <pre><code>import { Client } from './driver/postgres/postgres'

export default {
  async fetch(request: Request, env, ctx: ExecutionContext) {
    try {
      const client = new Client({
        user: 'postgres',
        database: 'postgres',
        hostname: 'https://db.example.com',
        password: '',
        port: 5432,
      })
      await client.connect()
      const result = await client.queryArray('SELECT * FROM users WHERE uuid=1;')
      ctx.waitUntil(client.end())
      return new Response(JSON.stringify(result.rows[0]))
    } catch (e) {
      return new Response((e as Error).message)
    }
  },
}</code></pre>
            <p>Hit any snags? Fill out <a href="https://www.cloudflare.com/database-connectors-early-access">this form</a>, join <a href="https://discord.gg/rH4SsffFcc">our Discord</a> or shoot us an <a>email</a> and let’s chat!</p> ]]></content:encoded>
            <category><![CDATA[Full Stack Week]]></category>
            <category><![CDATA[Postgres]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">CinJ7mVjQHrKXIimcCbNR</guid>
            <dc:creator>Kabir Sikand</dc:creator>
            <dc:creator>Greg McKeon</dc:creator>
            <dc:creator>Ben Yule</dc:creator>
        </item>
        <item>
            <title><![CDATA[Durable Objects — now Generally Available]]></title>
            <link>https://blog.cloudflare.com/durable-objects-ga/</link>
            <pubDate>Mon, 15 Nov 2021 13:59:12 GMT</pubDate>
            <description><![CDATA[ Today, we’re announcing that Durable Objects are generally available and production-ready for you to use! ]]></description>
            <content:encoded><![CDATA[ <p></p><p><a href="/tag/full-stack-week/">Full Stack Week</a> is all about how developers are embracing the power of Cloudflare’s network to build entire applications that are global by default. The promise of Workers isn’t just improved latency — it’s fundamentally different programming paradigms that make developer’s lives easier and applications more resilient.</p><p>Last year, we <a href="/durable-objects-open-beta/">announced Durable Objects</a> — Cloudflare’s approach to coordinating state across Workers running at Cloudflare’s edge. Durable Objects let developers implement previously complex applications, like collaborative whiteboarding, game servers, or global queues, in just a few lines of code.</p><p>Today, we’re announcing that Durable Objects are generally available and production-ready for you to use!</p>
    <div>
      <h3>What makes Durable Objects so cool?</h3>
      <a href="#what-makes-durable-objects-so-cool">
        
      </a>
    </div>
    <p>For many traditional applications, state coordination happens through a database. Applications built on Workers present some unique challenges for a database — namely needing to handle global scale out-of-the-box and heavy concurrency that could lead to frequent transaction rollbacks when coordinating on shared keys. Databases themselves are hard to configure and scale, especially at global scale, so developers would need to tweak their database specifically for Workers’ access patterns.</p><p>Durable Objects present a simpler paradigm: write a JavaScript class, and your application can create named instances of that class — which are guaranteed to be unique across Cloudflare’s entire network. That instance is a Durable Object — Workers (and other Durable Objects!) can send messages to it via its ID. The Durable Object processes messages in-order and on a single-thread, allowing for coordination across messages. We also provide a strongly consistent storage API, which can store key-value pairs the object needs to make durable.</p><p>Take, for example, an online document editor.  A typical architecture would save the state of the document in a database and have users persist changes there.  This makes collaboration difficult, though — how can multiple users ensure that they all see the latest copy of changes to the document?</p><p>With Durable Objects, this is a much simpler problem.  By writing a Document class, you store the state of each document in-memory in a Durable Object.  As users connect, they’ll see the latest copy of the document — and can make their changes in-sync with other users. When users leave the document, the Durable Object will leave memory and stop incurring charges, while its state is persisted durably.  There’s no networking to configure, database to manage, or autoscaling policy to implement — it all just works.</p><p>While individual objects are single-threaded, Durable Objects’ design means a collection of objects can scale effectively infinitely. An object’s lifecycle is managed for you, meaning there’s no clean-up tasks to run or systems to scale down — Durable Objects can instantly scale to hundreds of thousands of requests per second, then scale back down with no developer interaction.</p>
    <div>
      <h3>What have we been building since announcing Early Access?</h3>
      <a href="#what-have-we-been-building-since-announcing-early-access">
        
      </a>
    </div>
    <p>First, we’ve kept busy improving reliability and performance. Durable Objects are behind a number of new products being developed at Cloudflare, including powering <a href="/introducing-r2-object-storage/">R2 storage</a> and <a href="/cloudflare-waiting-room/">Cloudflare Waiting Room</a>.</p><p>Specifically, Waiting Room uses Durable Objects to provide a strongly consistent view of the current number of users attempting to access a given site globally.  Storing this frequently updated state in a traditional database would be difficult to scale and be significantly harder to run globally.</p><p>Our customers have also embraced Durable Objects. We’ve seen a major gaming company build their new backend architecture on Durable Objects — coordinating both individual game state and multiplayer game lobbies.  The ability to dynamically scale without managing servers or databases made Durable Objects an easy choice for them, letting them grow their game with a relatively small team.</p><p>Customers have built more applications — from status page monitors to collaborative whiteboard applications.  We’ve seen particular interest in using Durable Objects with WebSockets to create entirely responsive applications and have published a <a href="https://github.com/cloudflare/dog">reference architecture</a> to help customers build this out further.</p><p>We’ve also gotten better at operating the system, particularly in response to large volumes of requests. Durable Objects can now serve hundreds of thousands of requests per second across objects, and hundreds of requests on a single object, making them production-ready for even the most demanding customers.</p><p>We’ve shipped <a href="/supporting-jurisdictional-restrictions-for-durable-objects/">Jurisdictional Restrictions</a>, which bring the simplicity of scaling Durable Objects to compliance by letting developers tag a Durable Object with a region, ensuring it processes and stores data in that region.</p><p>We <a href="/durable-objects-easy-fast-correct-choose-three/">added a cache</a> in front of Durable Object storage requests, making read and write operations blazing fast while also making it easier to write correct concurrent code.</p><p>Beyond that, we’ve made a number of smaller improvements that included <a href="https://developers.cloudflare.com/workers/learning/using-durable-objects#uploading-a-durable-object-worker">simplified uploads of new Durable Objects classes</a>, a UI in the dashboard and support for <code>wrangler dev</code> and <code>wrangler tail</code> for live debugging.</p>
    <div>
      <h3>What’s next for Durable Objects?</h3>
      <a href="#whats-next-for-durable-objects">
        
      </a>
    </div>
    <p>We’re continuing to work on making Durable Objects the easiest platform for building infinitely-scalable applications.</p><p>Today, Durable Objects scale well when objects can be partitioned, but individual objects are limited to a single execution thread. Many workloads could be scaled across multiple threads, providing read-only access to an object’s state and choosing to only synchronize when mutating state. We’re calling this replication for Durable Objects, and we’re working on it now.</p><p>We’re also working on adding an API for a guaranteed callback to a Durable Object, letting developers wake a Durable Object at a specified time in the future to run a function. This simplifies lifecycle management, making it easy to build primitives like reliable queues on top of Durable Objects.</p><p>We’re also looking into how to better geo-distribute objects, including the vision for automatic migration of objects we talked about in our initial announcement.</p><p>Have something you’d like to see us add? Shoot us an <a>email</a> or a <a href="https://twitter.com/cloudflare">tweet</a>!</p>
    <div>
      <h3>How do I use Durable Objects?</h3>
      <a href="#how-do-i-use-durable-objects">
        
      </a>
    </div>
    <p>Head over to the Cloudflare Dashboard to enable Durable Objects and opt in to pricing, then check out our <a href="https://github.com/cloudflare/workers-chat-demo">sample chat application</a> and reference architecture <a href="https://github.com/cloudflare/dog">here</a>!</p><p>Happy building!</p> ]]></content:encoded>
            <category><![CDATA[Full Stack Week]]></category>
            <category><![CDATA[Durable Objects]]></category>
            <guid isPermaLink="false">3IEh3rewreHLWQ5OV9E4cd</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Workers adds support for two modern data platforms: MongoDB Atlas and Prisma]]></title>
            <link>https://blog.cloudflare.com/workers-adds-support-for-two-modern-data-platforms-mongodb-atlas-and-prisma/</link>
            <pubDate>Mon, 15 Nov 2021 13:59:09 GMT</pubDate>
            <description><![CDATA[ With built-in global deployments, insane scalability and the flexibility of JavaScript, more and more applications are choosing to build on our global platform. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>We’ve heard a common theme over the past year: developers want to build more of their applications on Workers. With built-in global deployments, insane scalability and the flexibility of JavaScript, more and more applications are choosing to build on our global platform.</p><p>To do so, developers need access to data. Our strategy for data on Workers has had three parts:</p><ul><li><p>One, to provide first-party solutions that are designed for infinite scale, like Workers KV and Durable Objects.</p></li><li><p>Two, to support a wide array of NoSQL databases that connect over HTTP, and to begin to build connections to data where it already lives today with <a href="/relational-database-connectors/">TCP Database Connectors</a>.</p></li><li><p>Three, to partner with best-of-breed data companies to bring their capabilities to the Workers platform.</p></li></ul><p>Today we’re excited to announce that, in addition to our existing partners Fauna and Macrometa, Cloudflare Workers has added support for Prisma and MongoDB Atlas. These data platforms are heavily demanded by developers — Prisma’s modern ORM brings support for Postgres, SQL Server, MySQL via their Prisma client, while MongoDB topped the ranks of integrations most demanded by our users.</p><p>Both clients are available from their respective authors, <a href="https://www.mongodb.com/developer/how-to/cloudflare-worker-rest-api-realm/?tck=cloudflare">Realm</a> for MongoDB and <a href="https://github.com/prisma/prisma">Prisma</a> for Prisma. You can begin using them right away by importing them into your Workers.</p>
    <div>
      <h3>What’s great about MongoDB?</h3>
      <a href="#whats-great-about-mongodb">
        
      </a>
    </div>
    <p>MongoDB is a database loved by developers — its document model makes it easy to start with, while transactions and a scale-out distributed systems architecture let it scale with your application.</p><p>MongoDB brings a robust query language, MQL, to developers on the Workers platform, supporting rich aggregations right within the database. MongoDB support is provided via the Realm SDK, which integrates directly with MongoDB Atlas — the easiest way to run MongoDB.</p><p>MongoDB Atlas also includes Global Clusters, perfect for creating a low-latency, geo-distributed MongoDB database to back your Workers.</p><p>Together with MongoDB, we’ve put together a demo application that you can play with on MongoDB’s <a href="https://www.mongodb.com/developer/how-to/cloudflare-worker-rest-api-realm/?tck=cloudflare">blog</a>. Check it out and let us know if you have questions!</p>
    <div>
      <h3>What’s great about Prisma?</h3>
      <a href="#whats-great-about-prisma">
        
      </a>
    </div>
    <p>Prisma is an ORM, or object-relational mapper, which transforms entries in a database into objects in code. What makes Prisma great is its ability to abstract away the complexities of working with the database — Prisma handles type-safety, schema migrations, query optimization and the actual interactions between your code and the database. Like Workers does for compute at the edge, Prisma makes managing your database dead-simple.</p><p>Prisma currently supports Postgres, MySQL, SQL Server, SQLite and MongoDB. These databases can be existing on any cloud provider or can be spun up on-demand on Heroku.</p><p>Prisma integrates with Workers via the <a href="https://www.prisma.io/docs/concepts/components/prisma-data-platform#prisma-data-proxy">Prisma Data Proxy</a>. After setting up the Proxy, you can import the Prisma client into your Workers script and define a schema to begin using any of the supported databases!</p>
    <div>
      <h3>What’s next?</h3>
      <a href="#whats-next">
        
      </a>
    </div>
    <p>Alongside our existing partnerships with Macrometa and Fauna, we’re excited to add the MongoDB and Prisma integrations to Worker’s growing library. If you have a data platform you’d like to use with Workers, <a>reach out to us</a>, and we’ll make it happen!</p> ]]></content:encoded>
            <category><![CDATA[Full Stack Week]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">2HWO1ocHKx0ShLhhWIWK3w</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Announcing Cloudflare R2 Storage: Rapid and Reliable Object Storage, minus the egress fees]]></title>
            <link>https://blog.cloudflare.com/introducing-r2-object-storage/</link>
            <pubDate>Tue, 28 Sep 2021 13:00:01 GMT</pubDate>
            <description><![CDATA[ Introducing Cloudflare’s S3-compatible Object Storage service, with zero egress bandwidth charges and automatic migration from S3-compatible services. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>We’re excited to announce Cloudflare R2 Storage! By giving developers the ability to store large amounts of unstructured data, we’re expanding what’s possible with Cloudflare while slashing the <a href="https://www.cloudflare.com/learning/cloud/what-are-data-egress-fees/">egress bandwidth fees</a> associated with typical <a href="https://www.cloudflare.com/learning/cloud/what-is-cloud-storage/">cloud storage</a> services to zero.</p><p><a href="https://www.cloudflare.com/developer-platform/products/r2/">Cloudflare R2 Storage</a> includes full S3 API compatibility, working with existing tools and applications as built.</p><p>Let’s get into the R2 details.</p>
    <div>
      <h3>R2 means “Really Requestable”</h3>
      <a href="#r2-means-really-requestable">
        
      </a>
    </div>
    <p><a href="https://www.cloudflare.com/learning/cloud/what-is-object-storage/">Object Storage</a>, sometimes referred to as <a href="https://www.cloudflare.com/learning/cloud/what-is-blob-storage/">blob storage</a>, stores arbitrarily large, unstructured files. Object storage is well suited to storing everything from media files or log files to application-specific metadata, all retrievable with consistent <a href="https://www.cloudflare.com/learning/performance/glossary/what-is-latency/">latency</a>, high durability, and limitless capacity.</p><p>The most familiar API for Object Storage, and the API R2 implements, is Amazon’s Simple Storage Service (S3). When S3 launched in 2006, cloud storage services were a godsend for developers. It didn’t happen overnight, but over the last fifteen years, developers have embraced cloud storage and its promise of infinite storage space.</p><p>As transformative as cloud storage has been, a downside emerged: actually getting your data back. Over time, companies have amassed massive amounts of data on cloud provider networks. When they go to retrieve that data, they’re hit with <a href="/aws-egregious-egress/">massive egress fees</a> that don’t correspond to any customer value — just a tax developers have grown accustomed to paying.</p><p>Enter R2.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7ueoC6FVML11Wrrpr2ELlt/38ceacbacb2b5891ad12f2e52ee0b666/unnamed-1.png" />
            
            </figure><p>Traditional object storage charges developers for three things: bandwidth, storage size and storage operations.</p><p>R2 builds on Cloudflare’s commitment to the <a href="https://www.cloudflare.com/bandwidth-alliance/">Bandwidth Alliance</a>, providing zero-cost egress for stored objects — no matter your request rate.  <a href="https://www.cloudflare.com/the-net/cloud-egress-fees-challenge-future-ai/">Egress bandwidth</a> is often the largest charge for developers utilizing object storage and is also the hardest charge to predict.  Eliminating it is a huge win for open-access to data stored in the cloud.</p><p>That doesn’t mean we are shifting bandwidth costs elsewhere. Cloudflare R2 will be priced at $0.015 per GB of data stored per month — significantly cheaper than major incumbent providers.</p><p>Infrequent access to objects is often trivial for providers to support yet incurs the same per-operation charges. We don’t think it’s fair that typical object storage bills a developer making one request a second the same rate as an enterprise making thousands of requests a second — or frequently a higher rate when considering negotiated volume discounts.</p><p>On the flip side, providers designed for infrequent access typically can’t scale to heavy usage.</p><p>R2 will zero-rate infrequent storage operations under a threshold — currently planned to be in the single digit requests per second range. Above this range, R2 will charge significantly less per-operation than the major providers. Our object storage will be extremely inexpensive for infrequent access and yet capable of and cheaper than major incumbent providers at scale.</p><p>This cheaper price doesn’t come with reduced scalability. Behind the scenes, R2 automatically and intelligently manages the tiering of data to drive both performance at peak load and low-cost for infrequently requested objects.  We’ve gotten rid of complex, manual tiering policies in favor of what developers have always wanted out of object storage: limitless scale at the lowest possible cost.</p>
    <div>
      <h3>R2 means “Repositioning Records”</h3>
      <a href="#r2-means-repositioning-records">
        
      </a>
    </div>
    <p>Zero egress means you can get objects out easily, but what about putting objects in? <a href="https://www.cloudflare.com/learning/cloud/what-is-data-migration/">Migrating data</a> across cloud providers, even if they both support the complete S3 API, is error-prone and costly.</p><p>To make this easier for you, without requiring you to change any of your tooling, Cloudflare will offer a migration service from <a href="https://www.cloudflare.com/developer-platform/solutions/s3-compatible-object-storage/">S3-compatible cloud storage services</a>. The migrator will reduce the toil of manually uploading objects, by incrementally copying objects to R2 as they are requested. This <a href="https://www.cloudflare.com/learning/cloud/what-is-multicloud/">multi-cloud architecture</a> allows you to start serving objects from R2 as they migrate, saving you money while offering the benefits of multi-cloud.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3qzLEoSEY7elrYpbFtYEkI/a4268c4a8af9903ea459015dfc655222/Two-Paths-Diverged-5.png" />
            
            </figure><p>Our vision for R2 includes multi-region storage that automatically replicates objects to the locations they’re frequently requested from. As with <a href="/supporting-jurisdictional-restrictions-for-durable-objects/">Durable Objects</a>, we plan on introducing jurisdictional restrictions that allow developers to comply with complex <a href="https://www.cloudflare.com/learning/privacy/what-is-data-sovereignty/">data sovereignty requirements</a> via a simple API.</p>
    <div>
      <h3>R2 means “Ridiculously Reliable”</h3>
      <a href="#r2-means-ridiculously-reliable">
        
      </a>
    </div>
    <p>The core of what makes Object Storage great is reliability — we designed R2 for data durability and resilience at its core. R2 will provide 99.999999999% (eleven 9’s) of annual durability, which describes the likelihood of data loss. If you store 1,000,000 objects on R2, you can expect to lose one once every 100,000 years — the same level of durability as other major providers. R2 will be resistant to regional failures, replicating objects multiple times for high availability.</p><p>R2 is designed with redundancy across a large number of regions for reliability. We plan on starting from automatic global distribution and adding back region-specific controls for when data has to be stored locally, as described above.</p>
    <div>
      <h3>R2 means “Radically Reprogrammable”</h3>
      <a href="#r2-means-radically-reprogrammable">
        
      </a>
    </div>
    <p>R2 is fully integrated with the <a href="https://workers.cloudflare.com/">Cloudflare Workers</a> serverless runtime. You can bind a Worker to a specific bucket, dynamically transforming objects as they are written to or read from storage buckets. The deep integration between Workers and R2 makes building data pipelines and manipulating objects incredibly easy.</p><p>Cloudflare R2 is designed to easily integrate with the rest of Cloudflare's products. As a few examples, our plan is to allow Durable Objects to be configured with R2 as a backup target, and provide automatic integration between R2 and Cloudflare cache to greatly extend cache lifetimes for infrequently changing objects.</p>
    <div>
      <h3>What will you be able to build with Cloudflare R2?</h3>
      <a href="#what-will-you-be-able-to-build-with-cloudflare-r2">
        
      </a>
    </div>
    <p>There’s a lot you can do with long-term storage, especially with access to the Workers compute platform just alongside it.</p><p>For example, streaming data from a large number of IoT devices becomes a breeze with R2. Starting with a Worker to transform and manipulate the data, R2 can ingest large volumes of sensor data and store it at low cost. With no egress fees, it becomes simple to migrate volumes of data to multiple databases and analytics solutions as needed, dramatically reducing storage costs. With the ability to run a Worker on the outgoing data as well, the data pipeline itself is more flexible.</p><p>R2 is also a great place for CDN assets and large media files. For large files, R2 can significantly extend cache lifetimes while dramatically slashing egress bills. Combined with the Cache API and Workers, content can be dynamically cached for low-latency access around the globe.</p><p>More than anything, R2’s lack of egress bandwidth charges makes it ideal for storing content that’s accessed frequently. Today, R2 scales well to handle heavy request loads, dynamically tiering your objects to provide the best performance at the lowest cost. This dynamic tiering allows us to offer the <a href="https://r2-calculator.cloudflare.com/">lowest prices</a> while supporting peak performance — with no user configuration required.</p>
    <div>
      <h3>Accessing Cloudflare R2</h3>
      <a href="#accessing-cloudflare-r2">
        
      </a>
    </div>
    <p>R2 is currently under development — you can sign up <a href="https://dash.cloudflare.com/?to=/:account/r2/plans">here</a> to join the waitlist for access. We’re excited to work with a number of earlier users to refine and test the product. We’ll be <a href="/r2-open-beta/">announcing an open beta</a> where any user will be able to sign up for the service soon.</p><p>We’re excited to continue to build the product and push towards open beta, and we have big ideas for what the future of storage at Cloudflare’s edge could look like. If you’re a distributed systems engineer who wants to help us build the future of state at the edge, <a href="https://www.cloudflare.com/careers/jobs/?department=Emerging%20Technology%20and%20Incubation&amp;location=default">come work with us</a>!</p> ]]></content:encoded>
            <category><![CDATA[Birthday Week]]></category>
            <category><![CDATA[Storage]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">2qGzoicoJ6a44dAiisHcf5</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Announcing Cloudflare’s Database Partners]]></title>
            <link>https://blog.cloudflare.com/partnership-announcement-db/</link>
            <pubDate>Fri, 16 Apr 2021 13:00:00 GMT</pubDate>
            <description><![CDATA[ Cloudflare introduces Macrometa and Fauna as Edge database partners and adds database connectors for DynamoDB and Aurora to Cloudflare Workers, expanding what developers can build at the edge. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Cloudflare Workers is the easiest way for developers to deploy their application’s code with performance, scale and security baked in. No configuration necessary. Worker code scales to serve billions of requests close to your users across Cloudflare’s 200+ data centers.</p><p>But that’s not the only interesting problem we need to solve. Every application has two parts: code and state.</p><p>State isn’t always the easiest to work in a massive distributed system. When an application runs in 200+ data centers simultaneously, there’s an inherent tradeoff between distributing the data for better performance, availability, scale, and guaranteeing that all data centers see the same data at a given point in time.</p><p>Our goal is to make state at the edge seamless. We started that journey with Workers KV, which provides low-latency access to globally distributed data. We’re since added Durable Objects, with strong consistency and the ability to design coordination patterns on top of Workers. We’re continuing to invest in and build out these products.</p><p>However, some use cases aren’t easily implemented with Workers KV or Durable Objects. Think querying complex datasets, or communicating with an existing system-of-record. Even if we built this functionality ourselves, there will always be customers who want to use a different tool for data storage and access.</p><p>Today, we’re making our data strategy clear so that developers can build on Workers with confidence. First, we’re announcing a partnership with two distributed data companies, Macrometa and Fauna, to help developers choose an edge-first database when they build a new application on Workers. Next, we’ve introduced tutorials and guides for databases that already support HTTP connections to make connecting to existing databases even easier.</p><p>With this, the Workers runtime is the easiest way to handle both parts of your application that matter: code and state.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/CSyzDOiAvnB2QVk8poDm6/6950221805237b8a5f400b31bfa167ad/Screenshot-2021-04-15-at-21.52.09.png" />
            
            </figure><p>Cloudflare is excited to announce a partnership for global data with <a href="https://www.macrometa.com/cloudflare">Macrometa</a>. Macrometa provides a serverless data platform for developers to build rich, geo-distributed, stateful applications on the edge with Cloudflare Workers. The Macrometa Global Data Network (GDN) is an ultra-fast, globally replicated noSQL database with integrated features for search, pub/sub, streams, and stream processing.</p><p>Macrometa complements Cloudflare Workers by enabling stateful functions to run, store, query, mutate, and serve data globally with local read/write latencies. Tables replicate across Macrometa’s global data centers with configurable consistency and without additional code, cost, or complexity. Data calls between Workers and Macrometa are automatically routed and served from the closest Macrometa region relative to the Cloudflare Worker invocation. <i>We have seen that end-to-end latency for a database request from a client to the edge and back is &lt;75ms for 99th percentile.</i></p><p>Macrometa combines typically disparate data services and APIs (each with their own data model and copy of data) into a single, integrated, and intuitive data API (with a single, unified common data set and model). At a high level, one can think of Macrometa as combining a noSQL database together with pub/sub, streaming data and event processing along with search into a seamless, globally replicated, low latency data platform.</p><p>The following multimodal interfaces are available to the developer via a SQL-like query language:</p><ul><li><p>Key/value database with high write performance, low latencies, and Time to Live (TTL) support</p></li><li><p>JSON document database with a SQL-like query language</p></li><li><p>Graph database for storing and retrieving relationships between entities</p></li><li><p>DynamoDB API compatible database</p></li><li><p>Low latency edge cache for database and API results with global cache invalidation and Time to Live (TTL)</p></li><li><p>Search</p></li><li><p>Pub/Sub &amp; queues with Kafka, Pulsar and MQTT message compatibility</p></li><li><p>Streaming data and complex event processing - evaluate events, aggregate, enrich, filter, summarize, pattern match on stream data in real time.</p></li></ul><p>Apps written using Cloudflare Workers consume Macrometa via a JavaScript SDK or REST API. Developers have a choice of using one of two SDKs tightly integrated with Cloudflare Workers:</p><ul><li><p>A Cloudflare Worker specific <a href="https://github.com/Macrometacorp/jsC8">JavaScript SDK</a> which provides the full set of capabilities mentioned above</p></li><li><p>The Dynamo <a href="https://github.com/Macrometacorp/mmdynamo">client SDK</a> that enables developers to use Macrometa as a drop-in replacement AWS DynamoDB (or as an edge cache).</p></li></ul>
    <div>
      <h3>Example Use-cases</h3>
      <a href="#example-use-cases">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/71wQKtT8amSCgQjPfRFK2U/28cade24733ee9a31e56ea8074d57e25/image2-16.png" />
            
            </figure><blockquote><p>With Cloudflare and Macrometa, developers can now build and deliver powerful and compelling data-driven experiences in a way that the centralized clouds will never be able to. The world deserves a better cloud - an edge cloud.- <b>Chetan Venkatesh, Co-founder/CEO, Macrometa</b></p></blockquote><p>If you are interested in learning more about using Macrometa and Cloudflare Workers together, please register <a href="https://forms.gle/AU2fcDB5km8JXwZ17">here</a>.</p>
    <div>
      <h3>Case study for Cloudflare Workers + Macrometa: A bookstore demo app</h3>
      <a href="#case-study-for-cloudflare-workers-macrometa-a-bookstore-demo-app">
        
      </a>
    </div>
    <p>To showcase the power and performance of Cloudflare and Macrometa together, we re-built AWS’s demo application — a complete E-Commerce backend that serves an online bookstore. eCommerce backends for large global sites are complex and require many different types of databases. These complex architectures are necessary to store, perform multi-table or multi-data store queries, and serve product catalogs, pricing, search, recommendations, order management, cart operations, fulfillment, etc.</p><p>The bookstore is a serverless app built as a Cloudflare Worker to serve a React single page application and uses Macrometa for storing and serving product/catalog data, orders, cart operations, etc. It uses streams and complex event processing to provide a real-time leaderboard of the top-selling books and uses the Macrometa search service to deliver near-instant search results. You can test drive the end-user experience <a href="https://bookstore.macrometadev.workers.dev/">here</a>. Our tests show orders of magnitude latency improvement for a user vs. the same use case built on a legacy cloud provider.</p><p>To check out the source code, head over to <a href="https://github.com/Macrometacorp/tutorial-cloudflare-bookstore">GitHub</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/635Nx7KtkRks6ePcinqvMS/5077193b7579bb361fd5150b4d929741/Database-partnership-Macrometa.png" />
            
            </figure><hr />
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2TKgQ0MYyU7J7EPP7vGfVI/5110784011c7a3e8feb0982bf16e2dbe/Screenshot-2021-04-15-at-21.54.50.png" />
            
            </figure><p>Cloudflare is excited to announce a new partnership for transactional workloads with <a href="https://fauna.com/?utm_source=Cloudflare&amp;utm_medium=referral&amp;utm_campaign=Cloudflare-Blog-Developer-Week">Fauna</a>, a data API for modern applications. Together, Cloudflare and Fauna enable developers to build more powerful stateful applications that scale dynamically and maintain strong consistency without any additional configuration.</p><p>Fauna is a flexible, developer-friendly, global transactional database delivered as a secure, global, cloud API — no database operations required. With Fauna, developers can simplify code and ship faster by replacing their database infrastructure with a data API that combines the flexibility of relational and document-centric querying with the power of custom business logic, and the ease of <a href="https://docs.fauna.com/fauna/current/tutorials/graphql/?utm_source=Cloudflare&amp;utm_medium=referral&amp;utm_campaign=Cloudflare-Blog-Developer-Week">GraphQL</a> at the edge.</p><p>Fauna is a simple yet scalable backend for applications built on Cloudflare’s services such as Workers and Pages. By leveraging a web-native (HTTP-based) invocation model with support for modern <a href="https://docs.fauna.com/fauna/current/security/?utm_source=Cloudflare&amp;utm_medium=referral&amp;utm_campaign=Cloudflare-Blog-Developer-Week">security</a> protocols, Fauna eliminates the connection limits introduced by traditional databases and can be integrated directly with serverless functions and applications running at the edge.</p><p>Fauna complements Cloudflare KV and Durable Objects by providing a global, queryable, strongly consistent persistence layer for the mission-critical data required to build modern web and mobile applications. It’s underlying globally distributed storage engine is fast, consistent, and reliable. Developers can rely on Fauna’s <a href="https://fauna.com/blog/consistency-without-clocks-faunadb-transaction-protocol">unique</a> global transactional capabilities to ensure that mission-critical business data is always strongly consistent with minimal latency.</p><p>Fauna, a serverless offering, is easy to get started with for <a href="https://fauna.com/pricing??utm_source=Cloudflare&amp;utm_medium=referral&amp;utm_campaign=Cloudflare-Blog-Developer-Week">free</a>, and lets developers experience freedom from database operations at any scale. Fauna is available through GraphQL or <a href="https://docs.fauna.com/fauna/current/start/?utm_source=Cloudflare&amp;utm_medium=referral&amp;utm_campaign=Cloudflare-Blog-Developer-Week">drivers</a> that work with Workers in several popular programming languages.</p><p>If you’re interested in learning how to use Fauna with Cloudflare Workers, please visit this step-by-step <a href="https://fauna.com/blog/getting-started-with-fauna-and-cloudflare-workers">tutorial</a> for a hands-on experience! If you are interested in learning more about using Cloudflare Workers and Fauna together, please register <a href="https://forms.gle/7qbxtgtdM3fmaws69">here</a>.</p><blockquote><p>The integration of Cloudflare workers with Fauna allows our joint customers to simply and cost effectively bring both data and logic to the edge. Fauna was developed from the ground up as a globally distributed, serverless database and when combined with Cloudflare Workers serverless compute fabric provides developers with a simple, yet powerful abstraction over the complexities of distributed infrastructure.- <b>Evan Weaver, Co-founder/CTO, Fauna</b></p></blockquote>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/29MrungXYppuMlljdbfgGm/110e8abffff4b4414f3b3b251afc7ef7/unnamed-3.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3iXAZ32676Ax7Pot9FscZ6/5384c0f2caf52e0ef1e02f0164dff481/unnamed--1--1.png" />
            
            </figure>
    <div>
      <h3>Case study for Cloudflare Workers + Fauna: MeetKai, An AI-Powered Voice Assistant</h3>
      <a href="#case-study-for-cloudflare-workers-fauna-meetkai-an-ai-powered-voice-assistant">
        
      </a>
    </div>
    <p>Let’s take a look at a current customer of Fauna and Cloudflare who benefits from Fauna’s ability to offer globally-distributed transactional data access at low latency.</p>
    <div>
      <h3>MeetKai</h3>
      <a href="#meetkai">
        
      </a>
    </div>
    <p>MeetKai is an AI-powered voice assistant that makes a consumer’s life easier through conversation, personalization &amp; curation. Deployed by enterprises with Monthly Active Users in the hundred million plus range, MeetKai uses Fauna and Cloudflare together to deliver a responsive, global experience.</p><p>Cloudflare Workers act as the proxy to all downstream requests. Doing so enables MeetKai to perform much smarter load balancing at the edge, using the Worker rather than some other competing solutions. When combined with Fauna, this serverless-first approach delivers scale and performance at predictable costs, while reducing time to market. By pushing data to the edge with Fauna, MeetKai are able to inject personalization information before a request ever hits the backend! Learn more about how MeetKai uses Cloudflare Workers and Fauna in this technical case <a href="https://fauna.com/blog/meetkai-building-search-with-fauna-and-cloudflare-workers">study</a>.</p><blockquote><p>Combining Cloudflare Workers with Fauna allows us to bring both data and logic to the edge, enabling us to deliver a differentiated search engine while still meeting high operations requirements in latency and uptime -- all at a fraction of the cost and complexity of non-serverless solutions.- <b>James Kaplan, Founder/CEO MeetKai</b></p></blockquote>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6J9Xq1ifhjSNFBQdGPs4fV/3935eb42b4e90cad094ab7201899ec45/unnamed--2-.png" />
            
            </figure>
    <div>
      <h3>Connecting to existing databases</h3>
      <a href="#connecting-to-existing-databases">
        
      </a>
    </div>
    <p>In addition to our partners, Cloudflare Workers can work with any database that accepts connections over HTTP.</p><p>In particular, we’ve documented connections to both DynamoDB and AWS Aurora, supporting either Postgres or MySQL. These connections let you access already existing databases directly from Cloudflare’s edge, making it easy to build new applications on top of existing data.</p><p><a href="https://github.com/cloudflare/workers-aws-template">Connect a Worker to DynamoDB</a></p><p><a href="https://github.com/cloudflare/workers-aws-template">Connect a Worker to AWS Aurora</a></p><p>In addition, we’ll be adding more tutorials to document how to connect to other databases that work with Workers, like Google’s Cloud Firestore.</p>
    <div>
      <h3>Advancing state at the edge</h3>
      <a href="#advancing-state-at-the-edge">
        
      </a>
    </div>
    <p>The Workers platform has built a new paradigm for developers for serverless. Across our own Durable Objects and Workers KV, our partner databases, and connections to existing providers, we’re bringing that same paradigm shift to state at the edge. As we continue to build out our database partnerships and data platform, we want to hear from you! Send your ideas and feedback to the <a>Workers Product</a> team to let us know what databases and features you’d most like to see us build.</p> ]]></content:encoded>
            <category><![CDATA[Developer Week]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Partners]]></category>
            <category><![CDATA[Edge Database]]></category>
            <category><![CDATA[Serverless]]></category>
            <guid isPermaLink="false">36KSdDjru9mW0UorDxR5IH</guid>
            <dc:creator>Greg McKeon</dc:creator>
            <dc:creator>Abhi Das</dc:creator>
        </item>
        <item>
            <title><![CDATA[Durable Objects, now in Open Beta]]></title>
            <link>https://blog.cloudflare.com/durable-objects-open-beta/</link>
            <pubDate>Wed, 31 Mar 2021 13:00:00 GMT</pubDate>
            <description><![CDATA[ As of today, Durable Objects beta access is available to anyone with a Cloudflare Workers® subscription. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Back in September, we <a href="/introducing-workers-durable-objects/">announced</a> Durable Objects - a new paradigm for stateful serverless.</p><p>Since then, we’ve seen incredible demand and countless unlocked opportunities on our platform. We’ve watched large enterprises build applications from complex API features to real-time games in a matter of days from inception to launch. We’ve heard from developers that Durable Objects lets them spend time they used to waste configuring and deploying databases on building features for their apps. More than anything, we’ve heard that you want to start building with Durable Objects now.</p><p>As of today, Durable Objects beta access is available to anyone with a Cloudflare Workers® subscription - you can enable them now in the <a href="https://dash.cloudflare.com/">dashboard</a> by navigating to “Workers” and then “Durable Objects”. You can also upgrade to the <a href="https://github.com/cloudflare/wrangler/releases/tag/v1.15.0-custom-builds-rc.2">latest version of Wrangler</a> to deploy Durable Objects!</p><p>Durable Objects are still in beta and are being made available to you for testing purposes. Storage is capped per-account at 10 GB of data, and there is no associated SLA for Object availability or durability.</p><p><strong><a href="https://dash.cloudflare.com">Enable beta access now »</a></strong></p>
    <div>
      <h3>What are Durable Objects?</h3>
      <a href="#what-are-durable-objects">
        
      </a>
    </div>
    <p>Durable Objects provide two things: coordination across multiple Workers and strongly consistent edge storage.</p><p>Normally Cloudflare’s network executes a Worker wherever the client’s network request is terminated. This means there can be many instances of your Worker running at a given time all over the world, shown below.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7KDw6tGDQlvRrae4PS7AGM/eb4cb08f52b3a5f989531ac06214894c/image3-54.png" />
            
            </figure><p>By contrast, a Durable Object is defined by a JavaScript class and an ID. There is only ever one instance of a Durable Object with a given ID running anywhere in the world. All Workers making subrequests for the Durable Object with that ID are routed to the same instance - letting them coordinate across multiple requests. The Durable Object instance can then make requests to downstream APIs and store data with our strongly consistent storage API.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5HLQ06eTIRyAl30bPTlVov/975cd2e8aa2360c4eab7e4c5a6d440ef/image1-65.png" />
            
            </figure><p>In this example shown above, we’ve chosen our application’s user ID as the Durable Object’s ID.  When a Worker needs access to a specific user’s data, they can contact the Object with that user’s ID.  That Object can then handle API calls and data access specific to that individual user.</p><p>Remember that Durable Objects scale incredibly well across multiple Object IDs, but that each Object itself is backed by a single-thread. You should be careful to choose an ID for your Objects that minimizes the number of requests processed by a single object.  In our example above, if our user API grew to be too complicated, we might decide to have a separate ID for each combination of a user ID and an API endpoint to host in a single object.</p><p>For more on Durable Objects, see the <a href="https://developers.cloudflare.com/workers/learning/using-durable-objects">docs</a> and the announcement <a href="/introducing-workers-durable-objects/">blog</a>.</p>
    <div>
      <h3>Pricing</h3>
      <a href="#pricing">
        
      </a>
    </div>
    <p>While there’s no charge to use Durable Objects during the beta period, we want to share pricing, so you can build your applications with confidence.</p><p>When you use Durable Objects, you are billed for the compute time your Object uses as well as the storage API operations your Object performs.</p><p>Durable Objects are significantly cheaper than comparable compute and storage offerings from the other major cloud providers.</p><p>As announced on the Workers Unbound <a href="/introducing-workers-unbound/">blog</a>, Durable Objects bills the standard Workers' platform rates for long-running compute time.</p><table><tr><td><p>
</p></td><td><p><b>Compute</b></p></td><td><p></p></td></tr><tr><td><p></p></td><td><p>Durable Objects</p></td><td><p>AWS Lambda</p></td></tr><tr><td><p>Price per request</p></td><td><p>\$0.15 / MM</p></td><td><p>\$0.20-0.28 / MM</p></td></tr><tr><td><p>Compute ($ per MM GB-sec)</p></td><td><p>\$12.50</p></td><td><p>\$16.67 - \$22.92 (depending on geo)</p></td></tr><tr><td><p>Data Transfer</p></td><td><p>\$0.09 / GB</p></td><td><p>\$0.09/GB - \$0.15/GB (depending on geo)</p></td></tr></table><p>*Based on pricing disclosed on aws.amazon.com/lambda/pricing as of March 16, 2021. AWS’ published duration pricing is based on 1 GB-sec, which has been multiplied by one million on this table for readability. AWS price ranges reflect different regional pricing. All prices rounded to the nearest two decimal places. Data Transfer for AWS is based on Data Transfer OUT From Amazon EC2 to Internet above 1 GB / month, for up to 9.999 TB / month.</p><p>Durable Objects charges per storage operation for reads, writes and deletes and per GB-Month for data stored. Operations are metered in 4 KB increments - for example, an 8 KB read or write would be billed as two operations. When compared to AWS DynamoDB, Durable Objects charge less for every type of operation, and depending on the size of your operations, your savings could be significant. All price comparisons we’re showing below are based on single-region, strongly consistent DynamoDB storage. AWS charges extra for multi-region and transactionally consistent storage, which is already included for Durable Objects. If you use these features in DynamoDB, your savings will be even greater.</p><table><tr><td><p>
</p></td><td><p><b>Storage</b></p></td><td><p></p></td></tr><tr><td><p></p></td><td><p>Durable Objects</p></td><td><p>AWS DynamoDB</p></td></tr><tr><td><p>Price per MM read request</p></td><td><p>\$0.20 / MM / 4 KB</p></td><td><p>\$0.25 - \$0.375 / MM / 4 KB</p></td></tr><tr><td><p>Price per MM write request</p></td><td><p>\$1.00 / MM / 4 KB</p></td><td><p>\$1.25 - \$1.88 / MM / 1 KB</p></td></tr><tr><td><p>Price per MM delete request</p></td><td><p>\$1.00 / MM regardless of size</p></td><td><p>\$1.25 - \$1.88 / MM / 1 KB</p></td></tr><tr><td><p>Price per GB stored data</p></td><td><p>\$0.20 / GB</p></td><td><p>\$0.25 / GB</p></td></tr></table><p>*Based on pricing disclosed on aws.amazon.com/dynamodb/pricing/on-demand/ as of March 16, 2021. AWS price ranges reflect different regional pricing. All prices rounded to the nearest two decimal places.</p><p>We chose to meter our requests in 4 KB increments across the board to provide the lowest prices with the greatest flexibility. Deletes do not have a size limit.</p><p>We’ve seen that the vast majority of requests are actually smaller than 4 KB in size - Workers KV, our global, eventually consistent data store, has a median value size in the low single KB range.</p>
    <div>
      <h3>Giving developers more for less</h3>
      <a href="#giving-developers-more-for-less">
        
      </a>
    </div>
    <p>Not only are Durable Objects less expensive, they have a unique design that lets you do more than a traditional database layer.</p><p>Each Durable Object runs custom code that you write. After your Durable Object makes a request to a downstream API or to our storage API, the value can be cached in-memory for no-cost, low latency lookups.</p><p>Unlike major cloud-provider databases, Durable Objects are replicated to multiple distinct regions by default for high availability with no additional cost. With other cloud providers, this feature generally drives up costs - not to mention the increased complexity of self-managing multiple regions.</p><p>Durable Objects also provide strong consistency across operations by default. While many systems charge more for higher levels of consistency, running transactionally consistent storage from a Durable Object comes at no additional charge.</p>
    <div>
      <h3>Building together</h3>
      <a href="#building-together">
        
      </a>
    </div>
    <p>Since announcing Durable Objects, we’ve continued to add features to the platform, including:</p><ul><li><p>Smarter initial placement for user-named Objects, for lower latency access after initial creation.</p></li><li><p><a href="/supporting-jurisdictional-restrictions-for-durable-objects/">Jurisdictional Restrictions</a>, allowing developers to restrict their Durable Objects to only run and store data in specific regions. This helps with compliance with data localization obligations.</p></li><li><p>Wrangler support for uploading Durable Objects.</p></li><li><p>Platform stability and increased capacity.</p></li></ul><p>As we continue to add to the platform, we’re excited to see what you’re building as well. Come hang out in <a href="https://discord.gg/TGG8Fw4zKP">our Discord</a> to ask questions and share what you’re building on Durable Objects!</p>
    <div>
      <h3>Watch on Cloudflare TV</h3>
      <a href="#watch-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div>
<p></p><p></p> ]]></content:encoded>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Durable Objects]]></category>
            <category><![CDATA[Beta]]></category>
            <category><![CDATA[Serverless]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Wrangler]]></category>
            <guid isPermaLink="false">4WhPejVq17N90XRDJfKiig</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Supporting Jurisdictional Restrictions for Durable Objects]]></title>
            <link>https://blog.cloudflare.com/supporting-jurisdictional-restrictions-for-durable-objects/</link>
            <pubDate>Sat, 12 Dec 2020 15:39:05 GMT</pubDate>
            <description><![CDATA[ We’re launching Jurisdictional Restrictions for Durable Objects, making it easy for developers to build serverless, stateful applications that comply with data localization obligations. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Over the past week, you’ve heard how Cloudflare is making it easy for our customers to control where their data is stored and protected.</p><p>We’re not the only ones building these data controls. Around the world, companies are working to figure out where and how to store customer data in a way that is compliant with data localization obligations. For developers, this means new deployment models and new headaches — wrangling infrastructure in multiple regions, partitioning user data based on location, and staying on top of the latest rules from regulators.</p><p>Durable Objects, currently in limited beta, already make it easy for customers to manage state on Cloudflare Workers without worrying about provisioning infrastructure. Today, we’re announcing Jurisdictional Restrictions for Durable Objects, which ensure that a Durable Object only stores and processes data in a given geographical region. Jurisdictional Restrictions make it easy for developers to build serverless, stateful applications that not only comply with today’s regulations, but can handle new and updated policies as new regulations are added.</p>
    <div>
      <h3>How Jurisdictional Restrictions Work</h3>
      <a href="#how-jurisdictional-restrictions-work">
        
      </a>
    </div>
    <p>When creating a Durable Object, developers generate a unique ID that lets a Cloudflare Worker communicate with the Object.</p><p>Let’s say I want to create a Durable Object that represents a specific user of my application:</p>
            <pre><code>async function handle(request) {
    let objectId = USERS.newUniqueId();
    let user = await USERS.get(objectId);
}</code></pre>
            <p>The unique ID encodes metadata for the Workers runtime, including a mapping to a specific Cloudflare data center. That data center is responsible for handling the creation of the Object and maintaining a routing table entry, so that a Worker can communicate with the Object if the Object migrates to another Cloudflare data center.</p><p>If the user is an EU data subject, I may want to ensure that the Durable Object that handles their data only stores and processes data inside of the EU. I can do that when I generate their Object ID, which encodes a restriction that this Durable Object can only be handled by a data center in the EU.</p>
            <pre><code>async function handle(request) {
    let objectId = USERS.newUniqueId({jurisdiction: "eu"});
    let user = await USERS.get(objectId);
}</code></pre>
            <p>There are no servers to spin up and no databases to maintain. Handling a new set of regional restrictions will be as easy as passing a different string at ID generation.</p><p>Today, we only support the <code>EU</code> jurisdiction, but we’ll be adding more based on developer demand.</p><p>By setting restrictions at a per-object level, it becomes easy to ensure compliance without sacrificing developer productivity. Applications running on Durable Objects just need to identify the jurisdictional rules a given Object should follow and set the corresponding rule at creation time. Gone is the need to run multiple clusters of infrastructure across cloud provider regions to stay compliant — Durable Objects are both globally accessible and capable of partitioning state with no infrastructure overhead.</p><p>In the future, we’ll add additional features to Jurisdictional Restrictions — including the ability to migrate your Objects between Jurisdictions to handle changes in regulations.</p>
    <div>
      <h3>Under the hood with Durable Object ID generation</h3>
      <a href="#under-the-hood-with-durable-object-id-generation">
        
      </a>
    </div>
    <p>Durable Objects support two types of IDs: system-generated, where the system creates a unique ID for you, and user-generated, where a user passes in an identifier to access the Durable Object. You can think of the user-provided identifier as a seed to a hash function that determines the data center the object starts in.</p><p>By default with system-generated IDs, we construct the ID so that it maps to a data center near the Worker that generated the ID. This data center is responsible for creating the Object and storing a routing record if that Object migrates.</p><p>If the user passes in a Jurisdictional Restriction, we instead encode in the ID a mapping to a jurisdiction, which encodes a list of data centers that adhere to the rules of the Jurisdictional Restriction. We guarantee that the data center we select for creating the Object is in this list and that we will not migrate the Object to a data center that isn’t in this list. In the case of the ‘eu’ jurisdiction, that maps to one of Cloudflare’s data centers in the EU.</p><p>For user-generated IDs, though, we cannot encode this data in the ID, since we must use the string the user passed us to generate the ID! This is because requests may originate anywhere in the world, and they need to know where to find an Object without depending on coordination. For now, this means we do not support Jurisdictional Restrictions in combination with user-generated IDs.</p>
    <div>
      <h3>Join the Durable Objects limited beta</h3>
      <a href="#join-the-durable-objects-limited-beta">
        
      </a>
    </div>
    <p>Durable Objects are currently in an invite-only beta, while we scale up our systems and build out additional features. If you’re interested in using Durable Objects to meet your compliance requirements, reach out to us with your use case!</p><p><a href="http://www.cloudflare.com/cloudflare-workers-durable-objects-beta"><b>Request a beta invite</b></a></p> ]]></content:encoded>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Serverless]]></category>
            <guid isPermaLink="false">UtRXjj88qh6DFXE256f4X</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
        <item>
            <title><![CDATA[Workers KV - free to try, with increased limits!]]></title>
            <link>https://blog.cloudflare.com/workers-kv-free-tier/</link>
            <pubDate>Mon, 16 Nov 2020 20:00:00 GMT</pubDate>
            <description><![CDATA[ Announcing a Free Tier for Workers KV that opens up global, low-latency data storage to every developer on the Workers platform. ]]></description>
            <content:encoded><![CDATA[ 
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5mRIDbFJHlqdDBXtLj9LBg/6e75009c6b894f44795e904e64b12de3/Workers-KV-transparent.png" />
            
            </figure><p>In May 2019, we launched <a href="https://www.cloudflare.com/products/workers-kv/">Workers KV</a>, letting developers store key-value data and make that data globally accessible from Workers running in Cloudflare’s over 200 data centers.</p><p>Today, we’re announcing a Free Tier for Workers KV that opens up global, low-latency data storage to every developer on the Workers platform. Additionally, to expand Workers KV’s use cases even further, we’re also raising the maximum value size from 10 MB to 25 MB. You can now write an application that serves larger static files directly or JSON blobs directly from KV.</p><p>Together with our announcement of the <a href="/introducing-workers-durable-objects">Durable Objects limited beta last month</a>, the Workers platform continues to move toward providing storage solutions for applications that are globally deployed as easily as an application running in a single data center today.</p>
    <div>
      <h3>What are the new free tier limits?</h3>
      <a href="#what-are-the-new-free-tier-limits">
        
      </a>
    </div>
    <p>The free tier includes 100,000 read operations and 1,000 each of write, list and delete operations per day, resetting daily at UTC 00:00, with a maximum total storage size of 1 GB. Operations that exceed these limits will fail with an error.</p><p>Additional KV usage costs \$0.50 per million read operations, \$5.00 per million list, write and delete operations and \$0.50 per GB of stored data.</p><p>We intentionally chose these limits to prioritize use cases where KV works well - infrequently written data that may be frequently read around the globe.</p>
    <div>
      <h3>What is the new KV value size limit?</h3>
      <a href="#what-is-the-new-kv-value-size-limit">
        
      </a>
    </div>
    <p>We’re raising the value size limit in Workers KV from 10 MB to 25 MB. Users frequently store static assets in Workers KV to then be served by Workers code. To make it as easy as possible to deploy your entire site on Workers, we’re raising the value size limit to handle even larger assets.</p><p>Since Workers Sites <a href="https://www.cloudflare.com/developer-platform/solutions/hosting/">hosts your site</a> from Workers KV, the increased size limit also means Workers Sites assets can now be as large as 25 MB.</p>
    <div>
      <h3>How does Workers KV work?</h3>
      <a href="#how-does-workers-kv-work">
        
      </a>
    </div>
    <p>Workers KV stores key-value pairs and caches hot keys in Cloudflare’s data centers around the world. When a request hits a Worker that uses KV, it retrieves the KV pair from Cloudflare’s local cache with low latency if the pair has been accessed recently.</p><p>While some programs running on the Workers platform are stateless, it is often necessary to distribute files or configuration data to running Workers. Workers KV allows you to persist data and access it across multiple Workers calls.</p><p>For example, let’s say I wanted to serve a static text file from Cloudflare’s edge. I could provision my own <a href="https://www.cloudflare.com/learning/cloud/what-is-object-storage/">object storage</a>, host it on my own domain, and put that domain behind Cloudflare.</p><p>With Workers KV, however, that reduces down to a few simple steps. First, I bind my KV namespace to my Workers code with Wrangler.</p>
            <pre><code>wrangler kv:namespace create "BUCKET"</code></pre>
            <p>Then, in my wrangler.toml, I add my new namespace id to associate it with my Worker.</p>
            <pre><code>kv_namespaces = [
 {binding = “BUCKET", id = &lt;insert-id-here&gt;}
]</code></pre>
            <p>I can upload a new text file from the command line using Wrangler:</p>
            <pre><code>$ wrangler kv:key put --binding=BUCKET "my-file" value.txt --path</code></pre>
            <p>And then serve that file from my Workers script with low latency from any of Cloudflare’s points of presence around the globe!</p>
            <pre><code>addEventListener('fetch', event =&gt; {
  event.respondWith(handleEvent(event))
})

async function handleEvent(event) {
 let txt = await BUCKET.get("my-file")  
 return new Response(txt, {
    headers: {
      "content-type": "text/plain"
    }
  })
}
</code></pre>
            <p>Beyond file hosting, Workers users have built many other types of applications with Workers KV:</p><ul><li><p>Mass redirects - handle billions of HTTP redirects.</p></li><li><p>Access control rules - validate user requests to your API.</p></li><li><p>Translation keys - dynamically localize your web pages.</p></li><li><p>Configuration data - manage who can access your origin.</p></li></ul><p>While Workers KV provides low latency access across the globe, it may not return the most up-to-date data if updates to keys are happening more than once a minute or from multiple data centers simultaneously. For use cases that cannot tolerate stale data, Durable Objects is a better solution.</p>
    <div>
      <h3>Get started with Workers KV today, for free</h3>
      <a href="#get-started-with-workers-kv-today-for-free">
        
      </a>
    </div>
    <p>The free tier and increased limits are live now!</p><p>You can get started with Workers and Workers KV in the Cloudflare dash. To check out an example of how to use Workers KV, check out the <a href="https://developers.cloudflare.com/workers/tutorials/build-a-jamstack-app">tutorial</a> in the Workers documentation.</p> ]]></content:encoded>
            <category><![CDATA[Cloudflare Workers KV]]></category>
            <guid isPermaLink="false">DjGTxZbrah7C5qA5sbRjW</guid>
            <dc:creator>Greg McKeon</dc:creator>
        </item>
    </channel>
</rss>