Live data from Hacker News

The Performance Cost of Server Side Rendered React on Node.js

malloc.fi

61–70 of 134 posts

Re: The Performance Cost of Server Side Rendered React on Node.js

#61
post #51

Earlier quoted context omitted.

did you ever consider that you might not be doing something right ?

Not really, I'm the consultant people hire when they need to solve issues like this. There are some screenshots of what we're doing here: http://www.hyperfiddle-consulting.com/ http://hyperfiddle.net/ As I said, our app is sophisticated

Why in the world would you take over scrolling like that

Is this how you get your kicks?

Re: The Performance Cost of Server Side Rendered React on Node.js

#62
post #10
post #2

I thought the idea was to render it server side just once, then have the client take over for all future requests? In which case it's 10x slow for the first page load, but all future requests are just hitting API endpoints and can be fairly fast?

Correct, except that initial app load time for un-cookied users with cold browser caches is a critical metric, since it largely determines whether they'll keep using your app. Fortunately, those are the scenarios where server-side caching can have a decent benefit, since you're essentially rendering the same view to all such users.

Modern JS frameworks try to solve this problem by inlining critical CSS and JS into the head for anything above the fold, and loading the rest dynamically.

Re: The Performance Cost of Server Side Rendered React on Node.js

#63
post #37

Isn't the whole point of server-side rendered React to render it just once, when building the website, and then serve it as static HTML/JS/CSS assets using a static webserver?

That's one use case. The other is for performance/seo where the initial markup for the app is generated and served to the client as HTML, then the React app bootstraps on the client and takes over managing the DOM.

This is what I'd like to see a performance comparison for.

1. Initial load using client-side vs server-side rendered. (Server-side should be faster.)

2. Warm load using client-side vs server-side rendered. (Client-side should be faster.)

Comparing to static is interesting, but not really an option if you're serving dynamic content.

Re: The Performance Cost of Server Side Rendered React on Node.js

#64
post #51

Earlier quoted context omitted.

did you ever consider that you might not be doing something right ?

Not really, I'm the consultant people hire when they need to solve issues like this. There are some screenshots of what we're doing here: http://www.hyperfiddle-consulting.com/ http://hyperfiddle.net/ As I said, our app is sophisticated

What is the slowest part? Doesn’t look that complicated visually.

Re: The Performance Cost of Server Side Rendered React on Node.js

#67
post #51

Earlier quoted context omitted.

did you ever consider that you might not be doing something right ?

Not really, I'm the consultant people hire when they need to solve issues like this. There are some screenshots of what we're doing here: http://www.hyperfiddle-consulting.com/ http://hyperfiddle.net/ As I said, our app is sophisticated

what exactly are the bottlenecks? Done some profiling or benchmarks across your codebase? You say blocking node thread and how exactly are you using threads in node? Maybe resource contention is the actual blocking instead of your ssr pipeline. Lots of variables to look for but it still won't match 5 seconds unless you're doing something very wrong. Anyways there's always a choice for writing hot code in a performant language if you know one...

Re: The Performance Cost of Server Side Rendered React on Node.js

#68
If you're on the fence about server-side rendering being needed for your webapp don't do it! As a team of two with one engineer, I decided YAGNI and instead focused on the responsiveness of the React and Redux-based web application. It is very snappy to load and our (paying) customers are happy.

You might not need SSR. I don't. I expect there will be more work to optimize it and eventually it'll be obviously a good idea. But you don't need it right now if you're working on a SaaS product.

Re: The Performance Cost of Server Side Rendered React on Node.js

#69
post #19
post #17

Earlier quoted context omitted.

Does anyone actually use vanilla JavaScript string literals for all their backend rendering?

I do this. It’s surprisingly effective, both in actual performance and developer productivity. The one area where it is useless however is for mutating DOM. It’s easy enough to create DOM using template strings, but if you say need to render something and then mutate it later on in you render function, it becomes terrible since you either have to do tricky string manipulation, actually create the DOM and use methods…

Same experience here.

Re: The Performance Cost of Server Side Rendered React on Node.js

#70

If you're on the fence about server-side rendering being needed for your webapp don't do it! As a team of two with one engineer, I decided YAGNI and instead focused on the responsiveness of the React and Redux-based web application. It is very snappy to load and our (paying) customers are happy. You might not need SSR. I don't. I expect there will be more work to optimize it and eventually it'll be obviously a good i…

Also, if you _need_ SSR, rails might be a better approach. It's too bad the author didn't include it in the benchmark.
Post reply on HN