The Real Cost of Server-Side Rendering: Breaking Down the Myths
Posted by congolomera@reddit | programming | View on Reddit | 185 comments
Posted by congolomera@reddit | programming | View on Reddit | 185 comments
Juris_LV@reddit
It's a strange feeling to read all these comments as if new devs just do not know you can also just write laravel, symfony, ruby on rails or any other server side framework and get all requests sub 10ms response easily and get faster and more accessible solution
No_Ambassador5245@reddit
PHP has been shunned down so much and I understand it's not simple to work with for most modern devs, people is even scared to work with it sometimes. Currently it's even forbidden for new developments, we only support some legacy PHP apps on my team.
But for the websites I sell, Laravel is my go to and honestly it's the easiest shit in the world. Not even a front end framework is needed, sometimes just plain JS and probably some jQuery for simplicity. Sometimes less is more, at least when you understand the target scope.
BackgroundFederal144@reddit
You use jQuery? Why?
serpix@reddit
The average dev barely knows about db transactions, barely.
jezek_2@reddit
I think it's because the developers think you're supposed to use all these complex frameworks and don't know the simple ways anymore. And that you don't need the very overpriced cloud services for majority of projects, a single VPS/dedicated server can handle a lot.
Echarnus@reddit
Cloud infrastructure calculates the cost to maintain it. You can also greatly reduce your cost by using serverless infrastructure. It’s not fair to compare a server on 24/7 uptime with just the bare bone costs in mind.
Coffee_Ops@reddit
There's nothing strange about the feeling I get hearing "we'll throw more cores at it".
The feeling is rage.
nimbus57@reddit
but but but, those aren't reactive. how can i react to my users if im not using a reactive library?
mohamed_am83@reddit
Pushing SSR as a cost saver is ridiculous. Because:
Blecki@reddit
Hydration errors, good god... just don't use some stupid framework like react? Go back to the good old days. Your backend makes a page. Click a link? Serve a new page. The internet used to be so simple.
jl2352@reddit
People just don’t want a web experience like that. People want Slack, Figma, Google Docs, Maps, and Spotify in their browser. None of those would work well with hard refreshes between pages.
Even something like YouTube will quickly become a mess if you’re spitting raw HTML and hooking into it with jQuery or whatever.
You may not like apps in websites but users do. It is just nicer for anything beyond reading documents.
CurtainDog@reddit
Nah bro. You're mixing two subtly different ideas. People want sites like Wikipedia or even, and this is shocking I know, Reddit. It's just that they're not willing to pay for them. Fortunately AI has come along and promises to have uses pay for information that they always had access to all along.
Magneon@reddit
It's no walk in the park but that's likely how it worked for most of YouTube's existence.
crackanape@reddit
Back when it was fast.
BigHandLittleSlap@reddit
Your example of YouTube has morphed into an absolute pig of a client-side app that is incredibly, astonishingly slow.
I hate what it has become, because it used to be fast!
acdha@reddit
I think this is really the key question: am I building an interactive app where you have long sessions with many interactions updating the same data or is it short duration with more of a one-and-done action flow? The more you need to manipulate complex state for a while, the more a CSR makes sense – especially if you have a larger development team to soak up the higher overhead costs.
PaulBardes@reddit
No joke I thought about making a web server using nginx as an entry point and dishing out dynamic content to literal shell scripts... Use awk as a kind of rudimentary router, sed and bash to do some templating and if necessary call some DB's client to get some data...
Even with all the overhead of not using proper optimized languages for the task I'd bet that it would be at least as performant as most of the popular tools today...
church-rosser@reddit
kids these days...
janyk@reddit
Reinventing cgi bins?
csorfab@reddit
Old man yells at cloud
Venthe@reddit
Yeah, no. I'm maintaining such a solution, there is a reason why we moved away from that.
lelarentaka@reddit
Hydration error is not specific to React, fundamentally. In the """good ole day""" of web programming, if your javascript references an element ID that doesn't exist in the HTML, you get a bug. That's basically what a hydration error is in NextJS, just a mismatch between what the JS expect and what the server generated HTML provides. In both cases, the error is caused by sloppy devs that don't understand the fundamentals of HTML rendering. Whether you're using VanillaJS or NextJS, bad devs will be bad devs.
mastfish@reddit
The difference is that react makes it damn near impossible to avoid hydration errors, due to weird environment specific differences in behavior
jl2352@reddit
I dunno. I’ve never really had any serious hydration errors with web frameworks.
I always make an interface for the state inside the store. That’s my hydration boundary. I spit it out in that shape, and load it back in that way. As one giant blob. With TypeScript ensuring I’m meeting my interface.
Maybe I’m missing something in this discussion but that really isn’t difficult or advanced to do. Maybe a bit fiddly on the afternoon you’re setting it up, but then you’re done.
lelarentaka@reddit
By "environment specific" you mean server-side NodeJS and client-side browser JS ? Again, that's not specific to React. You get the same issues with Vue and Svelte and Vanilla.
OopsieImLateAgain@reddit
Where did you pull this number from? SSR returns are pretty well in line with JSON responses.
I wouldn’t expect SSR to need more ram or compute over json responses all accounted for.
ImNotHere2023@reddit
X to doubt that claim of 10x the rendering cost - if you do it well, you render non-personalized content once and cache it. I've worked on a couple very large websites that were SSR rendered on a handful of machines.
That allows you to save your effort CSR for the personalized content.
mohamed_am83@reddit
caching spares a lot of the processing (i.e. CPU) for sure, yet you still need to have your fat node.js server sitting (idle sometimes) and prepared to calculate new data. Under reasonable load a node.js server will need +100MB RAM. The same load can be handled by nginx (among other options) with less than 10MB RAM. This is where the 10x comes from.
DHermit@reddit
Who says that the server side renderer has to be node based?
mohamed_am83@reddit
The OP's article. Citing Next.js and Remix, all node based.
ImNotHere2023@reddit
Client side, JavaScript is essentially your only choice (assuming you're doing relatively vanilla HTML stuff, so wasm is overkill). Server-side there's no reason to contain yourself.
b_quinn@reddit
You mention a CSR server? What is that? CSR occurs in the user’s browser
mohamed_am83@reddit
Sorry guys I wasn't clear u/b_quinn u/crummy u/Annh1234
CSR server has 2 components: 1. one that serves your the static files (HTML, JS, CSS) needed for the browser to render the page (e.g. nginx). and optionally 2. some process to pre-render the html every now and then if you want to help search engines.
Annh1234@reddit
Well put
devolute@reddit
I love this language btw: as if doing this is benevolence, rather than a #1 business-driven need.
It's an attitude I see a lot in FE performance evaluation.
mohamed_am83@reddit
let's unpack that:
It is not benevolence, it is pragmatism: you want people to find your content, even if it is your passion blog. People use search engines and LLMs. These often won't do the dynamic rendering for you. You do the math.
> It's an attitude I see a lot in FE performance evaluation.
We proudly do that because we want to be fair. SSR does both static file delivery and pre-rendering. If you want a fair comparison, your alternative should also do both.
devolute@reddit
You've 'unpacked' perfectly! They did the math.
crummy@reddit
i believe by "CSR server" they mean "a server that does not do SSR", i.e. one where all rendering is handled by the clients.
b_quinn@reddit
Oh I see
Annh1234@reddit
I think it's the opposite, as in, if you use some server side language to render your HTML ( nginx less memory and couch used) vs use NodeJs runtime server side to load some JSON generated in the same server ( RAM and CPU used )
b_quinn@reddit
Not sure I follow. Are OP and you saying that non nodejs server side rendering is more efficient than nodejs?
Annh1234@reddit
Yes, for the first time you see the page, it's way more efficient to use some php or whatnot to render your HTML. It's like 50mb RAM vs 2GB type of thing.
If you got a site where the same people refresh a ton of pages for hours on end, that's when you want to save bandwidth with client side rendering.
But most those sites are after a login, so no point of server side rendering those pages for SEO.
Dependent-Net6461@reddit
I have a vm on 4core 16 gb ram running a java server used by thousands of users on a big erp software. Most queries are under 10ms , complex ones dont go over 30.
Just learn to use the best tools and git gud.
acdha@reddit
None of the things you mentioned are universal truths, and at least one is an outright error (“hydration errors” are a cost of using React, not something anyone else needs to worry about). There’s some truth here but you’d need to rewrite your comment to think about the kind of site you’re building, the different categories of data you work with, and how you’re hosting it. You also want to think about the advantages of SSR like much faster initial visits, better error handling, and better data locality.
As a simple example, think about your first point about server size: if memory usage is driven by the actual content then you’re paying the cost of processing it either way — if I have to search 20GB of data to get that first page of results, the expensive part affecting server provisioning is that query, not whether I’m packing the results into JSON or HTML. If it’s public content, the cost in most cases is zero because it’s cached and so SSR is a lot faster because it doesn’t need a few MB of JS to load before it makes that API call.
Those network round-trips matter a lot more than people think: they ensure that visitors have a slower first experience for a CSR and if anything goes wrong, the site just doesn’t work (exacerbated by frequently-changing bundles taking longer to load and invalidating caches). They also mean you’re paying some costs more often: if I hit a 2000s monolith, I pay the logging, authentication, feature flag, etc. costs once per page but I have to do that on every API call so there’s an interesting balance between overhead costs and how well you can mask them because a CSR can make some non-core requests asynchronously after the basic functionality has loaded. Again, this isn’t a simple win for either model but something to evaluate for your particular application.
This isn’t a new problem by any means but I still see it on a near-daily basis, and those sites which underperform a 2000s Java app are always React sites when I look. Last week I helped a local non-profit with their donation page which a) had no dynamic behavior (just a form) and b) kept the UI visible but not functional for about a minute while a ton of JS ran. This is not an improvement.
It’s also not the 2000s anymore and so we don’t need to think about huge app servers when it’s just as likely to be something like a Lambda or autoscaled container so we’re not paying for capacity we don’t use and we can scale up or down easily. That starts getting interesting trade offs like how much faster your servers are than the average visitor’s device, especially when you factor in internal vs. internet latency and whether your API allows that CSR to be as efficient when selecting the data it needs as a service running inside your application environment can be (e.g. I can cache things in my service which I can’t do in a CSR because I can’t have the client do access control).
This is especially interesting when you think about options we didn’t have 20 years ago like edge processing. If I’m, say, NYTimes.com I can generate my entire complex page and let the CDN cache it because it has a function which will fill in the only non-cacheable element, the box which has my account details. Again, different apps have different needs but this capability allows you to have the efficiency wins of edge caching without having to shift all of the work to the client at the cost of lower performance, less consistency, and more difficult debugging.
It’s also not the case that we have to write JavaScript on the server side, and you can easily see your claimed order of magnitude RAM reduction by using a leaner language than something like Next. A CSR can switch frameworks but not languages, so once you’re down that path you’re probably going to keep paying the overhead costs because it’s cheaper than rearchitecting. A similar concept applies strictly on the client side: React’s vDOM has a hefty performance cost but switching is hard so most people keep paying it, especially since their users don’t charge them for CPU/RAM so it’s less visible.
alfcalderone@reddit
Isn’t NYT running on Next?
Shakahs@reddit
No, they use React with their own in-house SSR technology.
https://www.reddit.com/r/reactjs/comments/1drbsak/enhancing_the_new_york_times_web_performance_with/laupj9i/
acdha@reddit
If they are it’s not immediately obvious (I haven’t looked at their JavaScript bundle contents in a while) but my point was really just that there are many sites, including some very high traffic ones, which have possible solutions on a spectrum between “every page view comes back to my server” and “every page view is rendered in the client”. Our job as engineers is to actually measure and reason about this, not just say “I’m a wrench guy, so clearly the best tool for the job is a wrench”.
DrShocker@reddit
To your second bullet point, that's why I would prefer going all in on SSR in the style of data-star.
to your last bullet point, expanding on above, the beauty is you can use any language that has a templating library so you can blow JS out of the water server side.
cach-e@reddit
As somebody from the games industry, this made me lol. Generating an html-page takes more time than we have allocated to render a full 3D world + simulate physics + AI + everything else we're doing? That's just insane. How is it that slow?
OopsieImLateAgain@reddit
The web in particular is full of people who were brought up believing that all optimization is the root of all evil. That even measuring performance is bad and should only be done if you are struggling to find more hardware.
cach-e@reddit
Did they miss the part where Knuth said premature? :)
DrShocker@reddit
I agree SSR is good/fast, but saying Next is fast because it can generate that quickly sounds silly. Are you sure 20ms is right? That sounds abysmally slow for converting some data into an html page. Is that including the database round trips? What's the benchmark?
I've been on a htmx or data-star kick lately for personal projects, and I'm glad I've got faster options than next for template generation if that is correct though.
PatagonianCowboy@reddit
this is why the modern web feels so slow, even simple stuff takes so much time
zanza19@reddit
Speaking these nonsense when game dev is in the worst state ever, specially with regards to performance, is just... Chefs kiss.
OopsieImLateAgain@reddit
Game engines are definitely relying a lot on fake frames for velocity today.
And even then, they’re still order of magnitude more performance capable than far and away more web applications.
Dragon_yum@reddit
That’s why I write my html on UE5. It has all the tools I need built in.
iBzOtaku@reddit
cant tell if this is sarcasm
Those_Silly_Ducks@reddit
You're crazy, Unity is way faster to render, and I am not paying nearly as much for the library.
Dragon_yum@reddit
Until the ceo decides you need to pay per page load.
duva_@reddit
Unreal engine 5?
Dragon_yum@reddit
Yes
Chii@reddit
but that game engine only has one client to process.
Imagine writing a game engine that needs to output graphics for a 1000 client at a time!
Wooden-Engineer-8098@reddit
It seems you are not aware of massive multiplayer games. They handle millions of concurrent clients
Chii@reddit
it appears you're unable to understand the difference between rendering graphics vs just streaming information to a client side process which renders a single instance of graphics.
Wooden-Engineer-8098@reddit
It seems that you are unable to understand that your node.js does not render 3d graphics
Chii@reddit
ROFL
that is the most ridiculous assumption i've ever heard
Wooden-Engineer-8098@reddit
Then you should hear your own assumptions
rayreaper@reddit
Exactly! I’m genuinely baffled by the upvotes on that parent comment, they’re talking about MMOs as if the servers are out there rendering everyone’s graphics. That’s not how any of this works.
Ashken@reddit
It’s a common theme amongst game devs to shit on web devs when they’re not even considering the full scope of what it entails. At the end of the day they’re all different paradigms trying to solve different problems. Not sure why we even compare the two.
Coffee_Ops@reddit
Mmos are generally not rendering graphics for their clients. They're doing world calculations and server-side sync.
Wooden-Engineer-8098@reddit
Lol, web backends don't render 3d graphics either
birdbrainswagtrain@reddit
Webshits when you tell them concatenating some text should be faster than running game logic, stepping a physics engine, updating a scene graph, and submitting commands to the GPU to render a frame: 🤬🤬🤬
LBPPlayer7@reddit
and 60 frames at the minimum to render per second
60 requests per second is quite high traffic for a website
Chii@reddit
i really dont believe 60 rps is a high amount - it's decently high, but relatively achievable even with a slow language like nodejs.
LBPPlayer7@reddit
okay let me put that amount of traffic into perspective
that is 216 thousand requests in an hour, most websites don't see those kinds of numbers in a week if not a month, let alone an hour
and if you're getting those kinds numbers in your traffic, you're probably big enough to have a data center at your disposal
jakesboy2@reddit
the webpage wouldn’t even run at 60fps lmfao
Familiar-Level-261@reddit
It's not 20ms to render some templates that make it feel slow, it's megabyte of client side garbage that does
PaulBardes@reddit
20ms requests make the server start tripping at only 500 reqs/s. This is shamefully low. Thinking 100 to 200 ms for a database round trip is ok is also kinda insane...
I'm not saying SSR is necessarily slow, but the author clearly doesn't have a very good sense of performance and isn't so we'll versed on what they are talking about...
Familiar-Level-261@reddit
It's lightning speed compared to wordpress instance tho ;)
Also if your server is doing 500req/sec you probably are doing pretty well and app pays for itself. Like, sure, not ideal but not nearly close to being a problem
eyebrows360@reddit
~0.2s for mine baybeeeeeee!
Which is why slapping Varnish in front of it is so important. ~0.002 from that.
Familiar-Level-261@reddit
Huh. I kinda expected lower because that was about the ballpark I saw for wordpress last time I looked at it, about a decade ago.
...which means the WP devs incompetence grew at roughly same rate as compute speed
eyebrows360@reddit
Can't really generalise that much, with just my one data point. Most of my sites are also pretty large (~200k+ posts) and WP does not cope well under such circumstances.
Familiar-Level-261@reddit
Eh, it's mostly overload of plugins that gets it. Especially if developer is clueless.
For example one of popular WP "security" plugins turns each read (which is few selects to DB, easily cacheable even with just DB's cache) into extra write (or multiple) and some code to deem client worthy getting the request result, absolutely tanking the performance.
PaulBardes@reddit
That's fair... But having a good performance buffer to be sure you can survive short peaks of requests is kinda nice, especially for situations like the infamous hug of death from reddit or other platforms...
Truantee@reddit
You are aware that server can have more and one core, thus can run more than one nodejs server, right?
Coffee_Ops@reddit
Throwing more hardware at it and thinking you've solved it when your baseline is 20 milliseconds request is a pretty big symptom of the problem.
This is why developers drive infrastructure guys crazy. You are aware that throwing more cores at it can have steep virtualization and NUMA penalties pretty quickly, right?
danielv123@reddit
What kind of SSR workload doesn't have trivial scaling?
valarauca14@reddit
Any that involve network-IO.
Coffee_Ops@reddit
This is why devs drive infrastructure people nuts. It's not just about your workload. Increased core counts affect HA and can incur cache penalties if you cross a NUMA threshold.
danielv123@reddit
Then spin up 2 smaller VMs or containers. This is why I usually end up doing infra, because the IT/infra team very often have no idea what the workload requires. If you are going to point out problems, find some that aren't trivial.
Coffee_Ops@reddit
Optimize your code.
Additional VMS have overhead too, because now we have to pay for additional seats on various endpoint software, and we have to eat additional overhead for the OS and endpoint software.
Certainly you do it if you have to, there's nothing wrong with scaling up and scaling out when you actually need to, but what we're talking about here is absurd. The author is claiming that 100 to 200 milliseconds for a basic SQL query is just fine and dandy. I'd sooner light the cores on fire than give more of them to someone who writes queries like that.
Wooden-Engineer-8098@reddit
I'd rewrite server side js in faster language before adding second core
CherryLongjump1989@reddit
Faster language is not the problem. Also you wouldn't, because it would just make everything worse. The whole point of SSR is to trade some server resources for client side load time. So unless you also rewrite their billion LoC React monstrosity to load within a reasonable amount of time, you're stuck with SSR as one of the lowest hanging fruit to improve the user experience and your company's search engine rankings.
Truantee@reddit
You do not need a second one. Nodeshit cank only run single threaded, thus to utilize the whole server you actually need to run multiple instances. It is easy to do (use pm2) and is common practice deploying nodejs server.
Either way, 20ms response times does not mean the server can only serve 500 requests per second. It is ultra retarded.
Wooden-Engineer-8098@reddit
I said second core(as in CPU core used), not thread. You have to show that you can use one CPU efficiently before taking another one
CherryLongjump1989@reddit
Is there a corresponding rule for leaving comments on Reddit?
PaulBardes@reddit
The naiive calculation would be actually 50/s, with a load 10x the average throughput any server would start hitting bottlenecks almost immediately. Also, notice that the choice of the word "tripping" was very deliberate, since as you start going over this limit, requests will start getting even slower and a growing queue of stalled request will very quickly turn into a memory snowball that will either get OOM killed or start swapping into a halt...
Also, also... If the requests are independent you absolutely can run multiple node interpreters, it's just lazy and wasteful, but totally doable. And I'm pretty sure just the event loop is single threaded, you can do all sorts of concurrent and/or parallel computing with node...
frymaster@reddit
PaulBardes@reddit
Jesus, my drunk math made the same order of magnitude mistake twice! I'll shamefully add a correction... It's kinda funny how long it took for someone to notice 😅
PaulBardes@reddit
Also, no saying megabyte sized SPAs are acceptable, but even on a modest 20 mbps link a 1MiB of data takes 40ms... It's not great, but it's literally faster than humans can react (usually), so the real waste is what those megas of code are doing under the hood. Also, one massive request vs hundreds of tiny ones makes a huge difference. Too many requests and network round-trips is usually what makes things feel sluggish or unresponsive.
DrShocker@reddit
From my perspective it's just that if someone is the kind of person who thinks 20ms to render some text is reasonable, then what else is slow just because they don't realize it could be better?
Agreed though that decreasing the time to push out the response increases how many responses each server can handle by decreasing the probability any given response overlaps in time.
PaulBardes@reddit
My thoughts exactly... Ignorance on the basics like this casts massive doubt on the quality of the information provided in the rest of the article...
Truantee@reddit
You are a clown that do not even know that typically we run several nodejs services in the same server, why act so cocky?
venir_dev@reddit
I swear I cannot possibly understand what's in the mind of the CTOs in the last 5 years who are making these kind of decisions.
eyebrows360@reddit
So you're in a cult, is what you're saying?
fumei_tokumei@reddit
What does that have to do with the horrible performance suggested?
Coffee_Ops@reddit
... Who then addresses performance concerns with, "we'll throw more cores at it!"
Familiar-Level-261@reddit
that's 400ms
PaulBardes@reddit
Whoops, that's my bad, thanks for the heads up... I'll add an edit note
Familiar-Level-261@reddit
yeah, that's my point, as noted by the "garbage" describing it.
Coffee_Ops@reddit
As a not-web dev, my first thought was-- I don't know what you guys are doing wrong, but you're doing a lot of it.
iamapinkelephant@reddit
20ms is about the time it takes for sound to go 7 meters, so like, from one end of an average loungeroom to another. You wouldn't even be able to perceive it. And unlike a game engine a website needs to be interpreted in realtime in a multitude of environments which grants drastically fewer opportunities for optimisation. And also, unlike a game engine, typically renders once and there doesn't have anywhere near the same problem space.
Dumpin@reddit
What does that even mean? As the article says, SSR is the process turning data structures into HTML markup. How is this difficult to optimize? You'd expect gigabytes of throughput per second on modern CPUs even without any fancy optimizations.
nimbus57@reddit
Why would you expect gigabytes of throughput per second? Not that I'm disagreeing with you, but if you make wild claims, you should back them up.
siranglesmith@reddit
React isn't fast. 20ms is actually very low.
If you're render a decent amount of content, and using a ui toolkit (one that wraps each element like ariakit or styled components), you'd be lucky to hit 50ms.
And unlike db operations, it's all cpu time. It's expensive.
Tomus@reddit
Modern react applications don't render and flush the whole page at once. You can control how much blocking CPU work is done before sending the page using suspense boundaries, there's no need for pages to be spending 100s of ms on SSR anymore.
nimbus57@reddit
..... "spending 100s of ms on ssr". Um, my friend, welcome to forty years ago.
Tomus@reddit
I'm pretty sure SSR wasn't around 40 years ago.
rayreaper@reddit
Not quite 40 years, but close to 30. We’ve had server-side rendering and dynamic web code since the mid-1990s, CGI scripts, Perl, PHP, ASP, and beyond.
acdha@reddit
Yes, technically the web is only 36 years old. Resist the tyranny of rounding, this is a vital contribution to the discourse!
Of course, since the web wasn’t the first time this idea had been considered so we have to consider how far off of Nugent’s 1965 hypertext thesis is from the idea, or the various online services which existed in the 1970s onward.
joelypolly@reddit
Well, it is probably close enough to that. WebObject was a thing back in the mid 90s
sexytokeburgerz@reddit
The mid 90s were 30 years ago. Ten years in tech is the difference between the space jam website and facebook.
Skithiryx@reddit
Since they talk about the render step vs database operations I think they are assuming the render starts with all info needed already in memory. (Which presumably they would also be assuming for client-side, rather than counting the backend API time necessary to hand the browser the data)
alfcalderone@reddit
It’s interesting that the articles opens discussing the “new trend of ssr”. I’m feeling old because SSR used to be just “it”. I still think if SPAs as “new”. Or the alternative to SSR.
veverkap@reddit
I keep wondering why they are calling the normal thing by a new name. Going all the way back to CGI, it's always been this way and client side rendering is the new thing.
stipo42@reddit
It's funny how things came full circle.
Php was the go to 20 years ago and was basically the same as modern SSR.
Then Ajax /asynchronous was the hot thing and was abused so bad that people decided to go back to SSR to increase performance of UIs instead of fixing their asynchronous code.
rayreaper@reddit
Not sure why you’re getting downvoted, you’re exactly right. The only thing I’d add is that it was really easy to end up with spaghetti code back then, mixing partial server-side reloads with Ajax-driven event handlers.
Modern SSR frameworks actually address a lot of those issues with cleaner state management and rendering pipelines.
StepIntoTheCylinder@reddit
I think because SSR and classic server-side are very different. The only similarity is that some kind of process runs on the server. Take any SSR dev and any classic server-side dev, and have them swap jobs, and see how well the knowledge transfers.
CherryLongjump1989@reddit
SSR has always referred to the concept of rendering single page applications on the server. The "it" that you are referring to never really had a name, but you could call it just "server rendering" or a multiple page application.
pg-robban@reddit
"I used to be with 'it', but then they changed what 'it' was. Now what I'm with isn't 'it', and what's 'it' seems weird and scary to me, and it'll happen to you, too"
Hot-Charge198@reddit
soon, ssg will be the new "trend"
Amuro_Ray@reddit
Likewise, I remember that being the main way we wrote stuff for projects when I was at university in 2009.
BRUVW@reddit
- Connection overhead: Every request requires TCP handshakes and teardowns
This is wrong.
fatoms@reddit
Yea, for an article about HTTP based services it is surprising they seem unaware of http1.1 pipelining and http2 multiplexing.
Makes me suspect they have an agenda to push....
yawaramin@reddit
It's correct if they are talking about HTTP requests.
fatoms@reddit
HTTP 1.0 - 1996.
HTTP 1.1 - 1997.
HTTP 2.0 - 2015.
HTTP 3.0 - 2022.
If they are stuck using HTTP 1.0 I suspect they have bigger problems that lack of SSR.
yawaramin@reddit
If you look around at most webapps today you will sadly discover that they do have many big problems.
venir_dev@reddit
like it or not, Phoenix LiveView solved this, and the rendering still happens on the server. I hope that pattern will take its rightful amount of space in this industry
crackanape@reddit
Each request might require it.
And it still does require RTT, particularly assuming there's any contingency or dependency at play.
RandomName8@reddit
most of the claims where.
acdha@reddit
I’d add another challenge: accessibility. I was initially surprised by was how strongly blind users preferred SSRs – not just because they loaded faster but because dynamically loading different elements can be very confusing from the perspective of what a screen reader announces.
You can avoid this with care, of course, but clearly that isn’t something which is done widely enough for users not to have a litany of complaints about sites where they have to wait for important things after the page load is “complete”. Since this is both a legal requirement here and also a moral good, I’ve tried to make sure we test early and often for this kind of UX papercut.
Much-Bedroom86@reddit
Not only do you have to sometimes wait for the important thing but I personally hate when you go to click a link and the whole page shifts down right before you do because some html above it finally rendered.
acdha@reddit
I especially love that when the site isn’t doing anything more than tables and forms, so it’s just like time-traveling back to Rails/Django 1.0 except harder to use, as if the last two decades never happened.
anon_cowherd@reddit
This isn't an SSR vs SPA issue so much as it is an accessibility concern around dynamic content. It's been an issue since before SPAs were a thing. Thinking back to my early development days and there were modals and carousels everywhere that were all completely inaccessible.
acdha@reddit
Yes, but SPAs tend to make it easier to create a bad experience because an SSR you’re at least giving the client a full DOM up front. It was quite interesting to hear people I trust saying that they thought the web was getting worse, when I knew full well that the browsers, screen readers, etc. had been improving.
anon_cowherd@reddit
I actually wonder if much of this is simply due to how much more of our lives can't avoid the Internet.
Take banking, for example. There was a time when ActiveX or Java plugins seemed to be required by every bank to do anything worthwhile, and Java, Flash etc were all accessibility black holes.
It was largely XmlHTTPRequest and moderate improvements to runtime JS performance that convinced people to move away from making flashy java/flash/etc plugins, but it was also the very thing that heralded web 2.0 and dynamic content.
acdha@reddit
I’m sure that part of the problem is that many organizations now aggressively push you to use web-based contact systems so there’s no longer an easy option to speak to a human on the phone. That’s an important safety valve for a lot of situations which don’t fit cleanly into the predefined options.
nimbus57@reddit
I would argue that SPA are almost always poor ux. Well, for most of them that exist that are little more than basic static sites. Well, static sites that someone wanted to feel special about so they put something "reactive" on the page.
Let's be clear, spa are a pox on the modern web landscape. Not that they have no use, but your site isn't any better or more special because it has arbitrary dynamic content.
acdha@reddit
I look at it on a scale of interaction/update frequency & session length. If you’re building Slack, doing things client side makes sense because people open one window for hours and do hundreds of interactions while updates constantly stream in.
The less your site looks like that, the more you have to ask whether you’re paying the costs to solve other people’s engineering problems, similar to the people who jumped on the database evolution the huge tech companies followed without thinking about how many orders of magnitude greater traffic and resources a team at Google has compared to their own project.
nimbus57@reddit
Yea, some sites really do well in the transition to lots of client side stuff.
It's a shame so many normal sites think they are like that.
chat-lu@reddit
As the CEO of HTMX, I think that our solution is even friendlier to blind users.
ahfoo@reddit
Try to use persuasive language in Reddit posts instead of relying on your personal identity for authority. The problem with the latter is that, unlike Facebook and other "social media" that focus on the identities, Reddit is meant to be a place to discuss ideas rather than tout your real-world authority and assume that is meaningful to the discussion.
chat-lu@reddit
CEO of HTMX is a meme. Everyone is the CEO of HTMX.
Basically, it’s the library that popularized a return to serving plain HTML, and swapping in rendered HTML instead of having javascript render the app. You get most of the interactivity of a SPA and usually more performance, with much simpler code.
There are other libraries that follow the same philosophy, like Unpoly, Datastar, and a few others.
onan@reddit
That sense of the term "meme" requires some sort of shared contextual framework.
Given that most people even in this subreddit have never heard of this thing, and you didn't actually provide any additional information, you probably shouldn't be surprised that it really did just sound like you were talking about some company you run.
nucLeaRStarcraft@reddit
Now you know about it. Welcome to the shared contextual framework.
AndrewNeo@reddit
meme just means 'funny video' today
mordack550@reddit
We were very surprised about Blazor SSR performance and low costs (which I dont see it mentioned here, probably because the discussion is very javascript-focused), also because it's very "natural" to develop, there are no particular strange hoops to go through, if you are already fluent in .NET.
CherryLongjump1989@reddit
Blazor is more like server rendering on the client. You're just packaging up server code into WebAssembly as a way to shield developers from JavaScript, but it doesn't really work. It's painful to integrate with JavaScript libraries and painful to test.
mordack550@reddit
We don't use Blazor WebAssembly but Blazor Server, which is a real SSR.
CherryLongjump1989@reddit
Does it run JavaScript? If not, it's not SSR.
smalls1652@reddit
There are three rendering modes for Blazor: Static server side rendering, interactive server side rendering over WebSocket, and client side rendering with WebAssembly. Static SSR was added in .NET 8 almost two years ago and does not require constant client <-> server communication. You can technically combine all three if you really wanted to, but there are a lot of footguns and complexity if you do go down that route and I wouldn't suggest it.
So yes, it can do SSR.
https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/?view=aspnetcore-9.0#render-modes
CherryLongjump1989@reddit
None of these modes are SSR. So no - it can't, and Microsoft doesn't get to come up with their own definitions in their sales materials.
"Static SSR" is not SSR.
smalls1652@reddit
Static SSR is true SSR though. The page is rendered on the server upon request by getting whatever data is needed and applying it to a template before it is sent to the client. That is how SSR worked pre-AJAX interactivity. It's not some made up Microsoft definition, it is literally the way we used to build websites back in the day with PHP and the likes.
Interactivity is limited to whatever HTTP request the client sends that the server supports and, if done, you embed JavaScript into the template that dynamically modifies the page on the client. Like a blog using static SSR dynamically generating the HTML by getting the resources from a database and applying to the page template before it's sent to the client. Or a forum where you submit a form to the server with a
POST
request, the server processes it, then generates a completely new page, and then sends it back to the client. It's not rendered into raw HTML at compile time, so it's not SSG.Like I said, it's the exact some method we used to do with PHP and the likes. For something more "modern", the Leptos framework with Rust, which is something I've been dicking around with lately, can do the same thing. It includes the capability of SSR with interactivity afterwards using client-side WASM hydration, but you can forego using that entirely and just have the server only respond with HTML.
ewigebose@reddit
Oh God. I tried using the Elixir equivalent, Phoenix LiveView and if I could emphasize connection fragility I would.
CONNECTION FRAGILITY
CONNECTION FRAGILITY
THE FUCKING SOCKET CONNECTION WILL BREAK WHENEVER IT FEELS LIKE AND RE-ESTABLISHING IT IS LIKE PULLING TEETH. IF YOU HAVE RURAL USERS WITH POOR NETWORK FORGET ABOUT IT.
The worst of both worlds SSR and CSR.
chat-lu@reddit
The real cost is that you have to use Javascript on the backend too.
jcotton42@reddit
No you don't? You can use whatever on the backend.
CherryLongjump1989@reddit
SSR refers to running a single page application on the server. It is necessarily JavaScript.
jcotton42@reddit
SSR refers to rendering HTML on the server. It does not necessarily refer to running an SPA.
CherryLongjump1989@reddit
SSR refers to rendering HTML on the server which can be hydrated by client side code in order to make it interactive. Without the second part of that, it is not SSR.
StepIntoTheCylinder@reddit
SSR has people so confused. Just comparing it to classic server-side is wrong. The only thing they have in common is a server.
acmeira@reddit
Vercel's marketing is getting more and more shameless
lurco_purgo@reddit
I wonder what lead to that decision...
acmeira@reddit
Probably some CEO's childhood issue.
pjmlp@reddit
Meanwhile Go is still beta, and Rust a community runtime, for those cases where performance makes the difference.
At least node native modules are supported.
cheezballs@reddit
I'm tired, boss. We're back to SSR being the "new" thing?
Sorry-Transition-908@reddit
What are you doing? Did you scroll through the article after posting it?
Sorry-Transition-908@reddit
Friends don't let friends post on medium dot com :/
ericl666@reddit
If I want a "full SSR" experience, I'll go back to using ASP.NET Core MVC.
CherryLongjump1989@reddit
I facepalmed so hard.
NAN001@reddit
This doesn't make any sense. First the orders of magnitude are bonkers (20ms to render HTML is huge, and 100ms for a "straightforward" query??), and second, it doesn't support the conclusion. 20ms out of 120ms is still 17%. If that truly was the case, then it wouldn't be a conspiracy theory that cloud providers would push for SSR for an additonal 17% of compute.
Dependent-Net6461@reddit
The real problem is using js in a server
prisencotech@reddit
Optimize your queries and architecture, because that is not acceptable.
pyeri@reddit
There is also the "platform monopolizer problem" here. Even assuming that the software architects did their homework and SSR brings them some savings in hosting cost, what's stopping Vercel from increasing the tariff and grab those savings back from customer? That's what companies do. It'll be especially easy with SSR and clients would have been locked in to their technology and have nowhere else to go without incurring massive migration costs.
iamapizza@reddit
Even if it's lightweight as the article claims, there's a boatload of gymnastics being recommended to deal with the issues it brings. So the cost is in the complexity and implementation overhead that SSRs eventually bring in order to make them performant.
The post also does a comparison in bad faith, it's not comparing like for like, instead just focusing on one specific number to make it appear like a cure all and deliberately skewing what happens client side.
I'm thinking this is probably an advertorial for remix or next.
SocksOnHands@reddit
I hate the very fundamental concept of server side rendering. It definitely isn't about speed - computers, including low end home consumer devices, are mind bogglingly fast. This isn't the early 2000s, when people had 400MHz single threaded CPUs and 64 MB of RAM, which was more than enough power for displaying web pages. It isn't about user friendliness, since pages with SSR are riddled with annoying bugs like losing focus while trying to type in an input box. It isn't about responsiveness, because the information needed to build the page still needs to be fetched and used. One may argue it is about SEO, but I'm sure there are better ways to address that. If someone argues it's to avoid things shifting around the page while components get mounted, then someone should come up with a good client side solution to that. In today's day and age, there is no technical reason to need server side rendering.