Code Story · Transcripts

S6 E1: Scaling to 1 Trillion Messages: Building the Real-Time Fabric of the Internet with Stephen Blum of PubNub

January 18, 2022 · 30:55
Listen to the episode Download .txtDownload .vtt
Stephen Blum

The design was intended to build and scale. But initially, you know, as we were, we didn't want to waste a bunch of money just by throwing servers up and saying, here we go. And we can just handle any load immediately. We didn't auto scale. Right? That's a big part of modern cloud and API is ability to auto scale is all been manual, and we have to sort of predict and the challenges with messaging infrastructure and our latency being, you know, under 30 milliseconds, pretty much everywhere. How do we, you can't launch a server in 30 milliseconds. My name is Stephen Blum, CTO, co-founder at PubNub.

Noah Labhart

This is Code Story, a podcast bringing you interviews with tech visionaries who share in the critical moments of what it takes to change an industry streak and build and lead a team that has your back. I'm your host Noah Labhart and today how Stephen Blum built the platform that powered virtual spaces with real-time integrated communication. All this and more on Code Story. Stephen Blum finds that his life outside of tech is tricky to define given we're surrounded by He was inspired to be a game developer at an early age, and he found it fun and exciting. And in those days, he really enjoyed The Legend of Zelda and Metroid. Those adventures and the animation was fascinating to him. After a while, he found more excitement within the business world and using technology to solve problems and profit. In fact, he finds it so much fun that what he loves to do outside of work and business is just chill. Stephen likes to support and invest in early-stage AI and API companies. companies he has invested in, and he wants to continue expanding that portfolio, and into crypto as well, specifically arbitrage through APIs, which he finds particularly fun and lucrative. Stephen's current venture, in their inception, was trying to solve a problem by simply creating a button to order a taxi. In the process of building that, they figured out that they needed tech to allow more than one party to participate, and their product vision clicked. This is the story of PubNub.

Stephen Blum

PubNub these days, we're calling it a virtual spaces. So sort of like connected experiences built in virtual spaces, which sounds like, okay, there's an abstract concept there, but sort of like everything's a virtual space these days where you have more than one individual, more than one party interacting. So when you order food, right? I'm hungry. It's lunchtime. I want my burrito. There's a lot of, a lot of parties involved there. You've got the restaurant, you've got the DoorDash and you've got the driver, and then you've got me, the, or the, I want my hungry. And so there's four, four parties there. And so you have to sort of coordinate all that together. You need to show the updates and status and notifications. Where's the car on the map, right? Are they, are they headed towards you or with the burrito or are they still picking up the burrito? That is the, that's what we facilitate. That's what PubNub is. We, we empower that connection in that virtual space. So you can facilitate the multi-party environment. And that's a small, small use case for us, a small volume use case. But the bigger use cases are fun where you get into games, where you have multiplayer environments and you need thousands or tens of thousands of players all interacting simultaneously. And that's the kind of power that we've brought into PubNub. All of our tech is written in C and everything all the way from from the edge all the way back into our PubSub bus is C. And it allows us to have this extremely low latency and full control of the network stack. And it's something that no one else has come close to in our industry. Yeah, we've got competitors, but they don't have our tech. We had a hard problem of getting two devices to communicate. So before the way when, when apps were becoming a thing and the iPhone was released, there wasn't really a way to press a button to order a taxi. you know, we're thinking, hey, wouldn't it be neat if all you had to do is on your phone here, right? We create a digital button that says order taxi. That would be awesome. Don't have to worry about calling. Let's just order a taxi. And so in the process of attempting to build that, it turned out that we need something like PubNub. And that was, you know, a big core, probably the most, the biggest part of that entire exchange was building that app. So So what we realized was that this tech could be used in more than one way. So instead of just doing, you know, the taxi dispatch, which, you know, looking back before Uber and before, you know, get taxi and all these other, you know, ride sharing apps. It might have been good if we had pursued that. But, you know, after releasing the API to power that sort of like, you know, the way in the gold rush was creating the tools. So we're building the shovel. right? The API. And that's what PubNub is. We've got these tools that let you create these app experiences in these connected spaces. And so it went beyond just ordering taxis. It went into gaming and it went into live updates and collaboration, you know, Atlassian. That's a big agile company with Jira, Confluence. They're our customer. They use us to power those kinds of experiences.

