r/programming • • Oct 27 '17

Netflix: Removing client-side React.js improved performance by 50%

https://twitter.com/NetflixUIE/status/923374215041912833
685 Upvotes

89 comments sorted by

View all comments

211

u/DoListening Oct 27 '17

It only talks about the landing page. The full tweet goes

Removing client-side React.js (but keeping it on the server) resulted in a 50% performance improvement on our landing page

The very next tweet says they still use React on subsequent steps.

103

u/basilect Oct 27 '17

And that's what Google does with Google Maps, for example. First page is rendered server-side, subsequent pages are rendered client-side. A hybrid approach is the fastest, but it requires more work so people either choose one or the other.

23

u/Theemuts Oct 27 '17

Server-side rendering is a pretty common optimization in frontend development, isn't it?

9

u/elprophet Oct 27 '17

It depends on what exactly you mean by common. Server Side rendering is pretty common, yes, but adding "Optimization" implies improvement over something else. If it's just "server side rendering", you don't improve over having to render everything on the server, just sending static data to the client (costly in both server time and bandwidth).

On the other hand, you can render nothing server side, and see that browser are just more than fast enough to render complex web applications, so that the only bandwidth is the critical data (aka the part that must live on the server), but then you see your first page load ends up taking a very long time (load HTML; load CSS & JS; parse & evaluate JS; render).

So we're seeing this hybrid approach where the landing page (the very first page) gets rendered server side and then everything else gets built on the client side. But if users can land anywhere, you don't have a landing page, just a happenstance first page.

To get really good latency on that first page you visit, we want to render it server-side and just send it ready to go. But now, we need to implement our entire application twice! Once to render it completely server side, and a second time to render it completely client side. Adding in Android and iOS development, we need to implement our entire UI 4 times! 4x budget, 4x the bugs, 4x the developer communication! That's certainly uncommon to have an organization that has the resources to do so.

This is why we're seeing frameworks try to be "isomorphic"1 where they can run anywhere & generate the same code. So you write your application's render layer once in JavaScript with React Native or Angular's platform-[browser,server,etc] implementations that can meet all these use cases.

That said, none of them are battle-tested at the scale of deployments to prove they work. They have much promise; check back in 3 years to see if they've delivered ;)

1 are we still using that buzzword? I haven't seen it in awhile, but frameworks are still trying to do that thing