60 points · by dwltz · 11y ago · 69 comments
Hm, don't depend on a database when rendering your page? scnr
http://kephra.de/blog/Make_here_CMS.html <- shameless plug ;-)
This static site generator only requires make and bash. Being bilingual requires JS at the client, and the picture galleries are created by a 7 lines XSLT/PHP script under makefile control.
https://www.digitalocean.com/community/tutorials/how-to-inst...
I actually have javascript disabled on one of my mobile phone browsers simply for speed reasons.
However some STUPID developers need to be named and shamed.Like this one :
voxxed.com
that displays A BLANK PAGE ON PURPOSE WHEN JS IS TURNED OFF.
proof : in their css :
.hidden, .no-js {
display: none;
}
That is absolutely revolting.Rendering static content client side using JavaScript is a bad idea, even if you have fast network in terms of latency and speed.
The main problem with this AJAX antipattern is, that it blocks all spiders and search engines. So you should not do that, if you are not Google docs, who can inject the content into their own search engine, and wants its content not to appear on other search engines.
As a rule of thump: Do not use JavaScript for anything that should be indexed by a search engine. Instead use JS only when interacting with humans, e.g. for blog comments, checkout and payment. Hiding comments by making the comment system AJAX might be a good policy for a blog, if you do not want the comments to appear in search. But the blog posting itself should be static content.
And don't forget about other search engines. It's not very good to keep site indexable by Google and not indexable by other search engines.
Do you think the latter would work?
This conflicts with the goal, that blog post itself should be at delivered as a static content, at best from a static file, to withstand a HNDDoS even on low budget.
So one solution could be to run the comment system as AJAX, moderate user comments a few times a day. Click [x] on every comment, you want to appear in the static page, and [generate comments] to generate a new static page, with the new public available comments.
Give each user a cookie and a localStorage, to show their comments in their own AJAX version, even if you blocked them from both the AJAX comment system and the public one.
I believe the theory is that your application may take a little longer to load initially, but subsequent interactions should be much faster, since all rendering is happening on the client, and the server is only delivering API interaction. There is also the potential for even the initial render to be faster depending on what server-side rendering logic is being transferred to the client.
It depends on what you are actually doing and how much you cache client side, but for most cases that isn't going to make things faster for the end user.
Take the example of a theoretical blog post that takes 10ms to get from the database and 50ms to render on the server. You could potentially save server capacity by shifting that 50ms of rendering* from the server to client, but in actual fact the client (a low powered mobile device) probably renders it slower than the server.
The main thing though is this doesn't take into account the 2500ms round trip time it takes the mobile device to make a HTTP request. This is going to be the same whether you render on the client or server.
Now I agree it makes sense in some cases, if you cache the data on the client (ie an email client could cache the 100 most recent emails) then it will be faster, but the most services that use client side rendering aren't doing this, so there is no real benefit to the end user.
(Apologies if I'm just repeating the article, but it's down for me)
*Serialising into whatever format you API uses is still rendering, so you aren't actually saving 50ms.
But...
Clissold Leisure Centre is run by a charity. They've clearly gone for the cheap option here. Sometimes cost outweighs the benefit of spending more on the site - they needed a feature rich online booking application and got one that's a bit slow. It's possible that this is the best they could afford. It's also possible that the rendering time of the site has no impact on the signups or bookings that the leisure centre takes. In which case you have to ask - why should they spend more on a better app if there's no benefit to their business?
If it's not the case, you shouldn't use Angular at all.
If something really is dynamic, use a dynamic technique. If something is static, use a static mechanism.
Simple really...
I am currently using virtual DOM to render and I have no problem "rending my page using JavaScript" Even with an insane amount of page data that is rendered dynamically.
using pre-computed pointers to your page element makes so much sense coming from a background in embedded systems.
I have no idea how web-developers think they can get away with adding so much overhead to something as simple as rendering a page. we have bigger problems in the world like hunger and machine learning and why are you guys suck on figuring out how to render a page ??
[edit] someone gave me my first down-vote for posting this. I'll stand by it.
Developers are always struggling to find a solution of their problem. The best developers I know usually have in their pocket a big list of possible tools that they use in the appropriate time for the right job.
Handlebars Moustache Angular is something that is so popular that even this fact makes it "non-retard".
Virtual DOM is something new, but if you can find a solution not to use any dynamic DOM modifications, it would be even better.
Take a look at some complicated one-page apps ( pinterest, mixcloud ) and don't judge so much about the overhead.
Best
Probably because it's thought to maximize profit. Typically developers are expensive, but web site viewers have relatively fast computers. In addition, this decision to maximize profit over optimization is often decided by not the developers but for example the product owner.
http://www.downforeveryoneorjustme.com/http://blog.donnywals...
[1] http://webcache.googleusercontent.com/search?q=cache:9UMu5i7...
History seems to repeat itself. First there where dumb terminals where the mainframe did all the work. Then the age of the PC with heavy clients. Then the age of dumb browsers where the server did all the work again. Now the age of heavy browsers running javacsript.
The thing is, you have a capable programming language able to utilize distributed CPU resources in a safe manner, why would you not want to take advantage of it? Because a dumb spider can't crawl it? Simple fact is this is happening because it's obvious and it would be like fighting the rising tide to deny it, IMO.
No, he just didn't take his philosophy far enough.
The real way to do this is to make your pages static and serve them from a caching proxy. If you don't need dynamism then you shouldn't use it at all on production.
Without seeing his server and his backend code it's hard to make specific recommendations, but a single server with an nginx front-end can handle a lot of load. I've seen Wordpress handle a full-on Slashdotting without even breaking a sweat.
Rendering only with javascript is only useful when the client loads and runs the javascript. The rest of us that see javascript as a very serious security and privacy issue get the actual page that is served up. I strongly recommend making that page a useful page in some way.
If a tool or framework doesn't provide that page, then maybe it's time to start filing bug reports about that tool's broken output.
Although to be fair, the number of people on HN who care about the security implications of javascript are grossly out of proportion to the general case. Near enough to 100% of people have javascript turned on by default that everyone else might as well be a rounding error.