Noah Labhart

Tell me about the MVP, that first product that you built, you know, with the button to call the taxi and then everything that was behind or underneath that what you were focusing on, how long did it take you to build and what sort of tools did you use to bring it to life?

Stephen Blum

So it's, you know, rapid development, quick iterations, a few weeks. It's kind of what we were looking at in terms of in the app and then a very rudimentary prototype subsystem is today to facilitate that. There was a hard, challenging part of actually involving the dispatch companies, right? Because there were only taxi companies back then, and you would call in and then they would schedule a taxi for you. So we had to come up with a way to digitally place a place a call order it with the synthesized voice over the phone line and then getting a confirmation information and then relaying that via PubSub and our with our PubSub system back over the app. So the hard part was actually just in brokering the transaction with the taxi company. That wasn't the interesting part because you know phones aren't used all that much. We didn't see a future in phone from that perspective but we did see a future in the PubSub side of things. So we opened up the API for that. That's when that's when things got interesting. So we we started getting game developers. And that was one of the biggest first initial introductions. It's like, oh, we need to build a multiplayer game for this RPG. And, you know, we started seeing a lot of message and it was great. They were paying. It was crazy. You know, games, they often, you know, are profitable themselves and they were able to pay very regularly. And so it's like, hey, this is a reliable source of revenue. Can we can we grow that? Can we get bigger? I want to go bigger.

Noah Labhart

So sticking on the MVP a little bit, you know, when you're making that MVP and you're open sourcing the PubNub part of it, what decisions and tradeoffs did you have to make while you were building that part of the platform? You know, it could be how you're building it or, you know, feature limiting or tech debt, any sorts of things like that. Tell me about some of those decisions and how you coped with them.

Stephen Blum

I might be different than others in this aspect. Expectations were at, at the ceiling. I wanted something that was as perfect as possible, which, you know, goes against that, beats the purpose of rapid iteration, but I wanted all those things all at the same time, which I feel like I was able to achieve. And big part is, I wanted it extremely efficient, low memory, high, high throughput, uh, best, you know, cost of operation, right? I want to be able to push billions of messages through the system, deliver them at low latency, and beating everyone. So this is an example. When you pick up your phone and you dial a family member, that's a signal that goes to ring to your family member's phone, right? The ringing sound is a signal that goes over the internet to connect and dial your phone. That signal takes good three, four seconds before the phone starts ringing. And I wanted something that was so fast that it would be the speed of light at the possible limit of existing fiber optics. And we were able to achieve that. So it's the moment that you press the dial button, the other phone is immediately ringing. And this level of latency has brought in those over-the-top apps that use us today for ringing phones like Plantronics and those VoIP phones, soft phones on your app with RingCentral and several others. They use us to ring the phone because it's that much faster. And we can do that at scale. There's hundreds of millions of messages going through the system, and all of them are low latency. that cost effectively because of the tech stack that we wanted to create, as well as one extra bit. I wanted to be global, not just, you know, hey, you've got an API, you've got a single data center. I wanted every data center to work all the time for every customer. When you get onto our network, every single server is at your fingertips. And that's the level of multi-tenancy that I wanted to drive. We were able to achieve all those things.

Noah Labhart

You know, it is unique to want to build with everything and globally and performing so highly. But it sounds like you had a very clear vision of what you wanted to build in the very beginning. Do you think that's true?

Stephen Blum

Yeah, that's actually a pretty big part of it. It's just sort of listing out all the things that would make sense for a globally distributed messaging bus that would work for what normally you have inside the firewall with these ESBs and things like, you know, or RabbitMQ work great for inside the firewall. I wanted that level of resiliency, but even better performance for outside the firewall where normally you only have a thousand servers or 10,000 servers, but in the real world, you have hundreds of millions of phones and that's a lot bigger scale. And so today we have 800 million mobile phones on our network and we're able to keep up with the performance needed low latency game experiences. And that was that, that sounds like it was a challenge, but just going through and seeing what, so we built on Linux, what Linux kernel APIs are available. That was a key part of what made PubNub possible was actually just directly going to the kernel and seeing what they had available. They have these really powerful capabilities. and most software engineering projects today start with importing a library. Oh, hey, there's this library over here. We can just NPM install. Okay, now I've got a PubSub system and it will work pretty quick. But I wanted maximum performance and I wanted to be able to sell that.

