Cloud Services / Data / Edge / IoT

Cloudflare Brings Stateful Data Support to CDN Platform

23 Nov 2021 9:00am, by

Content delivery network (CDN) Cloudflare has given its users access to compute since it first launched its Cloudflare Workers feature in 2017. While compute at the edge can be a powerful feature, without access to stateful data, it remains limited. Now, Cloudflare has released a slate of new features that brings stateful data to its platform, whether connecting to existing databases or using the company’s Durable Objects, which just reached general availability this month.

Cloudflare first started out on its journey to provide its users with persistent data by building Workers KV, a key value store it added in 2019. While Workers KV allowed developers to “build entire applications with the performance of a CDN static cache,” Cloudflare CEO Matthew Prince said that they quickly realized it wasn’t enough.

“We needed something that was more robust. That required us to create a new sort of primitive that was really specific and special for a distributed computing platform like Cloudflare,” said Prince. “The idea of Durable Objects, foundationally, is that data should follow the users and the workloads, as opposed to making the users and the workloads go to the data. It, in some ways, flips the traditional model of the datastore on its head, and in doing that, it gives you a very high-performance solution in most cases, but allows you to still have a distributed computing environment.”

In comparing Workers KV with Durable Objects, Prince offered the example of the sign you might see in a diner that reads “You can have it good, fast, or cheap: pick two.” With data, he said, you can have consistency, availability, or partition tolerance, but not all three at once. Workers KV offers “eventual consistency,” which makes it fine for applications where data doesn’t need to be immediately consistent in all locations. For applications like selling tickets or multiplayer games, however, Workers KV does not work.

“In those cases, you need a much stronger consistency model than eventual consistency. Durable Objects gives you that strong consistency model,” said Prince. “What great developer platforms have is a variety of different ways of developers being able to store and access data, and there’s going to be trade-offs and benefits to each and every one of these. We want to make sure that we’re providing the tooling that allows developers to build whatever kind of application they need.”

With Durable Objects, Cloudflare handles many of the processes that would otherwise require an operations team or site reliability engineers (SREs). For example, if they are being used for a multiplayer game and players move their locations, Cloudflare will find the best location to provide the best performance across the board. Similarly, if there are data regulations that need to be followed, Durable Objects can be tagged to remain in specific locations, as necessary. Prince sees Durable Objects as a tool that will allow developers to do much more with less.

“You, as a developer, don’t have to think about it, so it allows you to build much more complicated things,” said Prince. “I think that that’s really the spirit of full-stack or, in your case, the new stack of developing, which is how can you take all of that work, which usually would have in the past required a significant tech-ops effort and abstract it down so that any developer anywhere can build what in the past would have would have been a Herculean effort?”

While Durable Objects greatly expands developer capabilities within Cloudflare, the company also introduced two other features that greatly expand its ability to handle data. First, Cloudflare has a new partnership with Prisma, the Node.js and Javascript ORM, to give developers easy access to MySQL, Postgres and SQL. Second, they have launched relational Database Connectors, which allows developers to connect to their existing relational databases. For now, said Prince, Cloudflare has launched the features with a few initial partners, but he expects that soon enough “you’ll see connectors to essentially every database that is developed.”

With the addition of these data features to Cloudflare, including the company’s separate launch this week of Cloudflare R2 Storage, which offers full AWS S3 API compatibility, Prince said he sees Cloudflare as being able to empower the solo developer like never before.

“We believe that at some point, in the next few years, a solo developer will build a billion-dollar business all on their own without having to work with any SRE team or technical operations team or anyone else,” said Prince. “We’re trying to make — when they do that — Workers be the platform that empowers them. If we’re able to accomplish that, I think that that’s really living up to the promise that is Workers today.”