Durable Objects - Everything Everywhere All At Once For Not Very Much Money

Rate this content
Bookmark
The video discusses the benefits and limitations of Durable Objects, a technology by Cloudflare that allows developers to build stateful, collaborative applications. Durable Objects eliminate the need for provisioning databases and Kubernetes clusters, making development simpler and more cost-effective. The talk covers how Durable Objects can handle state management by storing data both in-memory and in a built-in key-value store, ensuring data persistence. It also explains how WebSocket connections can be used to build push-based systems, enabling real-time updates. The video highlights use cases like multiplayer games, chat rooms, and collaborative whiteboards. It mentions that Durable Objects are billed based on compute, storage, and memory usage, and have limitations like a 128 MB RAM cap and 128 KB storage limit per value. The technology is suitable for applications requiring long-lived sessions and state storage, and can handle authorization through HTTP endpoints. The talk also touches on the potential of co-locating compute and storage at the edge, making it a powerful paradigm for distributed computing. Reflect, a multiplayer state sync platform, is an example of a commercial app built on this technology.

From Author:

Cloudflare's Durable Objects are a new JavaScript runtime that makes building stateful, on-demand backend servers on the edge as easy and cheap as serverless functions. 

By colocating compute and state, Durable Objects melt complexity at scale, and allow you to focus on building your product.

In this fast-paced talk we'll live code a real-time backend from scratch, show how Durable Objects work, and explore how you can apply this versatile tool to a wide range of everyday engineering problems.

This talk has been presented at React Day Berlin 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

The main topic of the talk is Durable Objects, a technology by Cloudflare for building stateful, collaborative applications.

Durable Objects is a technology by Cloudflare that allows you to build stateful, collaborative applications by provisioning long-lived server environments which are uniquely addressable and can maintain state.

Durable Objects can be used to build collaborative applications such as chat rooms, games, whiteboards, and more. They are versatile and can be applied to a variety of use cases.

State management in Durable Objects is done by storing data in-memory and also backing it up to a built-in key-value store. This ensures that the data persists even if the object is temporarily spun down.

Benefits of using Durable Objects include the ability to create stateful applications that can scale globally, co-locate compute and storage, and handle high concurrency. They are also cost-effective and easy to manage.

Billing for Durable Objects is based on three factors: compute time, storage, and memory used while the object is running. WebSocket connections are also managed efficiently to minimize costs.

Durable Objects have a memory limit of 128 MB per object and a maximum value size of 128 KB for each key in the key-value store.

Yes, Durable Objects can handle authorization by using HTTP endpoints that can validate tokens or other forms of authentication.

Yes, platforms like Reflect, which provides state synchronization services, are built on Durable Objects. They are also commonly used in back-office capacities for session management and other use cases.

Durable Objects are unique because they offer strong consistency between memory and disk, can spin up instantly, and co-locate compute and storage. This makes them ideal for a variety of applications, including those requiring high concurrency and stateful interactions.

Jani Eväkallio
Jani Eväkallio
31 min
08 Dec, 2023

Comments

Sign in or register to post your comment.

Video Transcription

1. Introduction to Durable Objects

Short description:

Let's get going. Thank you, Kevin, for this wonderful introduction. Today we're not going to do slides. We're going to do live coding. So today I want to talk to you about something called Durable Objects, which is a bad name for a really cool thing. Can I have a show of hands? Who here before coming to this talk has even heard of what Durable Objects are? We have about 10 hands. And I'll keep the hand up if you've actually run Durable Objects in production.

Let's get going. Thank you, Kevin, for this wonderful introduction. It's a thankless job to be an MC. Can we have a round of applause for Kevin and the MCs as well?

Yes. I do love being a part of these conferences. I've been part of almost every React Debrieve in the past. And it's my first time speaking. And I don't speak very often because I hate making slides. So today we're not going to do slides. We're going to do live coding. But because I did make the mistake of naming this talk everything, everywhere, all at once. I thought there might be some movie buffs in there. So I did put in one slide just in the beginning just so people don't get angry about me not, you know, putting in the slides. So this is the slide. It's a keynote animation. Look at it. It's beautiful. There. Wow. Look at that. Wow. Okay. Nice.