Noah Labhart

So, okay, you've got the MVP, you open source the API, you start immediately getting traction How did you progress the product from there and mature it? And I'm curious how you went about building your roadmap and deciding, okay, this is the next most important thing to build.

Stephen Blum

A lot of it comes from promotion. So yes, we've got a really powerful product, but unless you promote it and you promote it in a very particular way, no one's going to use it. you can have the best product in the world that nobody uses. That would be sad. That'd be so sad, right? And so it's like, I want, I want to show the, and that was part of, you know, your initial question, how do we get into the technology world? The, the ability to show off how powerful certain technologies can be was maybe the driving point for me. I'd be able to show you the cool magic parts of PubNub. This is what you can do. You can build chat. You can build dispatch, right? For powering the on-demand economy, we need that level of, we need that PubSub system to do it. And being able to show those things and show those different opportunities was really interesting to see the stats on them. So we'd release these beachheads of these capabilities, right? these use cases, sort of solution stories. And what we'd see is we'd get folks who would find these web articles and landing pages, they would find them, but they wouldn't go with those solutions. For example, we've got a healthcare sort of doctor-patient exchange for telemedicine. We talk all about that. But then when we look at the stats and we see customers who hit those, they are actually in the gaming space so they understand the the value through different stories that we tell but they might not necessarily be in that market or in that industry so it's it's kind of interesting to see the different stories that are told and then how it translates and how they're able to translate it to their use case to solve the problem so that's that's a big part of it. You just need to go out and hit all possible use cases. This is something that's hard, I would say, for maybe anyone starting a business, but you really need to spend a lot of time on promotion. And I would say so much as 90% of your time should be spent on promotion.

Noah Labhart

Let's switch to team. So how did you build your team? And what did you look for in those people to indicate that they were the winning horses to join you?

Stephen Blum

So what I, what I like to do is, don't necessarily care about credentials. What I'd like, what I like to see is inspiration and motivation, right? And I don't necessarily need to see someone who's done you know, like 10 years, 20 years of experience. Just whatever motivation you have now, I want to take advantage of that. And that's, that's hard to find. And being able to cultivate that motivation maybe even more challenging, because what you have to do is create sort of an open field with key objectives and outcomes on the, on the outset, and then leaving an open for the team to be creative. That's a big part of agile, but I think it's way overlooked because in that world, often most companies will, you know, do their own flavor of agile and they'll leave out probably the most critical part of that is allowing the team to be inspirational with their solutions and giving them the ability to define the goals and then achieve those goals that hit towards those business metrics that you're looking for. And that's, and that's scary because if you do that, then you're leaving your whole business and the entire livelihood on the table up to the team to, to take care of. And they need, I think they need that. I think if you don't have that, you're leaving so much on the table with that team and their, their opportunity, their potential. You're only leveraging a fraction of it. So I really want to leverage the entire asset, right? Let's leverage all their skills as much as possible. And that has to come from within. And that motivation is really easy to lose. It's super easy to lose. So it's just keeping that team motivated. And it doesn't necessarily come with years of skill. It just comes with the drive. And that's the critical thing. Look for the drive.

Noah Labhart

Well, this will be really fun to hear your answer to this question. And I think you're going to pounce on it, which I'm super excited about. But I'm going to ask it super open and generic. Did you build this to scale efficiently from day one? Or are you fighting this in any way as you grow?

Stephen Blum

The design was intended to build and scale. But initially, you know, as we were, we didn't want to waste a bunch of money and saying, here we go, and we can just handle any load immediately. We didn't autoscale, right? That's a big part of modern cloud and APIs is being able to autoscale. It's all been manual, and we have to sort of predict. And the challenges with messaging infrastructure and our latency being, you know, under 30 milliseconds pretty much everywhere. How do we, you can't launch a server in 30 milliseconds. It's not possible as with existing tech. we're ready to go for that scale. And that's what we've been doing, uh, for the past decade is having that. And only, uh, only this recently since, um, since lockdown, uh, you know, starting in 2020, we, we realized the, we need, Oh, one second. Sorry. Uh, phone call. Okay. Uh, we realized the importance, um, and, and the desire to get more towards that auto-scaling. So we did it, uh, during, during lockdown and things like that. We've, you know, we modernized on containers and, uh, full CI/CD auto scaling with Kubernetes. And it's great, and we've had the biggest, uh, even to prove it out, we had one of the biggest, so BTS, as, you know, popular musician transition, uh, band setup, get up, you know, they use, uh, they use us, and they use us for that, that experience when you're, you know, um, trying to do audience, uh, online, right? Simulating the audience online in the interactivity. They, they used us, and, you know, we didn't have to go and have our team scale up a whole bunch of servers. It just worked. It auto scaled. You know, it took about a minute, but that's exactly the amount of time that we needed, because once they open the doors, right, because you're in the lobby and you wait and then you go in, it immediately, it's an immediate surge with millions of users, and being able to sort of tune that was the big win that we've had over the years. We did not start out with that at all. And that was like, back to your questions, like, Hey, did you start with being able to scale out the box? And the answer is no, we didn't.

