Transcript
00:00 Hey, everybody. I am so excited to introduce to you all my friend Sunil Pai. How are you doing, Sunil? I'm doing well, Kent. How are you doing? Thanks for having me on. Yeah, absolutely. Thank you so much for joining me. Sunil and I have known each other for a very long time.
00:15 Probably, I got into, I think I got to know you after I left the Angular world and came into React. And so that would have been, but like pretty soon when I got into React. So it would have been like 2016, I think. It's been a while. Maybe a little earlier. So I actually know the exact moment we met.
00:33 It was at the first React rally. I think Ryan and potentially Michael were bullying you to say, hey, I'm going to check out React. I'm not an Angular guy. I think I was there at that exact moment. Oh, I remember that now. Yes, and that was before I officially
00:52 joined the React crew. So that would have been 2015, first year of React rally. Yeah, dude, that was, I remember that very, very clearly. And now I remember you there. I think you were wearing your like, you had a hat that you used to wear a lot, if I remember right. I've always had a hat, but I don't
01:12 remember the one I was wearing at that time. It was something or the other. But I remember that moment. I was like, dude, why are they bullying this guy? I was like, OK, they're probably friends. But. It was all in good fun. And I did send that tweet. If anybody wants to look around my tweets around that first React rally, you'll find it.
01:35 Yeah, that's great. So yeah, we've known each other for a super long time. You've been an awesome friend since then. And you've been on a really awesome journey. It's been fun to watch your life and career as well. So I would love for people to get to know you a little bit. Could you intro yourself to our audience?
01:54 Sure. My name is Sunil. Sunil Pai. I currently work in Cloudflare. I write a bunch of JavaScript. Some people might know me for having written a CSS and JS library called Glamour. And Kent, you actually wrote a library on top of that called Glamorous.
02:13 And they were both very cool. I was on the React core team for a year. And I've made a testing API. And again, that's something you and I worked on adding into React testing library at one point. I've done a bunch of things. In India, I helped build e-commerce sites, a couple of government sites.
02:32 I've done contracting work. I've done such a breadth of jobs in the last 18, 19 years now. And it's been wonderful making friends like Kent. But mostly, I think open source has done so much for our collective careers. It gave us a platform. It gave us community.
02:51 And it's just been like, Kent, you might actually know this. It's been strange going from being the youngest person in the room to being almost the oldest sometimes now. It's such a strange feeling. And we all have families and lives behind us. It's been a wonderful journey. But yes, thank you for having me here.
03:09 Yeah, yeah, absolutely. It is kind of odd. I remember, actually, the first time I ever felt that way really was Max Soiber when he became big with his React boilerplate and the styled components, especially.
03:28 I was like, he's younger than me. And that was just kind of a weird thing. I mean, there was also Sebastian, creator of Babbel. And he was very young. But I kind of felt like he's an exception. I'm still with the young kids. But then, yeah, oh, man, more and more people are younger and younger. And now I'm just, I don't feel like an old guy yet.
03:47 I'm still, I turned 36 this year. Yeah, but there are still younger people. I'm just thinking, the new batches of interns that show up in Cloudflare, these are very young people who have basically
04:03 been born into the AI age of development and programming. And bro, they kind of run circles around us already sometimes. They'll just tell their computer, just build this for me. And it'll spit out code. And I'm like, OK, I think our jobs are in trouble. Like, this is a 19-year-old intern
04:20 who's just building full-on features in an hour. And I'm like, OK. It's a very interesting time. It's very cool. And it's interesting to think that lots of the folks that, some of who are listening right now, were born in the 2000s. So they were like, yeah, that's very interesting. I refuse to acknowledge this.
04:40 Sorry. I just refuse to acknowledge it. Well, so that is exciting. But I do want to dive into the AI coding assistant stuff. I literally just minutes ago read a post from you on X about using Cursor AI. And I've had a couple people recommend that editor for me.
04:59 And I was always hesitant because I'm like, I mean, so here's my perspective. Like, you know the Rabbit device and all these devices that are exclusive, just the AI features. And why isn't that just an app on my phone? And so that was kind of my thought around Cursor
05:17 is like, why isn't that just a plug-in in my editor in VS Code? Why do I have to jump complete editors? But I've heard enough people say that Cursor is just so good. And I guess that Cursor still works with VS Code plug-ins somehow. So I need to look into it. So Cursor is basically a fork of VS Code,
05:37 which is why all your existing extensions kind of work out of the box. In fact, it just looks for your VS Code installation and copies the extensions from it. Or the themes, everything like your setup is already there. So the thing is, I've been using GitHub Copilot for about, I want to say, three years now, right? Two, three years.
05:57 And it's been great. And it's basically smart auto-complete. That's like the mental model for it. Yeah, it kind of guesses what you're doing. If it gets it wrong, you clear it up, et cetera. But that usually executes in the context of a file, and usually just a few lines up and down.
06:15 So Copilot basically takes that to the next level, where it can start operating at the level of your code base. And it's basically, it takes a pass on your code base. It can analyze it no matter how big it is. And then you can start saying stuff like, hey, can you add a marketing page, make sure
06:32 that it's not behind auth, and add a hit counter on it. And it goes like 90%, 95% of the way there. That's where you're like, whoa, OK, hold on, hold on. I didn't think this would happen so fast. I thought I had a couple of more years before this would happen. I think GitHub Copilot has tried to do this with Copilot Chat,
06:52 but it was never very good. But Cursor is doing this. And the reason that it's not just an extension is because I believe the team's plan is to move further away from what VS Code is doing. I think they want to build a proper AI native editor. I don't know if they'll change it. This is just their first take at it. And the other thing that really convinced me
07:11 was you and I are both programmers. We love getting stuff for free. It's weird. We want people to pay for our software, but we refuse to pay money for software we use ourselves. I think everybody wants to make it or late. But then I was like, $20 a month? I kind of spend that the moment before I step out
07:30 of the door on some days. It's kind of a rounding error. It's like a few coffees. And it's worth it if it's doing this job for me. So I've only been using it for about a day now, so I don't know much about it. But I'm already like, yeah, this is the direction IDs are going. So you should give it a day. That's what you should do, where you're like,
07:50 you know what? For a day, I'm only going to use this and try the features. And then you make a decision. OK, yeah, I'll give it a shot. I've tried Copilot, Codium. I'm right now using SuperMaven, which is very fast. Oh my god. So good. It's scary fast, yeah. Yeah, very happy with that one.
08:08 But yeah, actually, there's a video circulating around X right now. You've probably seen of this nine-year-old girl coding up a whole page from scratch. And it's really interesting, because it integrates with Cloudflare AI stuff. And so I'm like, wait, where did your API keys come from?
08:28 But like, super interesting. Very, very cool stuff going on there. So I'll have to take a look. I'll give it a shot. You should. You should. And honestly, I was just going to say, I think that is where these newer engineers who are being raised in the AI world, that's
08:47 their competitive edge, is that they know how to use these tools. And so it's not like we are going the way of the dinosaur, necessarily. It's just anybody who doesn't adapt to being able to use these tools is going to fade. And that's just the way it's always been. Like, if you don't adapt to the latest way
09:06 to execute in your industry, then you're going to fade away. And so, yeah, I think it's just the way it is. This feels like common knowledge now, but I can think about, even as recent as about a year ago, people were worried that these tools were
09:24 going to make it harder for younger people to get jobs in the industry. But the truth is that it's going to be a good way of pushing out the senior people who don't adapt. Again, and this is such a stretch to use this as a parallel. I think React folks are best suited to change their habits,
09:44 simply because that's kind of what we did 10 years ago. Like, this whole new thing came along, and we were like, fine. We'll rethink the entire way we thought about our jobs, really. Again, this is kind of a stretch to say it, but that's what I tell myself, which is like, you know what? I'm 40, but I'm happy, like, reinventing my tool chain. Let's go.
10:01 Like, I want to write apps really quickly and really fast. I don't really care about the code that much. I just want to build, and yeah, this is getting me there. Yeah, yeah, it is very exciting. Another thing that's exciting, speaking of Cloudflare, you sold a company to Cloudflare. So that's pretty exciting.
10:20 I want you to tell us a little bit about that story, and maybe inspire some folks who are working at their job, and they want to do something, and they're not going to be able to, so they just, yeah, let's get inspired here. So my story for people who don't know
10:36 is I used to work in Cloudflare from 2021 to 2022. The reason I joined Cloudflare was in 2020, late 2020, they announced this tech called Durable Objects. And I barely knew who Cloudflare were at the time.
10:54 I knew they were like something JavaScript, Edge, middleware, I don't know. But Durable Objects sounded particularly novel and fascinating. And I tried using it, and I hated the developer experience so much that I started dissing them on Twitter. One thing led to another. I started talking to the people there, and they're like,
11:12 do you want a job to come work on fixing this? And I was like, yeah, exactly. And I was working in a bank at the time, and I didn't enjoy that very much. I never want to work in a non-tech company again. So I worked there, and for a year, I rebuilt their CLI. Their CLI, I rebuilt. It's called Wrangler.
11:31 I rebuilt it from Rust to TypeScript, which is the opposite direction that other applications are rebuilt in nowadays. But it was the right thing, because it's actually not a CPU-heavy thing. It's network-heavy thing. 99.9% of our users know JavaScript, so they're able to contribute back to the code base. It was the right thing to do.
11:50 So I did a year of that. And once I got what's called ILR in the UK, it's similar to like a green card. I didn't need a visa sponsor anymore. I was like, you know what, I'm turning 40, so I would love to try building my own company on top of Cloudflare itself,
12:09 because I'm a big fan of the company and the technology and the people. So I spent a year and a half, massive speed run of the entire startup journey. I built in public. I got VC interest. I raised a round from top-tier firms and angels, bunch of CEOs and stuff.
12:30 I did conference talks. I called myself a CEO for a year and a half. And then in about a year and a half, once I realized that, oh, it's actually cool to build tech, but the reason you do startups is to build a business, and it's very hard to build an open-source,
12:49 B2B, Infra, SaaS, that's VC-backed in 2024, because it's very hard to make money with the combination of these things, to build a VC-backed thing. And I could have gone a number of ways, but really, A, I really believed in the product and the platform, the thing that I'm building.
13:09 Oh, it's called PartyKit, which is a platform for building real-time multiplayer applications, much like video-sharing services, collaborative apps. Yeah, for context for people, the folks who are going through Epic React are experiencing PartyKit
13:28 in the face pile of presence people. So when you're working on it, it'll show your face next to other people who are working on the same exercise as you, just because it was so easy. I remember, we basically had a call
13:45 where we paired and got a prototype of it done in a day, and then over two, three days. That's just it, I was like, you know what, I'll get back to this on Tuesday. By the time I got to Tuesday, Kent had already changed it four different ways and implemented features on it. I was like, this is amazing. And that was the promise of PartyKit, because previous to that,
14:03 building real-time applications have been expensive, so you can't do it with normal serverless functions, which is the standard way of building servers online right now. You need distributed systems experts, because who knows how they're connecting, message passing, all of that. You need to have people who maintain this infrastructure for you,
14:22 so it's always been an expensive, hard thing to do. But my company, and I'm just taking credit for the work that Cloudflare did, to be honest. Let's be honest here. It made it easy to build applications like this by regular people. And building the face pile was such a great experience. We've had teenagers build games
14:41 and ship it to production over a weekend. Again, something that was kind of unheard of. Some big companies use it to power their collaborative stuff. And it went really well. I think the tech product slash platform is going really well. Earlier this year, so whoever's watching this in the future from your rocket ship,
15:01 this is 2024, so early in 2024, Cloudflare and I got into conversation about, hey, do you want to just come back into the company and build it? Because you have a great relationship with everyone, we believe in what you're doing, it's clearly working. Come back and just keep building that product inside it. So this is my second stint at Cloudflare.
15:18 It's been, it's not even been six months yet, but I'm having a great time. Getting this tech now to a lot more people instead of just my little startup that was serving a bunch of people. I'm quite excited about it. You can focus on the tech rather than the business, which is the real win right there. That's right.
15:37 It's either that or I just become a, I started calling myself a durable object influencer. I want to live the influencer lifestyle. So I'm going to go to like beach resorts, take pictures of myself and say real time, bought me this, hashtag hustle, hashtag the dream. That sort of thing. I think that's what I'll do.
15:56 I want to see those. I'm expecting those. That's awesome. Thanks, durable objects. Thanks, durable objects, yeah, exactly. That's very interesting. So what was it about real time stuff that drew your attention? What was so interesting about that? Okay, this is a little personal, but I swear, and it sounds like a little too full of myself,
16:18 but I swear it's the story, okay? Cheap access to internet and being able to build applications took me from a small coastal town in India and brought me all the way here. I'm in the UK now, have such a great life. Again, community, travel the world, conferences, open source, all of that.
16:36 That's what cheap access to internet and being able to like express yourself online. But the promise of the internet has always been about like building highly interactive real time, like multiplayer apps. That's like how they designed it way back then, but it's been hard to do.
16:55 And this technology, I think, it's always been kind of a dream to make hard tech accessible to everyone else because making hard tech accessible to me like gave me this journey over the last 20 years and like millions of people like me, not just me. And I would like to play a small role
17:15 in doing that like for a lot more people. So, and people have always shied away from building systems like this because either you need like third party service, like I said, distributed system experts. And I'm like, no, it's like it's 20 lines of code if you have access to the right infra and the right way to like express it.
17:35 So, even those first few moments of doing a PartyKit tutorial and seeing like sharing a link on Twitter and then seeing everyone's cursors on the same page, that feeling for me like gets me up like in the morning, like, oh my God, like I cannot believe that something that I had no idea
17:54 how to even start implementing is now so straightforward and you can write it in JavaScript. I need to get this into people's hands. Like every day I wake up, I'm like, what do I do to get this? I need people to see this the way I see this. And if it takes another five years of a roadmap, it does, but it's going well so far. That's what drives me, yeah.
18:14 I love that so much. It's actually really similar to my mission, which is to make the world a better place through quality software. And I do that best by teaching people to make quality software. And you do that best by enabling people to make quality software with a really good foundation. And yeah, it's really interesting.
18:36 It seems to me then that you're like, you'd love to have big companies use it for their chatbot features or whatever, but like, it sounds like you really want the people to create their own apps and startups and like change that individual's life with the technology that you're putting together.
18:56 See, I don't know if you feel this way, but in the last five, maybe 10 years, but definitely the last five years, the way that people put together web applications and mobile apps is they glue together lots of technology, which is very powerful. Don't get me wrong.
19:14 It's actually extremely powerful to have these pieces. But unfortunately, we're in this minima where people think, A, that's the only way to build applications. B, they think paying a software as a service company, some third-party service, $10 is the only way to do it.
19:36 And I want to kind of break that and say, no, like you actually have the power in your own hands. Like if you get access to the tech, you should be able to not just build it, but believe that you can build it. Because once you build it, like once you can build a hundred apps beyond that. It doesn't just have to be using
19:54 this favorite service of yours that you pay or you make your clients pay. Like get it. And again, I think that's also, again, I feel like you're a little more accomplished in your field, but that's the feeling that some, hell, you call it epic stack. The whole point is that you feel epic like when you're building it.
20:14 Like think like an entire application from soup to nuts, from backend to frontend, an entire stack, build, deploy across the planet with performance and attributes that you would expect from a much bigger company, a much bigger team, a much more developed and experienced team.
20:32 That is what like the epic stack can kind of give you because the epic stack is not just the repository. It's the courses, it's the learning, it's the understanding why you take decisions the way you do and how to work with other people. And a cool little face pile in the bottom left. I think that is such an appealing motivation
20:52 to have as a technologist or as a human being really. Like, oh my God, I get to be a part of someone else's journey where like they take off. That's, oh, it's addicting is what it is. Yeah, yeah. It feels really good too when somebody says, hey, look at this game I put together and I'm gonna start charging for it and I'm gonna start making money or whatever.
21:12 Like this is gonna change my life in such a positive way. I love that and it is an addicting feeling when somebody says, hey, the thing that you did enabled me to do this other thing that is really awesome. So yeah, that's exciting. So yeah, what else are you,
21:30 well, actually before I just open it up to you, I wanted to ask you to help me understand durable objects because I thought I understood them and then you posted a couple months ago, I've got React server components running in a durable object. And I was like, wait, this is, they are not what I thought they were
21:50 because that's not what I would expect you to be able to do or like at all. So I want you to explain durable objects and then also how did you do that and what are the possible use cases for something like that? Okay, so the big problem with durable objects for the last four years is that Cloudflare
22:09 and myself have struggled to explain to people like what it is. So you can do here like. React server components is the same. Maybe, so I'm gonna try a version of it with you. Okay, like, let's see if you can do this thing. So, if you take a step back from how serverless works and how you set up these APIs and lambdas
22:33 and workers and all of that, what do you want to do when building a machine like a website, like some software for other people to use, is you want to have an architecture where you say, hey, for this person, I'm going to spin up a computer for them that does things for them.
22:54 It can serve them websites, it can respond to API requests, but it can also keep doing things in the background. I'm using the word computer, I'm not using the word server. It's literally like, hey, I'm like dedicating almost like a MacBook to you in my rack there that's just running all the time. The moment you have that mental model,
23:14 you move away from this stateless model of servers, which is, hey, it comes, gets a request, serves it back to you, and then disappears. And it does that a million times. The thing about that model, the serverless model, is mentally, A, it's a simple enough way to model how a website works in your head.
23:36 As an infrastructure provider, it's really nice because it's easy to scale. Hardware is only used when those requests come in and go out. But as a technologist, as someone who's building a solution, the computer model is actually much more powerful because you can start doing things that you can't do in a stateless model.
23:55 So for example, you want to set what we call cron jobs. Hey, every night at midnight, go through all my emails that I replied to and didn't reply to, make a summary of it. To the ones that I didn't reply, set an alarm that reminds me about them
24:14 at nine in the morning, potentially with responses to it. I don't know, like things in the background. Send me all the git commits that I made in GitHub and write something positive for me. All of these things that can run in the background. These are typically things you need another service or something that's something else to do for you.
24:34 But in the computer model, you do your serving website with the same tech, you do your background processes with the same tech, your image generations, whatever it is. Like it's just a computer that does stuff for you. So a durable object is a way of defining
24:53 what this computer can do for you. So you can define hooks on it. Hey, I'm defining a class, a literal JavaScript class, and folks can go see the Durable Objects API after this or in another tab because you've seen our faces for long enough now. No, no, no, don't tab away. I'm going to do funny faces in first.
25:16 So you define a JavaScript class that says on every fetch, respond to it in this particular way. You can write set timeouts and set intervals and things that just work. Hey, if a WebSocket connection comes in this way, and now a new thing that Durable Objects does is it's not just HTTP requests and WebSockets.
25:34 You can define just regular functions that can be called. You can say, hey, on this Durable Object, call function abc.sendemail.whatever, like just do things. Okay, so once you have that as a class, you can now spin up one of these by just giving it an ID. So an ID can be email addresses. Let's say for every user,
25:56 let's spin up one of these computers. That's a common way. So for kensydodds at kensydodds.com. Are you me at kensydodds.com? It's your email. It's me at kensydodds.com. Or me at, actually yeah, 3.1 at gmail.com. So I'll spin up a computer for you, and now that is yours.
26:16 And because Cloudflare has this crazy network that pretty much envelops the planet, it's probably going to be about 10 milliseconds away from me. I like, by the way, this 10, 20 millisecond, to understand, to put it into perspective, I learned a little while ago that an eye blink is about 100 to 200 milliseconds.
26:36 The action of doing this, you can do about 10 requests to your server in that span. Yeah, that's insane. That doesn't make sense to me as a number, but okay, fine. So it spins up this close to you, and it can do stuff for you. So as a developer, you can say, the model now becomes, okay, I can spin up this computer,
26:55 and I can run whatever I want in it. So do I want to render a React app in it? Yes. Can I render a React server components app in it? Yes. You can do anything that a normal computer could do for you on your local machine. It doesn't just have to live in the context of one request response cycle.
27:15 Which is why also you can write real-time apps with this, because when you make a WebSocket connection, you need the thing to stay alive. It's why you can't do it with serverless. There's nothing that stays alive, but this stays alive. So all these WebSockets connect to it from across the planet. And the development model is also dramatically simpler.
27:35 Instead of, let's say these WebSockets connecting to different servers everywhere, and you're trying to synchronize them, it connects to one server. So if you're implementing, for example, chat, common software and writing chat is, oh, every time a message comes in, broadcast it to everyone else in the chatroom. So this is a for loop for the durable object. It's literally a for loop,
27:54 because you have an array of WebSocket connections. A message comes in, and you're like, yep, for const connection in my WebSocket array, dot send, dot send, dot send, dot send. So that's, how is this helping? Is this explanation helping? Yeah, it does help. It definitely explains how you were able to
28:14 send an RSC back. My impression originally was that the durable object was just like a data store of some kind. But it's actually, it's infrastructure is code, sort of. Like, you're defining this class. This machine is running for me by myself.
28:35 But then when we're talking about multiple clients connecting to this durable object, I have access to the other instances of the durable object running. Is that how that works? So I said, hey, we can spin up a computer per person. But you can spin up a computer for any kind of entity.
28:55 So for example, let's say we're. Okay, like a chatroom then. Like a chatroom. A chatroom has an ID. So you'll write a JavaScript class that says, hey, every time a WebSocket connects to my chatroom computer for this ID, maintain a messages array. In fact, not just array, there's actual storage as well, by the way, that persists to disk.
29:15 And we'll talk about why that's important in a second. But sure, like a messages JavaScript array. The first time a connection comes in, just send all the messages that were there so that you can pre-populate your chatroom. So you can see all the previous messages. So it can be a collaborative drawing document, like an Excalidraw document or a TLDraw document.
29:37 It can be a game session. You know, you're building a fighting game. Let's say a multiplayer fighting game. Then each game session gets one of these instances. A thing that I should mention is some listeners might have been wondering is, well, if it just stays on all the time, like when does it go off? Like that doesn't sound like good behavior.
29:57 Like does adding like millions of users just make these like fall over? And the truth is that surely you don't do that. The room can shut down when it hasn't had any activity in a while. When there are no WebSockets connected to it or it doesn't have any HTTP requests, it just kind of like, okay, I'm going to sleep.
30:17 And then the moment that another request comes in, it springs back to life, calls the constructor. So you want to write a little code, but that's also why the storage is interesting, the actual disk persistence. There's a KV storage, and we might introduce SQL storage at some point. I don't know.
30:37 But there's actual storage that stores it to disk, much like a hard disk. And you can use that to persist, let's say messages across sleep, wake up, sequences. But yes, that's what I mean. Yes, you can use one of these computers to define any kind of entity, and you can talk to them.
30:56 You can have your personal, each user computer, all connecting to a chatroom computer, and the chatroom computer connects to something else. You can build these diagrams. Yeah, that is interesting. So this is my point where I'll be like, let me take a whiteboard and sketch out the architecture
31:14 of all these circles and arrows and get this crazed look in my eyes. I'm like, do you see the patterns? Do you see it? Yeah, wow, that is very powerful. So I think the biggest, let's talk about trade-offs for a second too, because this sounds like magic and everybody should be doing it.
31:36 But the primary reason that I have held back on jumping on board with making this the basis for the Epic stack is because you're running in an environment that's close to Node, but not quite Node. Can you talk about the trade-offs there
31:53 and how that's played out for you? So there are a few trade-offs, actually. That's not the only one. So let's start with the first one, like you mentioned, which is that it's not Node.js. It is a standards-based runtime, very similar to what you would get in a browser.
32:12 So you have request, response objects. You can do fetch. It's even a cache API, et cetera. But, and while the Cloudflare has been in the process of adding a whole bunch of Node.js APIs, so you can actually do imports of, let's say, Node buffer, et cetera, it'll never be 100%.
32:31 And the reason they do that is there are some benefits of not taking on the entire luggage of Node, the big one being very fast startup time. The concept of cold start doesn't really exist with Cloudflare workers, which is so nice, like you're like, okay, man, it just starts up magically. If you folks want to learn more,
32:49 the Cloudflare blog has a wealth of articles, very technical articles they've written over the last 10 years. I highly recommend you going and binging on it. But okay, but that's the first one. So that's the strength con. So which means there are some libraries that just won't work inside this runtime. That is the big problem.
33:07 Until a while ago, it didn't even have any Node APIs. So something like Axios, which is a very common HTTP client just wouldn't work inside Cloudflare workers. It does work now, and Axios itself has a fetch-based adapter, which is very good. But that's the first trade-off. The second trade-off comes with the way
33:26 that these durable objects work itself. So I said computer, but it's not a computer with 16 GB of RAM and a massive disk and a multi-gigahertz CPU. If I wanted to do some hardcore image processing maybe,
33:43 or like, I have a podcast where I use FFmpeg to stitch different pieces and things together on my server. I couldn't really do that on durable objects. Nope, I don't think FFmpeg, even though, while we do run Wasm, truth is that each of these objects
34:03 gets 128 MB of RAM, which is not a lot. Your phone has 40 times that, I think, right? Yeah. And it has very little CPU, so for example, you can't use a single durable object to power your entire website. I mean, if you have zero users, sure.
34:23 But the moment you have any users, I think it starts tapping out at about somewhere between 500 to 1,000 requests per second, which is fine for a lot of use cases. You can't use it to build Discord-scale chat rooms yet. And again, we'll talk about how we might want to do it,
34:41 but I just learned this the other day. So do you know what the biggest chat room in Discord is right now? Who is it? It's Midjourney. Midjourney has about 17 million people in that one chat room. Oh my goodness, that is crazy. Yeah, I've never heard that. So the Discord team, by the way,
35:01 has a team just for the Midjourney Discord, is what I understand. And the behavior in the Midjourney Discord is different from everything else. So for example, you don't see typing indicators in the Midjourney chat room, simply because that would be too many messages. Yeah, it would just, can you imagine sending out millions of broadcasts
35:19 for every keystroke? So they don't do that. But sorry, you're not going to have, I mean, they're never going to have 17 million active, but even like a few thousand durable objects start struggling. And the way that you solve that, if you want to build that scale,
35:38 is you start throwing some computer science at it. You start sharding. You start using multiple durable objects to back one room, and you do message passing between them. And those are the trade-offs. Or you just use Redis, or you build it in a more traditional way, if that's what you're comfortable with, et cetera.
36:00 Durable objects are not meant to completely replace use cases where a Lambda or a worker would be good. So if your request is actually stateless, like let's say you're serving like a static website or something that doesn't hold sessions, or you have other infrastructure that helps you with it, then you can just use serverless functions.
36:20 I mean, CloudFlare Workers has an incredibly capable solution for that. But the moment you find use cases that durable objects are useful for, collaboration is such a great one when you have multiple people editing the same thing at the same time. So let's talk about the trade-offs, right?
36:37 Like you don't expect a document to be many hundreds of MB. So it'll fit within the RAM limits. You won't expect more than 20 or 30 editors at the same time. I mean, if you have 20, 30 editors editing the same time, then you have a different- A UX problem, yeah. Not a UX problem. You have people fighting for who gets to edit what.
36:57 Yeah. If it's in the same thing. So that's like a killer use case if you're building like collaborative document editing, durable objects are great. If you're doing something like real-time multiplayer fighting games between very few people, usually like two or maybe four, also great. But you're not going to build World of Warcraft on this,
37:18 actually. Maybe, but not off the box. If like each part of the map was a different durable object, then maybe. And then C, and this is, I don't know if this is a trade-off. You have to be a particular kind of person to take a bet on novel technology. Now, durable objects is, let's say it's four years,
37:41 but even that is kind of young sometimes in the technology world. One of the nice things about it is that it's based on something called the actor model. And that theory is closer to 50, 60 years old. In fact, inside the Cloudflare code base they're actually called actors. So it's built on like good computer science.
37:59 And folks who write Erlang, or Akka Erlang, great language, you should absolutely try it out once you're done writing software for money with the Epic Strike. You should spend some spare time learning a language that much fewer people use. So the technology is good, but trying to, my job, in fact,
38:18 right now inside Cloudflare is to make it mainstream, to show how to use it for common use cases, to build abstractions around it, to write documentation, to show how you would use it for common use cases, to show you what the billing would be like if you use it for particular use cases. And we are working through those use cases one by one.
38:38 And we have some, like lots of people use it in production at crazy scale. My favorite one right now is that Major League Baseball uses durable objects for all their live, when you're on the app and you're seeing like live scores and chat and stuff like that,
38:58 all of that is powered by durable objects. And I thought I would be the kind of guy who likes baseball because it's so much like cricket. And I do like the Red Sox, well, I used to like the Red Sox. So it's nice to see that this tech is like powering that. Yeah, that's cool. Yeah, it sounds like, I said that there's reasons that the Epic Stack
39:17 isn't built on durable objects, but that's like only partially true because it sounds like durable objects is intended to be something that you use for features of an app, not like the entire app for lots of use or for most use cases. Right now, in fact, that was also the story with Cloudflare workers itself.
39:36 Previously, people used to just use it for like middleware or changing headers or rewriting pages or to front their APIs until it got a lot more capable to do other applications. But durable objects right now, so good. And there was a big party kit success story as well. If you want to add multiplayer to an existing app,
39:56 go ahead and use fly.io or Vercel or your existing on-prem stuff for the use cases. It's good for and well understood. Don't rewrite that. But if you want to suddenly take the documents you're editing and make them multiplayer, because hey, multiple people are sometimes editing stuff and their edits clash.
40:14 So we want to make sure they do it in the same spot. Or you're doing a fun game on the weekend, et cetera. Absolutely use this tech for it. And there's a journey where it'll be used for more and more stuff. And I'm super excited about that journey. But if you're building on the Epic stack and you want to add multiplayer features to it,
40:36 make a folder, write a little worker, use my library and just go to town. In fact, the Epic stack workshop I guess is a great app where the entire app is built on the Epic stack and deployed on fly.io, if I'm right. Except for the face file,
40:54 which is powered by party kit in the bottom left. Yep, exactly. And it's super. I love it very much. Well, this has been awesome, Sunil. We're a bit over time, but I do like to leave it open for you if there was anything that you wanted to talk about, you're hoping we would talk about, but we didn't get a chance to get into it. Is there anything else you want to get into? I have actually been thinking about it,
41:18 two or three things. Yeah, let's talk. One, okay, okay, I'll try to do it as quickly as possible. One, whether you're young or old, technology will always be changing. Don't be afraid of it. Use the AI tools, by the way. Don't let anyone shame you. Like there are things that AI might not be good for.
41:36 I feel bad about some jobs that might be going. I'm not that impressed by AI art. I want to be, but there's very little AI art that I like. But no, you as a technologist absolutely should learn it and become well-versed in it, understand the vocabulary, what it's useful for, what it's not for, because it's here.
41:57 Okay, so that's the first one. Second, if there's one thing you take away from my journey, it's that an idiot like myself can work hard and use the internet and access to technology to achieve big things. Don't let anyone tell you otherwise. Wherever you are on the planet, oh my God, open source gives you friends, it gives you community,
42:17 it gives you opportunity. The only thing that really stops you is like hard work. And I understand I'm being reductive, can be a lot harder than that, but before you complain about the other things, make sure you have the hard work and persistence. Like it absolutely works. There was another thing that I wanted to mention,
42:37 which is, oh, social media will always incentivize to make you angrier about things. It will reward you for being angry about things. Even in tech, even in a thing where it's potentially like, there's very little like politics or reason to be like angry at other people or things.
42:59 You can always make the choice to be nice, to help people, and to have like a good time and like exclude the people who don't make a good time. Do not be tempted by the likes that are seemingly, that like a mean tweet, like everybody has a weak moment and has like a mean tweet and it gets you like 40 likes
43:21 and you're like, oh, maybe I should make more mean tweets. Don't do that. Then that comes back to bite you in the ass. So those are my three tips to like wind up. You can be nice. Yeah, I love that. Super into it. And the way that you operate on social media
43:39 resembles your own advice. I know none of us is perfect, but you do a great job of that. No, but you say this, but I'm like inspired by you. You're the guy who like shows me to be like nice on the internet. You're JavaScript Mr. Rogers is what it is. Oh man, that is a stated goal of mine
43:59 to be Mr. Rogers in JavaScript. You got to start wearing the sweater skin. That's what it is. Yeah, yeah, I actually, I do have a sweater for I was Mr. Rogers for Halloween and I've got like, I've got puppets. Well, this is a stuffed animal, but. Well, dude, Sunil, it's always awesome to chat with you. Thank you so much for your tips and advice
44:22 and your depth of knowledge in AI and the durable object stuff. It's super cool. It's in my name. I'm sunilp.ai. Oh man, I am sure you don't have p.ai as a domain. I've tried, no, sunilp.ai that dude refuses
44:43 to sell the domain to me, I've tried. Bummer, I love it. All right, thanks so much, Sunil. We'll see ya. Cheers, thanks a lot, Kent, bye-bye. Bye everyone.