ReasonJun

CSR (Client-Side Rendering) vs SSR (Server-Side Rendering) 본문

Frontend/Network

CSR (Client-Side Rendering) vs SSR (Server-Side Rendering)

ReasonJun 2023. 6. 16. 19:43
728x90

CSR stands for Client-Side Rendering, while SSR stands for Server-Side Rendering. These are two different approaches to rendering web content and have their own benefits and trade-offs.

 

Client-Side Rendering (CSR): Client-Side Rendering is a technique where the web browser, or the client, is responsible for rendering the UI. In CSR, the server primarily sends a minimal HTML document along with JavaScript files that contain the application logic. The JavaScript is then executed by the browser, which fetches data and renders the UI dynamically.

 

Pros of CSR:

  • Enhanced interactivity: CSR allows for more dynamic and interactive user experiences since most of the UI updates are handled by JavaScript on the client side.
  • Rich client applications: With CSR, you can build complex client-side applications that leverage the capabilities of modern web browsers and frameworks like React, Angular, or Vue.js.
  • Fast subsequent page loads: Once the initial application is loaded, subsequent page transitions within the application can be fast since the data fetching and rendering happen on the client side.

Cons of CSR:

  • Slower initial load: In CSR, the browser needs to download the JavaScript bundle and execute it before the UI can be rendered. This can lead to slower initial page load times, especially for larger applications.
  • SEO challenges: Search engine crawlers may have difficulty parsing and indexing content rendered by JavaScript. Although search engines have improved in handling CSR applications, SEO optimization can be more complex.
  • Limited support for older browsers: CSR relies on modern JavaScript features and may not work properly or at all in older browsers that lack support for these features.

Server-Side Rendering (SSR): Server-Side Rendering involves rendering the UI on the server before sending it to the client. The server fetches data, renders the HTML markup, and sends the pre-rendered HTML to the client for display. The client's browser still handles interactivity and dynamic updates.

 

Pros of SSR:

  • Better initial load performance: Since the server sends pre-rendered HTML, SSR can provide faster initial page load times, especially for static content, as the browser can start rendering the UI immediately.
  • Improved SEO: Search engines can easily crawl and index the content since it is available in the initial HTML response.
  • Browser compatibility: SSR works well with older browsers or devices that may not support modern JavaScript features.

Cons of SSR:

  • Increased server load: Server-Side Rendering puts more load on the server as it needs to render the HTML for each request. This can impact scalability and may require additional server resources.
  • Reduced interactivity: With SSR, the initial page load may be faster, but subsequent interactions or page transitions may be slower since the client needs to fetch and execute JavaScript to handle interactivity.

Both CSR and SSR have their use cases, and in some scenarios, a hybrid approach called "Hybrid Rendering" can be used to combine the benefits of both. Hybrid Rendering involves rendering the initial page on the server (SSR) and then allowing the client to take over for subsequent interactions (CSR).

 

The choice between CSR and SSR depends on factors like the nature of the application, performance requirements, SEO considerations, and the target audience. It's important to evaluate the specific needs of your project to determine the most suitable rendering approach.

 

 

https://hahahoho5915.tistory.com/52

 

[간단정리] CSR vs SSR 특징 및 차이

개요 CSR vs SSR 특징 및 차이점 알아보기 내용 CSR Client Side Rendering의 약자 말 그대로 SSR과 달리 렌더링이 클라이언트 쪽에서 일어난다. 즉, 서버는 요청을 받으면 클라이언트에 HTML과 JS를 보내준다

hahahoho5915.tistory.com

https://medium.com/walmartglobaltech/the-benefits-of-server-side-rendering-over-client-side-rendering-5d07ff2cefe8

 

The Benefits of Server Side Rendering Over Client Side Rendering

Most of our pages on walmart.com are using server side rendering (henceforth SSR) with only a few unique exceptions.

medium.com

 

728x90
Comments