Too many requests! You have made too many requests!! No more requests!!!
– How many times do you have to hear that before you get really angry?Amazon Chime API’s request throttling tested our patience like this. But all we ever wanted was to make a simple text chat app work! In this article, you’ll find out why Chime was so unkind to us, what we did to turn things around, and how you too can follow the path we forged.

When you are going to create a new web solution from scratch or optimize an existing one, one of the key indicators of top high quality will most likely be a high response rate (to user actions) and SEO-friendliness. 

Unfortunately, client-side rendering, which is done by default in many modern web frameworks and libraries, can become an antagonist for developers pursuing these two goals. In this case, it makes sense to consider the possibility of implementing server-side rendering. Below, we will explain to you what it is, what its features are, with the help of which software tools it can be implemented, and also for which projects it is best suited. 

Definition of Server-Side Rendering

Generally speaking, server-side rendering (SSR), as is probably clear from the name, occurs on the backend side. First, the browser sends a request from the client side to the server, after which the SSR server returns an HTML page with all the necessary meta tags, styles, markup, and other attributes. Then, in the browser, the rendering itself happens, the results of which immediately become visible to the end user.

Why is all this necessary if you can use the default option, client-side rendering (CSR)? – you may ask. In fact, everything is simple: search engine crawlers do not recognize the SEO text contained on the pages (or the page, if it is the only one) of the CSR solution. Thus, if the CEO occupies a significant part of the promotion strategy of your project, you can achieve better results only by implementing SSR. Let us add that projects with sophisticated business logic may “suffer” from CSR in the context of performance since the increased load in the form of several synchronous requests will lead to delays in the interface’s response to user actions. And this is exactly the case where server-side rendering can also become a win-win solution.

Currently, SSR technology is actively used in such world-famous solutions as Airbnb, Upwork, YouTube, Netflix, Uber, etc.

What Are the Benefits of Server-Side Rendering?

Now, based on the above, let's look at the key benefits of SSR.

  • SEO and social media friendliness. The server side render approach ensures improved SEO ranking through the correct indexing of pages – now, search robots can recognize SEO text and other attributes important for good ranking. First of all, this is due to the fact that now, search robots do not need to read SSR JavaScript code. As for friendliness for social networks, it is explained by the ability to display colorful previews when sharing SSR-rendered pages – all due to the correct recognition of meta tags. 
  • Better app/website performance. SSR rendering provides a faster initial page load as the JS to HTML conversion is done on the backend. Thus, users see refreshed content faster than with CSR, in particular when it comes to dynamically updated pages. In the long term, this can ensure a reduced bounce rate for websites and web applications. 
  • Lower load on the user's device and better user experience (UX). Due to the fact that user requests are now processed on the server side, the user device will experience minimal load. All that remains for it is to interpret the HTML code returned by the server.

What Are the Risks of Server-Side Rendering?

To ensure the objectivity of our review, let's also analyze the disadvantages of server-side rendering.

  • Higher TTFB. TTFB or time to the first byte is one of the highest priority indicators of good (or, vice versa, insufficient) performance of web pages. This parameter indicates the time it takes for the browser to receive the first byte of page data processed on the server side. Typically, compared to CSR, the TTFB value is higher because instead of returning a file with links to JS, the server spends some time converting JS to HTML code.
  • Limits on the number of requests simultaneously processed on the server side. Due to the increased load on the server, the number of requests processed synchronously will be less than in the case of client-side rendering. Thus, the server throughput will be reduced.
  • Need to wait for all the HTML code to load. While the page is loading HTML code under SSR, the user will not be able to perform any new actions on it.

If we add to the above disadvantages a fairly high entry threshold into SSR, as well as an increase in the budget of such projects (due to frequent requests to the server), it becomes clear that this approach is not suitable for everyone.

Server-Side Rendering Frameworks and Tools

As for the server side rendering frameworks and libraries that can be used to process client-side requests on the backend, these include React, Next.js, Nuxt.js, Angular (v7 and newer), and Svelte/Sapper. They use one of the most universal server-side templating languages – JavaScript.

Below we propose to consider server-side rendering React concepts only since React is one of the main tools that we use in web development.

Server-Side Rendering vs Client-Side Rendering

Server-side rendering is not a one-size-fits-all solution since there are situations where its alternative, client-side rendering, is the best choice. In particular, if the content on web pages is updated dynamically – that is, it requires the rendering of some components only (i.e., those with whom the user interacted) while the whole page doesn’t need to be updated, CSR is better suited since part of the content with which the user did not interact will be already loaded.

However, considering that during initial initialization, the content is not displayed until the page is fully loaded into the browser (this can take 2 or 3 seconds, which is critical for a modern consumer of Internet content), when implementing CSR, the site may have poor SEO regardless from the professionalism of SEO specialists (note that this is not a default situation, because with the right approach, lightweight projects with CSR are still ranked well). And this is where the SSR React approach can come to the rescue as usually, React server side components are well-recognized by search crawlers. Thus, by resorting to it, you will be able to ensure enhanced content visibility for search engines.

Server-Side Rendering: SEO vs. Performance

As you can already understand, server-side rendering is capable of providing the best SEO performance for solutions that really need it. In particular, thanks to this approach, search engines will not need to interpret JavaScript. At the same time, if you decide to render in React applying CSR by default, for the React server side rendering implementation, you will have to use additional tools to indicate metadata (for example, React Helmet).

As for performance, in the case of high-load projects, with the server side React rendering, this indicator will be better than with CSR since the SSR website or application will not be limited by the resources of the user device and browser. Also, the user device itself will be less loaded since its only task in the context of updating content will be its output (without rendering).

Conclusion

To sum up, we would like to emphasize that with the correct use of JavaScript frameworks for SSR, you can solve the problem of poor ranking of single-page applications (SPAs) as well as content-heavy websites where SEO and bootstrap performance are critical. On the other hand, CSR is suitable for software with dynamically updated content, that is, content that should change without completely refreshing the page.

However, you should not limit yourself to just these two rendering approaches. In particular, there are also hybrid rendering approaches that combine the best characteristics of SSR and CSR. For example, you can consider the static site generation (SSG) vs SSR couple – perhaps the first option will be the best choice for your project.