Live data from Hacker News

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

malloc.fi

51–60 of 134 posts

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

#51
post #11

OK from single core $10 VPS you will be able to serve 1,080,000 unique initial loads per hour and depending on your pattern of traffic say 15,000,000 in a day could you remind me what the issue is again?

It's a real issue, my startup's react SSR times are ~5 seconds of blocking the node thread on my $40 droplet. It's about 50% react. Our pages are way more sophisticated than your average page with like a query and a form, though. There are many ways to make faster though, one of which is to simply configure your CDN properly.

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

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

#52
post #11

OK from single core $10 VPS you will be able to serve 1,080,000 unique initial loads per hour and depending on your pattern of traffic say 15,000,000 in a day could you remind me what the issue is again?

Assuming that your actual use case is rendering one small HTML table, yes. It probably isn’t, though.

OK lets assume it's 30x that do you really think that 300/month for SSR would be an issue for a site serving 400 mil sessions per month?

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

#53
post #51

Earlier quoted context omitted.

It's a real issue, my startup's react SSR times are ~5 seconds of blocking the node thread on my $40 droplet. It's about 50% react. Our pages are way more sophisticated than your average page with like a query and a form, though. There are many ways to make faster though, one of which is to simply configure your CDN properly.

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

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

#55

I'd love to see a side-by-side comparison to Marko.js ( https://markojs.com/ ). It has a lot of react-like features, but was built from the ground up for SSR speed.

Marko keeps some bechmarks here: https://github.com/marko-js/isomorphic-ui-benchmarks

Not too sure how accurate or biased they are, though.

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

#56
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?

More and more sites are using React for general purpose server-side rendering, even if the site isn't a single page app. I believe that's what the article is targeting.

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

#57
post #48

Earlier quoted context omitted.

There's the lit-html[1] project, which is still fairly new. It uses tagged template literals to render to the DOM, so on the server side it could fall back to vanilla string interpolation. [1]: https://github.com/PolymerLabs/lit-html

And hyperHTML [1] that preceded it and has near identical API. [1] https://github.com/WebReflection/hyperHTML

Thanks for the heads up, I've definitely seen that one credited but I thought it used to not use template literals. Clearly it at least does now.

EDIT: Yeah, looks like it's always worked that way. Maybe I was thinking of another lib.

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

#59
post #11

OK from single core $10 VPS you will be able to serve 1,080,000 unique initial loads per hour and depending on your pattern of traffic say 15,000,000 in a day could you remind me what the issue is again?

It's a real issue, my startup's react SSR times are ~5 seconds of blocking the node thread on my $40 droplet. It's about 50% react. Our pages are way more sophisticated than your average page with like a query and a form, though. There are many ways to make faster though, one of which is to simply configure your CDN properly.

50% on plain rendering is very unexpected. Complex apps tend to have bottlenecks on IO/data fetching more than just plain rendering.

I would love an article detailing your experience and measurements.

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

#60
post #49

Earlier quoted context omitted.

How do you do that with dynamic content?

In my view the user-specific parts and frequently updating data should be rendered on the client side. The pre-rendered HTML should contain the less-frequently changing information that is important for SEO.

Given the option, and pretending it were just as easy to implement either, why would you wait until the document loads to fetch resources via Javascript when you can render the content on the server?

The article points out one downside: React's render-to-string faculties are slow.

Post reply on HN