Ask HN: Why does Google use server side rendering for search results?
My thought is that search results could be rendered faster using an SPA-style setup as the rest of the page wouldn't have to be reloaded, yet Google Search still uses server side rendering on their results in 2020.
Is there any particular technical reason they are doing this?
My thoughts on possible reasons are:
* they want to support browsers that have JavaScript disabled and/or older browsers / TOR
* legacy reasons -- their whole infrastructure is designed to deliver results via server side rendering and it would be a pain to change it
* they are in general afraid to make sweeping changes to google search (don't fix what isn't broken)
* some interesting technical advantage of server side rendering in this scenario over client side rendering that I am unaware of but would be curious to learn about
15 comments
[ 2.6 ms ] story [ 43.5 ms ] threadIf Google's ranking formula was deterministic, you could do the same thing for your search rankings. You could make changes to your page, see if your rankings get better or worse, and repeat.
If you try to do this you will find all sort of phenomena designed to gaslight you. For instance, one form of personalization is that if you click on a link that is lower down, it might move up. Well if you are always clicking on your own site it will rise higher in your rankings and you might think you've won, but really you've lost.
Other countermeasures are more conjectural, but looking from the outside I believe I've observed that Google uses randomness both on a day-to-day and a long-term basis, has different rules for sites in different parts of their lifecycles. It may be a superstition, but I have many sites that I haven't updated in years because it seems that changing a high-producing site is likely to make your site a low-producing site.
The last thing they want to do is provide an API that would make it easier to research what they do on a large scale.
People who work for Google will deny all that, but some of them are the gaslighters, while the rest are gaslit.
The issue with the industry around Search Engine optimization is that if commercial and marketing interests are too good at determining what get shown to a user, then Google loses it's value to a user. API's by design are machine readable, so if Google built its site in a way where other people can query this api directly, then marketing and PR firms would be able to query this api to build datasets on the relationships between different site, their content, and their pagerank to create rough models on how to 'game the system'. Instead by only offering a server-side rendered page for search, to collect the same information for data-mining purposes, you would need to 'scrape' the page and hope that format of the page's html is consistent for a long enough period to build a scraper, and then collect the data that they need. This combined with html and css obfuscation which is common with ssr apps and webpack in general, as well as rate-limiting and some other techniques, it can quickly become infeasible for somebody to data-mine google search for these kind of uses, and Google gets to keep their value.
Why on Earth are are Google results pages non-responsive?
Also, from technical point of view there is no point in generating JSON output (or any other format), and use that format by a JavaScript based processor to generate HTML, when you can directly generate HTML that will be as simple as the JSON. There are not many savings. Why?
3 results of a simplified query engine output in HTML: [DIV class="results"]
These results are usable as is, the browser will render them and does not need anything else to do it.3 results of a simplified query engine output in JSON:
This output does not save much space. It is equally as complex on the server-side.But this output is not usable by the user as will not be displayed in a usable form, so you need JavaScript code to process it and generate HTML that will be usable.
So why generate the same list of things two times? It is better, easier and more accessible for the user if you generate HTML the first time.
Just my opinion. This might not be the real reason.
- Send a small amount of HTML and CSS for the browser to show on the page; or
- Send a JavaScript application framework and JSON results, then have the browser interpret the JavaScript, parse the JSON, generate the HTML and show on the page
With an approach like Svelte takes, you can make the second option pretty workable, but you'll still never beat sending markup directly if your goal is to render a small amount of static content as quickly as possible.