top | item 41762524

(no title)

gatnoodle | 1 year ago

It's frustrating that when people discuss React on the server or frameworks like Next.js, the conversation rarely acknowledges the performance cost that comes with Server-Side Rendering (SSR). The excitement tends to focus on the benefits like SEO and initial page load performance, but the limitations and potential drawbacks of running JavaScript server-side are often overlooked.

As traffic increases, the server's ability to handle requests diminishes, especially under high loads with complex rendering. This is exacerbated by the fact that each request often requires repeatedly rendering the same React components from scratch, rather than reusing client-side resources.

discuss

order

johnny22|1 year ago

> , the conversation rarely acknowledges the performance cost that comes with Server-Side Rendering (SSR)

This conversation is so old that most of the people having it already know this implictly so don't consider it even worth mentioning. I know I never do, because I started with things like php which works like that.

com2kid|1 year ago

I've met plenty of devs who have never seen php and who consider server side rendering to be magic because "Vercel takes care of it".

willsmith72|1 year ago

well of course, but no matter what you do a "server" takes increased load as traffic increases (maybe it's just cheaper and simpler if it's a managed cdn)

you always have the option with react on the server of returning a minimal skeleton and client rendering the rest. the point is you can make those decisions case-by-case

com2kid|1 year ago

I wrote a blog post about this a few years back and got lambasted for daring to question the wisdom of SSR.

That same post still gets plenty of views from people looking up on Google if they should use SSR though.

Doing everything client side means scaling asset delivery is trivial. A potato running nginx can serve an absurdly large number of concurrent users fetching the same static payload.

Those backend apis need their own scaling story, and different types of APIs have very different scaling stories.

What doing some rendering server side and some client side can do is create confusion as to what is done where. (And with particularly bad settings even leak api keys, oops!)

tarasglek|1 year ago

I had dev who praised next, turned out he had no idea when his code ran on client or server.

Joeri|1 year ago

I keep being puzzled by the SEO argument because google indexes client-side rendered pages just fine. Are there really SEO problems that are solved by SSR?

The initial page load argument is real, but is sort of a self-imposed problem because page loads would be fast if there wasn’t this massive bundle of JS code that’s 95% infrastructure and 5% actual site content.

satvikpendem|1 year ago

> I keep being puzzled by the SEO argument because google indexes client-side rendered pages just fine. Are there really SEO problems that are solved by SSR?

In theory, yes, in practice no. I've deployed SPAs for landing pages as well as server-side rendered or statically generated pages, and there was a huge difference in indexing and SEO between the two. Google can say they render client-side pages just the same, but I have not found that to be true at all.