3 ms·
The way to achieve this "nirvana" is really quite straight-forward: render all items on the server. No, not as a page-view but as the the individual items makin
by dingdingdang 12y ago
The way to achieve this "nirvana" is really quite straight-forward: render all items on the server. No, not as a page-view but as the the individual items making up your page. Now, when people visit "mysite.com/index.php?search=&page=1" for the first time the server knows because the req arrives as a GET, hence it renders the whole page using the individual items (and the JS on the user site internalizes this state). When our user now navigates to "mysite.com/index.php?search=&page=2" the JS forwards the req to the server via a POST. The server now responds with ONLY the changed data which the client-side proceeds to insert/update where needed. This is short edition but this is how I do these things at the moment and it works.
- danellis 12y agoWhat data are you POSTing?
- remon 12y agoServer side rendering has significant upsides but I feel one of the biggest downsides is consistently ignored when discussing it, namely that when you render (parts of) pages you burn expensive server side CPU cycles rather than the free client side cycles which in most cases noticeably affects hosting/scaling cost.
- drivingmenuts 12y agoThose free client-side cycles have a hidden cost - slow rendering times, especially on mobile. If you've done your work right, server-side is scalable.
- remon 12y agoIt's not so much a scalability issue as a cost-per-user issue. Obviously client rendering performance (or lack thereof) is a concern and if server side rendering solves that for a manageable increase in cost that's perfectly fine but that cost has to be part of the conversation.
- drivingmenuts 12y agoOK, I get that. I think that Javascript can do some awesome things client-side (and I have used them to do that), but when you leave the server, you lose a lot of predictability and that can ruin the user experience. I worry that if we push too much onto the client, then we're asking them to do all the work while we sit back and take advantage of them, for marginal benefit to the user.
- shawabawa3 12y ago"free client side cycles" For certain definitions of free. I've found that sites which abuse this tend to be much less responsive and can even cause my laptop fan to start spinning like crazy
- remon 12y agoI agree. I was referring to the actual cost of the cycles but there are many situation where you need to find a balance between cost and fluent user experiences. My point was primarily that the consideration that server side resources are more expensive should be part of the evaluation.