Skip to content
-
Is Server Side Rendering(SSR) always good ?
Last Updated :
18 Mar, 2024
SSR is a technique used in web development where the HTML of a webpage is generated on the server rather than in the browser. This means when a user requests a webpage, the server prepares the HTML document by executing the necessary logic and sends it to the client’s browser, fully formed and ready to be rendered. This approach is different from CSR, where JavaScript runs in the browser to generate HTML content dynamically.
How server-side rendering work?
Server-side rendering is the predominant method used to present information on a display. It involves the server transforming HTML documents into data that the browser can interpret.
Every time you access a website, your browser sends a request to the server hosting the website’s content. The duration of this request is brief, typically a few milliseconds, but it can vary based on several factors:
- Your internet connection speed
- The geographical location of the server
- The number of people accessing the site simultaneously
- The level of optimization of the website, among others
After processing the request, the browser receives the fully rendered HTML and displays it on your screen. Should you navigate to a different page within the same website, your browser will submit a new request for the specific content. This process repeats for every new page you visit that isn’t already stored in the browser’s cache.
Regardless of whether the new page has only minor differences from the current one, the browser will request the entire page and render it anew.
Benefits of SSR
- Faster Initial Page Load: SSR can significantly improve the time to first byte (TTFB), providing content to users more quickly. This can be particularly advantageous for SEO and for users with slow internet connections.
- SEO Optimization: Search engines can more easily crawl and index SSR pages, as the content is already compiled into HTML upon their request.
- Social Media Sharing: When sharing links on social media, SSR ensures that metadata (like images and descriptions) is properly loaded and displayed in the preview, enhancing engagement.
Drawbacks of SSR
- Slower Page Transitions: Transitioning between pages can be slower with SSR, especially if your site handles complex or heavy data. This is due to the double rendering process — once on the server and once on the client.
- Vulnerability: With a larger surface to attack, SSR sites can be harder to secure compared to CSR sites. Knowledge and diligence in security practices are essential to mitigate this issue.
- Complex Caching: Caching strategies tend to be more complicated with SSR, requiring more effort to configure effectively compared to CSR.
- Server Cost: High-performance SSR may necessitate more robust and costly server resources than CSR.
- Higher Latency: During peak traffic, SSR sites might experience higher latency, affecting the browsing experience. This issue is less prevalent in CSR, where latency, or ping rate, plays a smaller role in performance.
When to Use and When Not to Use SSR ?
When to Use SSR:
- For landing pages or content-rich sites where SEO is a priority.
- When targeting users with slower internet connections, ensuring they receive content swiftly.
- On websites where social media sharing is a key part of your strategy.
When Not to Use SSR:
- For applications where real-time user interactions and dynamic updates are frequent, such as web applications with live chat features.
- When the development team lacks the expertise to handle the complexities of SSR, including security and caching strategies.
- If server resources are limited or the cost is a concern, CSR might be a more economical choice.
Hybrid Approach
How It Works
- Initial Load with SSR: When a user first visits a page, the server sends a fully rendered HTML document, ensuring that the content is quickly visible. This step is crucial for improving the Time to First Paint (TTFP) and Time to Interactive (TTI), which are important metrics for user experience and SEO.
- Subsequent Interactions with CSR: After the initial load, navigation and interactions within the site are handled client-side. JavaScript takes over to dynamically update the content without needing to reload the entire page from the server. This allows for a seamless, app-like user experience.
- Selective Rendering: Not all parts of an application need to be server-rendered. The hybrid approach allows developers to choose which pages or components are rendered on the server based on their impact on performance and SEO. For example, static pages like blog posts or product descriptions might be SSR, while dynamic sections like user dashboards can be CSR.
Benefits of the Hybrid Approach
- Improved SEO: The server-side rendering component of the hybrid approach ensures that search engines can crawl and index content effectively, improving the visibility of the web application.
- Enhanced Performance: By serving fully rendered pages on the initial load, the application can provide content to users faster, improving metrics such as TTFP and TTI.
- Rich Interactivity: Once the initial page is loaded, CSR takes over, providing users with a smooth, interactive experience without the need for full page refreshes.
- Flexibility: Developers can strategically decide which parts of their application benefit most from SSR or CSR, allowing for optimized performance and resource utilization.
Similar Reads
Best Backend Technologies for React in 2025 The backend of a website handles crucial server-side operations, ensuring the site runs smoothly and efficiently. A robust and efficient backend enhances your web app's speed and user experience. Conversely, a poorly chosen backend can lead to significant delays, issues, and security vulnerabilities
11 min read
10 Best Backend JavaScript Frameworks in 2025 When JavaScript was first created, it used to run only in the browser of the client (user). At that time, it was sufficient, as websites used to be static and just displayed some information for the user to see and read. But as both time and technology moved forward, web development changed. Soon, t
11 min read
Types of Monitor Panels and Which One is Better? When it comes to monitors they come in different shapes, sizes, and panels. So, what are these panels, and how to select a better one for your purpose?... Currently, the best available panels in the market are IPS (In-Plane Switching), TN (Twisted nematics), and VA(Vertical Alignment) panels. And in
5 min read
Ultimate Guide to Server-Side Rendering (SSR) with Vite and ReactJS Server-side rendering (this practice allows making web pages since the browser only enables blank pages) can be defined as one of the current trends in web development. SSR offers many advantages â performance improvement, SEO enhancement, and even convenience for users. As opposed to client-side re
10 min read
Explain the benefits and limitations of SSR in Redux applications. SSR in Redux applications means rendering React components on the server side instead of the client's browser. This helps to speed up initial page loads and ensures that search engines can better understand and index your content. With SSR, users get a faster and more seamless experience when access
2 min read
How does SSR(Server-Side Rendering) differ from CSR(client-side rendering) ? Server-Side Rendering (SSR) and Client-Side Rendering (CSR) are two different approaches used in web development to render web pages to users. Each approach has its own set of advantages and disadvantages. In this article, we will learn about the difference between SSR and CSR with examples and feat
4 min read
`;
$(commentSectionTemplate).insertBefore(".article--recommended");
}
loadComments();
});
});
function loadComments() {
if ($("iframe[id*='discuss-iframe']").length top_of_element && top_of_screen articleRecommendedTop && top_of_screen articleRecommendedBottom)) {
if (!isfollowingApiCall) {
isfollowingApiCall = true;
setTimeout(function(){
if (loginData && loginData.isLoggedIn) {
if (loginData.userName !== $('#followAuthor').val()) {
is_following();
} else {
$('.profileCard-profile-picture').css('background-color', '#E7E7E7');
}
} else {
$('.follow-btn').removeClass('hideIt');
}
}, 3000);
}
}
});
}
$(".accordion-header").click(function() {
var arrowIcon = $(this).find('.bottom-arrow-icon');
arrowIcon.toggleClass('rotate180');
});
});
window.isReportArticle = false;
function report_article(){
if (!loginData || !loginData.isLoggedIn) {
const loginModalButton = $('.login-modal-btn')
if (loginModalButton.length) {
loginModalButton.click();
}
return;
}
if(!window.isReportArticle){
//to add loader
$('.report-loader').addClass('spinner');
jQuery('#report_modal_content').load(gfgSiteUrl+'wp-content/themes/iconic-one/report-modal.php', {
PRACTICE_API_URL: practiceAPIURL,
PRACTICE_URL:practiceURL
},function(responseTxt, statusTxt, xhr){
if(statusTxt == "error"){
alert("Error: " + xhr.status + ": " + xhr.statusText);
}
});
}else{
window.scrollTo({ top: 0, behavior: 'smooth' });
$("#report_modal_content").show();
}
}
function closeShareModal() {
const shareOption = document.querySelector('[data-gfg-action="share-article"]');
shareOption.classList.remove("hover_share_menu");
let shareModal = document.querySelector(".hover__share-modal-container");
shareModal && shareModal.remove();
}
function openShareModal() {
closeShareModal(); // Remove existing modal if any
let shareModal = document.querySelector(".three_dot_dropdown_share");
shareModal.appendChild(Object.assign(document.createElement("div"), { className: "hover__share-modal-container" }));
document.querySelector(".hover__share-modal-container").append(
Object.assign(document.createElement('div'), { className: "share__modal" }),
);
document.querySelector(".share__modal").append(Object.assign(document.createElement('h1'), { className: "share__modal-heading" }, { textContent: "Share to" }));
const socialOptions = ["LinkedIn", "WhatsApp","Twitter", "Copy Link"];
socialOptions.forEach((socialOption) => {
const socialContainer = Object.assign(document.createElement('div'), { className: "social__container" });
const icon = Object.assign(document.createElement("div"), { className: `share__icon share__${socialOption.split(" ").join("")}-icon` });
const socialText = Object.assign(document.createElement("span"), { className: "share__option-text" }, { textContent: `${socialOption}` });
const shareLink = (socialOption === "Copy Link") ?
Object.assign(document.createElement('div'), { role: "button", className: "link-container CopyLink" }) :
Object.assign(document.createElement('a'), { className: "link-container" });
if (socialOption === "LinkedIn") {
shareLink.setAttribute('href', `https://www.linkedin.com/sharing/share-offsite/?url=${window.location.href}`);
shareLink.setAttribute('target', '_blank');
}
if (socialOption === "WhatsApp") {
shareLink.setAttribute('href', `https://api.whatsapp.com/send?text=${window.location.href}`);
shareLink.setAttribute('target', "_blank");
}
if (socialOption === "Twitter") {
shareLink.setAttribute('href', `https://twitter.com/intent/tweet?url=${window.location.href}`);
shareLink.setAttribute('target', "_blank");
}
shareLink.append(icon, socialText);
socialContainer.append(shareLink);
document.querySelector(".share__modal").appendChild(socialContainer);
//adding copy url functionality
if(socialOption === "Copy Link") {
shareLink.addEventListener("click", function() {
var tempInput = document.createElement("input");
tempInput.value = window.location.href;
document.body.appendChild(tempInput);
tempInput.select();
tempInput.setSelectionRange(0, 99999); // For mobile devices
document.execCommand('copy');
document.body.removeChild(tempInput);
this.querySelector(".share__option-text").textContent = "Copied"
})
}
});
// document.querySelector(".hover__share-modal-container").addEventListener("mouseover", () => document.querySelector('[data-gfg-action="share-article"]').classList.add("hover_share_menu"));
}
function toggleLikeElementVisibility(selector, show) {
document.querySelector(`.${selector}`).style.display = show ? "block" : "none";
}
function closeKebabMenu(){
document.getElementById("myDropdown").classList.toggle("show");
}