So today I want to talk to you about something called Durable Objects, which is a bad name for a really cool thing. So this year, like every year at the end of the year, I reflect what is it that I've been working on differently this year. What are some of the sort of new tools and new practices that have sort of, you know, improved my ability to do my job as an engineer. And Durable Objects is one of those discovered from this year I really want to share with you. Can I have a show of hands? Who here before coming to this talk has even heard of what Durable Objects are? Okay. We have about 10 hands. And I'll keep the hand up if you've actually run Durable Objects in production.

2. Introduction to Cloudflare's Durable Objects

Short description:

Okay. So like two or three people. Great. This is exactly what I was hoping for. Durable Objects is a technology by a company called Cloudflare. It's a really cool technology company, but they're not really good at telling people how to use it or selling it or anything like that. So I thought instead of trying to explain it to you, I'm just going to show you how this works. Cloudflare is one of the biggest internet infrastructure companies, known for its CDN, cache, proxy, and bot defense services. They have a developer platform called Workers, where you can run serverless code. Cloudflare's workers run in every one of their 300 server locations, making services extremely fast. Durable Objects is a versatile programming paradigm, which I will soon demonstrate to you.

Okay. So like two or three people. Great. This is exactly what I was hoping for. And don't worry, this is not your fault. This is Cloudflare's fault.

So first, a little preamble. Durable Objects is a technology by a company called Cloudflare. I do not work for Cloudflare. I'm just an enthusiastic fan. I am not paid by them. They didn't even review my slides, so everything could be incorrect. But then on the other hand, I get to say anything I want about Cloudflare. And the thing about Cloudflare is that it's a really cool technology company, that there's really cool technology, and they're not really good at telling people how to use it or selling it or anything like that. So I thought instead of trying to explain it to you, I'm just going to show you how this works.

Okay, so this is Cloudflare. If you haven't heard of this company, it's one of the biggest sort of internet infrastructure companies. You might know them as a CDN provider, as a cache provider, proxy provider, bot defense, stuff like that. But more than that, they have a perfectly wonderful developer platform called Workers, where you can run serverless code, just like Lambda. But instead of like Lambda that usually runs in only one location or one availability zone, depending on how you configure it, Cloudflare's workers run in every one of their 300 server locations that they have around the globe. And they automatically in their network, basically just route your request to the closest one. So this means that thanks to these things being close, usually these services are extremely fast.

