Search code examples
reactjsnext.jsserver-side-rendering

When is server-side-rendering a bad idea?


SSR with React is simple using Nextjs. Additionally, SSR has advantages like performance and SEO. Better performance and SEO must be advantageous to everyone, right? This got me to thinking: Given the advantages I just listed, why not make every program SSR? When is SSR not a good idea?


Solution

  • 1-Slower page transitions:

    browsing from page to page is often much slower with SSR than on CSR — at least if your pages contain heavy/complex data. With SSR you’re basically rendering your app twice, once on the server, and once on the client.

    2-Vulnerability:

    SSR sites are harder to keep secure because they have a bigger surface to attack than CSR sites. This is however not an issue if you or your developers know what they’re doing.

    3-Complex caching:

    configuring your cache is usually more complex on SSR sites than CSR sites.

    4-Server cost:

    SSR often needs a bigger and more powerful server to provide high-performance than CSR.

    5-Higher latency:

    SSR sites tend to get a high latency if you get lots of traffic at the same time, which delays/slows down the browsing experience for everyone. CSR doesn’t suffer from this nearly as much. Latency is also known as ping rate which is usually measured in ms (milliseconds).