But Does It Scale?

Sep 20 09:21

The question that has haunted me since the beginning, and how I overcame the fear of it.


[00:00:00] Caleb: Okay. This is a big one. This is one that deserves more than the amount of time. I'm giving it but and more planning but I'm kind of on a roll and I want to just get the conversation started but does it scale this is the question that has haunted me since day one of Livewire and my journey. I live where Journey has been a massive lesson in overcoming doubts really pushing through them and just doing it consistently over a long period of time.

so live? Where was a proof of concept in PHP for tool that exists in elixir in Phoenix Elixir is. Great at concurrency and by concurrency. I mean like a process running on the server that's continuing and that a user is connecting to over websockets on the front end and has a consistent connection to a concurrent connection and the user can.

Make a request on the front end to the back end to change a [00:01:00] real runtime object and it will change in real runtime metal, you know, so that's what I started out building live wire as the proof of concept was that and I'm like there was some video I post on Twitter at one point that I'm like laughing to myself like this is crazy.

There's a counter that exists in PHP like a count variable that exists. And when you hit plus you tell the server to change that variable in real-time. Okay, so that at first it was this like toy project that was just super attractive to me, but it wasn't attractive to me because of the Cool Tech behind it.

What was attractive to me was the concept? Of not having to deal with all the glue code of Ajax and everything because basically in my mind Live Wire is just taking care of all of the all of that glue code nonsense you're dealing with when you're dealing with UJS because you're doing a lot of the same things you're listening to events.

You're reacting to them. You're sending Ajax requests and updating data or fetching data and changing the page, but you're doing it all [00:02:00] yourself. So what if there was something that did it all for you and you could not have to deal with specific with separate endpoints that return Json. In a standard format that's restful and tested and all that stuff.

What if you could just access PHP from JavaScript wouldn't that just be freaking magical and that's that's the whole concept that just drove me. Everything else is just an implementation implementation detail even websockets as a core concept. Which was you know sort of came a bit later anyway, so does it scale first? It was just a pet project. So it didn't really matter if it's scaled or not. I didn't really care. I was just having fun. Then I start, you know, I got into the project maybe about a month into it and I'd like put a lot into it. I've been blogging and doing screencasts and this thing lingered in the back of my mind.

That's like. Oh boy. I looked at every possible websocket implementation for PHP and I always had this scared feeling of like man, if people can't just use Pusher for this like this is going to be this is going to [00:03:00] be potentially not viable for a lot of people what I want to deal with websocket infrastructure for PHP know I definitely wouldn't what I want to do that in production. No, I would not have to I would not want to have to make sure that a websocket process is running. Doesn't fail and can handle unlimited or a ton of connections that get thrown at it. That's a hard task. The default with PHP fpm is like a thousand something concurrent connections or I don't know whatever I was using ratchet. There's all these different tools. None of them are like first class citizens like Phoenix channels, which is Phoenix's answer to websockets. So honestly, it just kind of was this thing that laid low, but like I said, I believe in live where I believe in the. Or in the you know in the use case of it. So I just kept moving forward with it, which is kind of insane and I remember having some real low points. There were a bunch of really low points. I'm literally in Disneyworld having a bad day. We moved to basically Disney World for two months. It's like snowboarding and I quit my job and I [00:04:00] worked on live for and that's kind of where all where a lot of these early things happened and I'm in Disney World and like having a bum day because I feel like live wires over my brain up.

It's over like this isn't viable as a legit awesome solution for like real production apps like for everybody so why am I wasting my time like this is you know, when I would always tell people like oh, you know, I'm just kind of working over now, but who knows he has probably not gonna you know, but it's like deep down. I just like something in me refused to stop working on it because it's just so. I don't know. It's so enticing this prospect that it offers us. So anyway, I'm at Epcot and I'm walking out of Epcot and well, I guess I'll fill in I'll fill in a gap here. I created a Ajax driver. For live where for my little local Livewire toy playground at the time because I was like if the websocket connection if I change to file I had to restart the websocket server, [00:05:00] so I would have to do that every time and I'm like, oh, that's really annoying. Well, what if I just create a little Ajax driver that does this. So that I don't have to deal with websockets that it rehydrates and everything. It's funny that I put all this work into make an Ajax driver the time. I don't remember being a lot of work but like I did it even though I didn't need it and turns out that was like the best decision I ever made so I started using the Ajax driver locally.

I thought like oh, this is one of those things like the inline script tag like oh, this is just like bad. This is just to to janky like I'm not going to actually ship with this with people aren't going to use that because Ajax all it's so slow. You know, that's just be crazy. But I used it myself then I was at Epcot and I basically realized I had this Moment of clarity.

I was like, the only way forward is the Ajax driver. Like that's the only way forward the web sockets thing. I'll keep it around but I need to own a Jack's like I need to make it because if I owned a Jack's then the [00:06:00] tech I'm requiring people to have to use Live Wire is Ajax, which. Every browser has and everybody uses. It's just like saying you need PHP to run might you know, it's like zero infrastructure to use this tool that's insane like this that I could make the setup like cake like nothing like everybody could include it in their apps instantly and how could that not be like incredibly easy to onboard and become popular and Powerful, you know, So it just was sort of clear to me.

There's this Moment of clarity and I felt amazing. I was on like top of the world. I was like I fixed it in my brain. I fixed it. I fixed the thing the answer the question I had that was like Livewire has a timeline on it and it has like a death an expiration date. The date where I figure out that this websockets things not going to work. I remove that was like I could really own this then I got into like researching all the other people who do sorts of things like this like GitHub does this and basically solidified my position [00:07:00] is feeling like this is ok. And now I have a hundred percent confident that like, this is totally the right way and it's great. And this is where it's diverge from live view like Livewire uses Ajax and because and because of that we're not doing animations. We're not making games like live view is like weird. Submitting forms and validating and showing data in tables and real-time search stuff that like, we're actually doing a new eyes like not like games and stuff.

So. I find it to actually be a more practical approach and and it affords us all sorts of cool things and there's lots of creativity to be smart with resources. Anyway, does it scale now? It does just Ajax scale does GitHub scale? Yeah, so live where scales and that that that questions been answered for me and now I never have to worry about.

Like answering GitHub issues about how to keep websocket concurrent connections over a concrete on and then like my friends like not wanting to tell me but actually feeling like they're never going to use this because like it's going to require websockets. [00:08:00] Oh, oh does it scale? It does now and it was a long time until I came to that conclusion.

So I hope this has been an inspiration for you that if you're working on a project that you have doubts about like technical implementation doubts push through them if you believe in it. Push through it work on it and work on it and work on an iterate on it and iterate on it because you cannot predict that in three months. You might have some stroke of inspiration or it might evolve in such a way that now the original problem doesn't even exist and it's taken on a new form. So I hope this has been an inspiration for you and your projects. I really really honestly I'm going to say it one more time. I've learned the biggest lesson. I've learned with Livewire this like I probably going to say that multiple times but different things but the biggest lesson I've learned in Livewire is that if you if you think something is impossible or if there's like a technical hurdle, it's just a challenge. It's not it's not a stop sign. It's just like a hill that you have to [00:09:00] climb.

You can push through anything. There is not one thing. I have not been able to conquer which is crazy with enough like work and sitting and talking to people you will come to something and that is like the most empowering thing in the world. So TTYL TTFN. Enjoy your day. Thank you for listening.