Noah Labhart

So as you step out on the balcony and you look across all that you've built, what are you most proud of?

Stephen Blum

The team and probably every, every team and every company always talks about tech debt. like, oh man, we have to rewrite everything. But if you look at what we've built in our capabilities and, you know, our uptime stability, cost efficiency, and, you know, overall service ability, if you look at that, our code, I'm really proud of our code. What we've created, of course, everything has debt to it. But the system that we've built has always, you know, been number one. And I'm really proud of that. I think that's, that's fantastic. And we've even had, you know, different, different points at PubNub, you know, we want to make sure that we're secure and scalable. You know, we have folks that come in and sort of grade our systems, and it helps us, you know, focus on which parts of the tech debt, but we've, we always pass with flying colors on the code side, when you compare us to the rest of the industry. And it's, it's just a good that. And, you know, over the years, you know, we want to maintain that. And I think we've got a good, a good formula to make that possible.

Noah Labhart

Let's flip the script a little bit. So tell me about a mistake you made and how you and your team responded to it.

Stephen Blum

The best possible business that I can imagine is you going onto my website, site, clicking a button, and then I get money. Right?

Noah Labhart

That sounds good. That sounds like a good formula. I like

Stephen Blum

it. Yeah. I like that. Yeah. I love that. We can't do that exactly with an API company, but we can get close. So you have to download an SDK, right? And that helps bridge the gap. So you don't have to worry about message signatures and security and it's just all built in. So we have to do that. Well, that means that once we've launched that SDK, that's code that's running on millions of devices, like hundreds of millions of devices. And often they don't get upgraded very, very quickly or at all, as we've noticed. So the mistake that we made was in a retry policy in one of our SDKs that happened to be running in 120 million AT&T phones on the AT&T's network. So what happened was a DNS mistake was made on one of the vendors' side, and this caused a retry loop to start. When that happened and the DNS was corrected, things were able to reconnect, reconnect, but it happened in such a fashion where they would reconnect, and every time it failed, it would try to reconnect twice, and then when that failed, it retried, tried to reconnect four times, and that would happen every second. And so once the DNS was fixed, every phone was already trying to retry a thousand times simultaneously. And so immediately the entire AT&T IP block became a DDoS for our network. Oh, no! Like, all of a sudden, all the dashboards and all the alerts went off. Like, what's going on? What's happening? Why is this? We're just trying to figure it out, and we just see all these devices just in a retry loop. So we were able to pin down the IP block. We were able to siphon off those clients, we had a separate endpoint that would return successful statuses to all those phones. So that way they'd clear the thread loop and then get back down to one retry per second. And once that happened, we then migrated the healthy traffic back to the main network and everything went back to normal.

Noah Labhart

Well, what does the future look like for PubNub, the product, and for your team?

Stephen Blum

So we just closed our latest round of financing, 65 million. We want to continue to provide value at various levels. I'm very interested in AI and ML. So we've got 22 petabytes of data going through the network every month. And what we can do is provide these really powerful and potent models to our customers to help augment the existing data going through the pipe. And there's just so much opportunity because the whole thing of AI and ML is you need that data. You need the data in order to create good models. And good news, check it out, we have that data. The data's there. And so I'm eager and excited to begin offering new advanced technologies and capabilities and bringing AI and ML to existing customers and new customers. That's one of the big things that I'm excited about. From a product perspective, let's say. From a company perspective, you know, the IPO. Let's do that. Let's do IPO. That sounds great. Why not?

Noah Labhart