But so if we go to this developer platform website, behind here, below this Workers, there's this kind of well buried section called durable objects. And under here, if we go, we get to find out what durable objects are and what they do. And remember, I don't work for Cloudflare. And they tell us that we can build collaborative applications, like chat rooms, games, whiteboards. This is really cool. I love playing games, like building games and chat rooms and whiteboards. But in reality, most of us don't really get to build this type of software in day to day thing. And this is, I think, the biggest underselling of what durable objects are, is that they are really versatile programming paradigm, which I will soon demonstrate to you.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Modern Web Debugging
JSNation 2023JSNation 2023
29 min
Modern Web Debugging
Top Content
This Talk discusses modern web debugging and the latest updates in Chrome DevTools. It highlights new features that help pinpoint issues quicker, improved file visibility and source mapping, and ignoring and configuring files. The Breakpoints panel in DevTools has been redesigned for easier access and management. The Talk also covers the challenges of debugging with source maps and the efforts to standardize the source map format. Lastly, it provides tips for improving productivity with DevTools and emphasizes the importance of reporting bugs and using source maps for debugging production code.
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Today's Talk discusses the future of performance tooling, focusing on user-centric, actionable, and contextual approaches. The introduction highlights Adi Osmani's expertise in performance tools and his passion for DevTools features. The Talk explores the integration of user flows into DevTools and Lighthouse, enabling performance measurement and optimization. It also showcases the import/export feature for user flows and the collaboration potential with Lighthouse. The Talk further delves into the use of flows with other tools like web page test and Cypress, offering cross-browser testing capabilities. The actionable aspect emphasizes the importance of metrics like Interaction to Next Paint and Total Blocking Time, as well as the improvements in Lighthouse and performance debugging tools. Lastly, the Talk emphasizes the iterative nature of performance improvement and the user-centric, actionable, and contextual future of performance tooling.
pnpm – a Fast, Disk Space Efficient Package Manager for JavaScript
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
pnpm – a Fast, Disk Space Efficient Package Manager for JavaScript
pnpm is a fast and efficient package manager that gained popularity in 2021 and is used by big tech companies like Microsoft and TikTok. It has a unique isolated node module structure that prevents package conflicts and ensures each project only has access to its own dependencies. pnpm also offers superior monorepo support with its node module structure. It solves the disk space usage issue by using a content addressable storage, reducing disk space consumption. pnpm is incredibly fast due to its installation process and deterministic node module structure. It also allows file linking using hardlinks instead of symlinks.
Beyond Virtual Lists: How to Render 100K Items with 100s of Updates/sec in React
React Advanced Conference 2021React Advanced Conference 2021
27 min
Beyond Virtual Lists: How to Render 100K Items with 100s of Updates/sec in React
Top Content
The Talk discusses optimizing rendering of big tables using Flipper, a new version that is ten times faster with improved user interaction and richer data. It explores optimizing rendering with React, virtualization, filtering, sorting, and windowing techniques. The introduction of the Flipper Datasource packet simplifies handling updates, inserts, and removals. The performance of the Flipper data source package is excellent, even in a debug build of React, with minimal CPU usage. The Q&A session covers incremental sorting, dynamic row height, and the potential for two-dimensional virtualization in the future.
High-Speed Web Applications: Beyond the Basics
JSNation 2022JSNation 2022
30 min
High-Speed Web Applications: Beyond the Basics
This talk covers the latest features in Chrome DevTools, including network tab analysis, performance tab optimization, and user flows. It discusses optimizing HTTP requests with fetch priority to improve loading time. The performance tab provides insights on frame drops, long tasks, and the importance of minimizing total blocking time. The talk also highlights the optimization of page rendering and introduces user flows in Chrome DevTools.
Debugging with Chrome DevTools
JSNation Live 2021JSNation Live 2021
11 min
Debugging with Chrome DevTools
Here are some tips for better utilizing DevTools, including using the run command, customizing keyboard shortcuts, and emulating the focus effect. Learn how to inspect memory, use the network panel for more control over network requests, and take advantage of console utilities. Save frequently used code as snippets and use local overrides for easy editing. Optimize images by using a more optimized format like AVIF and track changes in the network panel to see the reduced data size.

Workshops on related topic

