Let's talk about performance and more specifically about web performance. And whenever we talk about web performance, especially these days, the conversation usually very quickly drifts towards things like server-side rendering and maybe even streaming as a way to make your rendering as fast as possible and as efficient as possible. Now in this talk, I want to explore what that landscape looks like of web rendering at the moment, how we got there, some of the limitations of traditional server-side rendering and streaming, and then specifically dive deeper into how out-of-order streaming solves some of those limitations so that hopefully by the end of it, not only do you get an idea of what out-of-order streaming is and how it works, but maybe more importantly, you will hopefully get an idea of what problems it actually solves and what the core motivation behind this technology is.
Quick disclaimer before I get started. This is not going to be a talk where I'm going to tell you, you have to use server-side rendering and out-of-order streaming, and otherwise you're stupid and you're wrong. I just want to give some details on how it works and why it might be useful so that you can go away and still make a hopefully more informed decision for yourself based on your projects and your team and all the other requirements, whatever the best solution is for you.
With that out of the way, let's get started with why. What problems does out-of-order streaming actually solve? And to understand that, we kind of need to take a quick look at the history of web rendering and how we got to where we are today. And we have to start at the very beginning, which I would call the good old days, with plain HTML and maybe some server-side language on top of that. I'm using PHP here, mainly because that's what I used when I started. It doesn't really matter. It could be any other server-side language. Fundamentally, they all do the same thing, which is generating that HTML on the fly.
So if we visualize that, we have a browser that makes a request to the server for a specific page. That server then generates HTML, returns that HTML and the browser renders it. And that's it. Much simpler times, because that HTML is purely static. We don't have any dynamic elements just yet. The response time of the server really depends on what we're doing on the server. So if we're just looking up static HTML files, that's really quick. The more we do on the server, say we connect to a database, or we're fetching data from third-party APIs, the more we do, the slower the response time gets. And that's annoying on the initial load, because you're just waiting for that HTML to come in for a long time. But it gets even more annoying as you navigate around the page, because every time you click on a link, we have to do that whole full loop again. We go back to the server, the server generates the whole HTML for the new page, returns that, and then renders that. So this is really frustrating for pages where we do more on the server. So we tried to solve that problem by introducing JavaScript. Specifically, this is kind of the jQuery era and the introduction of technologies like AJAX. So we're talking 2006-ish here. And the idea was with JavaScript, A, we can make our applications more interactive and dynamic. So now when we're requesting a page, we're still going back to the server, the server still returns static HTML, but now the server can also return a JavaScript file.
Comments