Well, let's switch to you, Stephen. Who influences the way that you work? The CEO, CTO, architect, really any person that you look up to and why?

Stephen Blum

It's more about, are they showing a lot of energy and drive? and if I see that, that motivates me. That's the big thing for me. It's like, if there's just a lot of energy and drive there, I see that, I get motivated, I echo and, you know, match that volume. And my goal is like, how do you measure if you're successful? I measure success if you've done better than you did the previous day. I think that's a good measure of success. us. Because imagine 100 years from now, the kind of technology and things that we're doing are going to be a little bit behind. Right? There's always going to be more advanced technologies, more ways to achieve. Yeah, exactly. More ways to achieve things. So let's stay on the forefront as much as possible and continue to drive down that path.

Noah Labhart

Well, we talked about a mistake earlier with the DDoS retries, but a little bit different spin. If you could go back to the beginning, what would you do differently? Or where would you consider taking a different approach?

Stephen Blum

I mentioned earlier that promotion is very, very critical, 90%. When I say that, I'm not really kidding. I think I'm just being weird. We really should have spent more time continuing to invest in that level of promotion. And what I kind of want to do is kind of like a pipe dream, maybe, you know, in an upcoming adventure, who knows, maybe even at PubNub, is create a media studio 100% dedicated to telling the story and showing possibilities of what the product is capable of and creating that inspiration and awe. So that way, if you haven't heard about us or you do hear about us, you can see what's capable, what's new, and just becoming a print house, a media house that's just dedicated to that. We, we've got started a little bit on that, but nowhere near, uh, to what we, just never kept it up, and so it's actually kind of a hard thing for any business. You're looking at your stats and you're inbound and trying to correlate what's bringing, what's driving the business. And every time you look at it, everyone isn't going to immediately draw the conclusion of what's, what's bringing that business in. And I've had a hard time selling that it is the media. Like, hey, guess what? what are we doing right now? This is what I, that's what I want to do. That that's going to be a guaranteed the next thing next time, or if we can get it going this time around, I'll have a dedicated media studio, videos, audio, um, diagrams, stories, podcasts, everything. We need to have that. And that all that media will be free and informative and valuable. And, you know, a drive back towards the main product, which is PubNub.

Noah Labhart

last question, Stephen. So you're getting on a plane and you're sitting next to a young entrepreneur who's built the next big thing. They're jazzed about it. They can't wait to show it off to the world. Can't wait to show it off to you right there on the plane. What advice do you give that person having gone down this road a bit?

Stephen Blum

Releasing a product isn't, isn't the starting line. If you kind of look at it, it's, uh, you're, you're, you're not, you're barely getting started, right? One, once you launch the product, there's just going to be so much more to do. It's, it's a never, never ending thing. And it depends on where they want to go with it. What is it? Is it, are we talking about a game? Are we talking about like, you've heard of Clubhouse, right? Yeah. Yeah. They're, they're a, they use us, they use us. They're one of our customers. And it's, it's always cause we've got thousands of customers, you know, flock to us. We are looking at them. We talk to them. It's really hard to tell which one's going to take off because, there's only a handful that ever organically take off like those two. I mean, like less than a percent. It's just not many. And so if you, if you want to be successful with your application and your, what you can't just expect or assume that you're going to, you have to, you have to make the smart bet, right? No bet that it's not going to be just an instantaneous, you know, unicorn, because they're rare. So what you got to do is create that business plan that includes the promotion. Like I would always go back to say, spend 90% of your time on promotion. You got to do that. And from there, you attract minds and people start talking and you get that network effect. And then you start to continue the echo. Just keep going from there. That's any one thing that I could say is 90% of your time on promotion.

Noah Labhart

That's great advice. Well, Stephen, thank you for being on the show today. Thank you for telling the creation story of PubNub.

Stephen Blum

Absolutely, Noah. Thank you.

Noah Labhart

And this concludes another chapter of Code Story. Code Story is hosted and produced by Noah Labhart. Be sure to subscribe on Apple Podcasts, Spotify, or the podcasting app of your choice. Support the show on patreon.com slash Code Story for just five to ten bucks a month. And when you get a chance, leave us a review. Both things help us out tremendously. And thanks again for listening.

Stephen Blum

Thank you.

Transcribed with Whisper and reviewed for names and terms; speaker labels are automatic and may contain small errors. Timestamps link to that moment of the transcript.