React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Mastering advanced concepts in TypeScript
React Summit US 2023React Summit US 2023
132 min
Mastering advanced concepts in TypeScript
Top Content
Featured WorkshopFree
Jiri Lojda
Jiri Lojda
TypeScript is not just types and interfaces. Join this workshop to master more advanced features of TypeScript that will make your code bullet-proof. We will cover conditional types and infer notation, template strings and how to map over union types and object/array properties. Each topic will be demonstrated on a sample application that was written with basic types or no types at all and we will together improve the code so you get more familiar with each feature and can bring this new knowledge directly into your projects.
You will learn:- - What are conditional types and infer notation- What are template strings- How to map over union types and object/array properties.
Integrating LangChain with JavaScript for Web Developers
React Summit 2024React Summit 2024
92 min
Integrating LangChain with JavaScript for Web Developers
Featured Workshop
Vivek Nayyar
Vivek Nayyar
Dive into the world of AI with our interactive workshop designed specifically for web developers. "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" offers a unique opportunity to bridge the gap between AI and web development. Despite the prominence of Python in AI development, the vast potential of JavaScript remains largely untapped. This workshop aims to change that.Throughout this hands-on session, participants will learn how to leverage LangChain—a tool designed to make large language models more accessible and useful—to build dynamic AI agents directly within JavaScript environments. This approach opens up new possibilities for enhancing web applications with intelligent features, from automated customer support to content generation and beyond.We'll start with the basics of LangChain and AI models, ensuring a solid foundation even for those new to AI. From there, we'll dive into practical exercises that demonstrate how to integrate these technologies into real-world JavaScript projects. Participants will work through examples, facing and overcoming the challenges of making AI work seamlessly on the web.This workshop is more than just a learning experience; it's a chance to be at the forefront of an emerging field. By the end, attendees will not only have gained valuable skills but also created AI-enhanced features they can take back to their projects or workplaces.Whether you're a seasoned web developer curious about AI or looking to expand your skillset into new and exciting areas, "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" is your gateway to the future of web development. Join us to unlock the potential of AI in your web projects, making them smarter, more interactive, and more engaging for users.
From Todo App to B2B SaaS with Next.js and Clerk
React Summit US 2023React Summit US 2023
153 min
From Todo App to B2B SaaS with Next.js and Clerk
WorkshopFree
Dev Agrawal
Dev Agrawal
If you’re like me, you probably have a million side-project ideas, some that could even make you money as a micro SaaS, or could turn out to be the next billion dollar startup. But how do you know which ones? How do you go from an idea into a functioning product that can be put into the hands of paying customers without quitting your job and sinking all of your time and investment into it? How can your solo side-projects compete with applications built by enormous teams and large enterprise companies?
Building rich SaaS products comes with technical challenges like infrastructure, scaling, availability, security, and complicated subsystems like auth and payments. This is why it’s often the already established tech giants who can reasonably build and operate products like that. However, a new generation of devtools are enabling us developers to easily build complete solutions that take advantage of the best cloud infrastructure available, and offer an experience that allows you to rapidly iterate on your ideas for a low cost of $0. They take all the technical challenges of building and operating software products away from you so that you only have to spend your time building the features that your users want, giving you a reasonable chance to compete against the market by staying incredibly agile and responsive to the needs of users.
In this 3 hour workshop you will start with a simple task management application built with React and Next.js and turn it into a scalable and fully functioning SaaS product by integrating a scalable database (PlanetScale), multi-tenant authentication (Clerk), and subscription based payments (Stripe). You will also learn how the principles of agile software development and domain driven design can help you build products quickly and cost-efficiently, and compete with existing solutions.
Building Pinia From Scratch
Vue.js Live 2024Vue.js Live 2024
70 min
Building Pinia From Scratch
Workshop
Eduardo San Martin Morote
Eduardo San Martin Morote
Let's dive into how Pinia works under the hood by building our own `defineStore()`. During this workshop we will cover some advanced Vue concepts like dependency Injection and effect scopes. It will give you a better understanding of Vue.js Composition API and Pinia. Requirements: experience building applications with Vue and its Composition API.
Mastering 3D Web Development with TresJS ecosystem: A Vue.js Workshop
Vue.js Live 2024Vue.js Live 2024
119 min
Mastering 3D Web Development with TresJS ecosystem: A Vue.js Workshop
Workshop
Alvaro Saburido
Alvaro Saburido
Introducing "Mastering 3D Web Development with TresJS," a specialized workshop crafted for Vue.js developers eager to explore the realm of 3D graphics within their web applications. TresJS, a powerful custom renderer for Vue, is specifically designed to work seamlessly with Vue's reactive system. This workshop offers a deep dive into integrating sophisticated 3D visualizations and interactive experiences directly into Vue applications, leveraging the unique strengths of both Vue and TresJS ecosystems.
This workshop is designed for Vue.js developers looking to expand their skill set into the third dimension, UI/UX designers interested in incorporating 3D elements into web applications, and front-end developers curious about the potential of 3D graphics in enhancing user experiences. You'll need to be familiar with Vue.js to benefit from this workshop fully.
What You Will Learn- Introduction to TresJS: Discover the fundamentals of TresJS and how it integrates with the Vue ecosystem to bring 3D graphics to life.- Creating 3D Scenes with Vue: Learn to construct intricate 3D scenes utilizing Vue components, enhancing your user interfaces with dynamic and immersive visuals.- Interactivity and Animation: Master the techniques to make your 3D scenes interactive, responding to user inputs for a captivating user experience.- Integrating with Vue Features: Explore advanced integration of TresJS with Vue’s reactivity, composables, and the Vuex store to manage state in 3D web applications.- Performance and Best Practices: Gain insights into optimizing your 3D scenes for performance and best practices to maintain smooth, responsive web applications.