Monday, April 22, 2024

Why Nextjs Sitecore XMCloud application not to be hosted in Azure App Service?

 Problem Statement

Sitecore strongly recommends serverless hosting for XM Cloud, like Vercel or Netlify. Why Nextjs shouldn't be hosted in Azure App Serice? 

The main reason for not recommending Azure App Services is that it takes a server infrastructure approach to hosting, leading to lower performance, difficulty scaling, and higher management complexity.

Lets see them one by one

1. Performance Limitations:

Since Next.js is a JavaScript application and JavaScript is a single-threaded language, the Node.js runtime for JavaScript is also single-threaded. This means that the single-threaded Node server has to handle all requests to your websites, Experience Edge, image optimization, incremental static regeneration, and more, leading to performance issues.

Workaround
PM2 is often suggested as a solution to Node.js performance issues. However, using this tool adds more complexity, and it has not been established whether it improves performance in an XM Cloud front-end hosting solution.


What is PM2?
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. 

2. Scalability Limitations

  • Efficient scaling requires a content delivery network (CDN). However, Azure App Services does not come with a CDN by default.
  • Azure does offer the Azure Content Delivery Network service, but you must manage the endpoint and caching. This leads to further increased complexity. This results into higher management complexities.

3. Network Connection Limits

  • A specific limitation of Azure App Services that XM Cloud customers have experienced is the limited network port capacity for outbound network calls. 
  • Customers have hit the network connection limits' upper bounds, leading to severe performance degradation.

No comments :