Problem
Clients must choose where and how to host their XM Cloud front-end head application. The two underlying infrastructure choices are serverless and server-based hosting solutions - the selection depends on the customer’s needs for scalability, control, and cost management.
Solution
Sitecore recommends a serverless hosting infrastructure. Compared to server-based hosting, a serverless hosting solution is more performant, scales better, and introduces less complexity.
Sitecore recommends two main Hosting Providers - Vercel or Netlify.
Both Vercel and Netlify are Sitecore's technology partners and offer developers a comprehensive hosting solution. In addition to hosting, they provide various features that enhance the developer workflow and experience. These features include a global CDN, DevOps pipelines, preview environments, advanced caching, On-demand Incremental Static Regeneration, instant deployment rollback, and more.
Discussion
What is Serverless?
Serverless computing is a modern approach in cloud computing. It allows developers to deploy code without the need to manage the underlying infrastructure. The hosting provider handles server provisioning, scaling, security, and maintenance.
The term 'serverless' is often misunderstood. It doesn't mean the absence of servers, but rather the abstraction of server management. This abstraction allows developers to focus on code development and value delivery, without the burden of infrastructure management. This approach promotes agility, accelerates development cycles, and lowers total cost of ownership, making serverless the recommended choice for Sitecore XM Cloud front-end applications.
Why Serverless?
Management Complexity?
One of the most significant benefits of serverless computing is the time it saves for developers. By eliminating the need for manual server management, it streamlines the development process and leads to less complex applications.
Scalability
Scalability is another major advantage of serverless computing. Your front-end infrastructure can grow and shrink on demand. Your hosting provider handles this so that new resources can be allocated anytime. Your application will maintain responsiveness during a sudden increase in traffic.
Performance
Performance is an important factor in serverless. Unlike traditional single-threaded JavaScript, serverless functions can run simultaneously to perform tasks such as fetching page data, optimizing images, and revalidating and rebuilding a page, among other things. There is less of a bottleneck in a serverless environment.
Serverless Only Features
Edge Network Scalability and Performance
Both Vercel and Netlify provide an Edge Network. Both edge networks act both as a Content Delivery Network (CDN) as well as a globally distributed compute network. Your compute, the serverless functions, execute close to your data, reducing latency, and improving end-user performance.
In a server-based environment your content can be distributed via a CDN, but compute must live in the single region where your server is deployed.
Preview Deployments
Preview deployments are a useful feature that enables you and your team to review code changes in a live environment without publishing to production. Thanks to the flexible infrastructure of serverless, these deployments are created automatically for each of your code branches.
It’s imporant to understand that these preview environments are for code changes only not content. We recommend using a non-production instance of XM Cloud to host the preview content for your preview code deployments. But there is still only that single non-production XM Cloud instance providing the content for each preview deployment.
Vercel and Netlify Convenience Layer
As mentioned above Vercel and Netlify go beyond simple Next.js hosting. They offer an all-in-one hosting solution that simplifies and streamlines management, reducing complexity.
- Development Features
- Command Line Interfaces
- Starter Templates
- Review Features
- Staging Servers
- Preview Depoloyments
- Deployment Features
- DevOps Pipelines
- Instant Deployment Rollback
- Hosting DNS Configuration
- Production Features
- Secure Environment Variables
- On-Demand Incremental Static Regeneration
- DDoS Protection
- Scaling Features
- Advanced Caching
- Global Content Delivery Network for content and compute
- Image Optimization & Caching
- Localization
- Enterprise Features
- Compliance: SOC 2 Type II, ISO 27001, PCI, GDPR, CCPA/CPRA
- Service Level Agreements (SLA) 99.99%
- Single Sign On (SSO)
If hosting in a server-based environment many of these features above would need to be configured and managed by your team.
Server-based Hosting
According to the Next.js documentation, you can deploy your application to a Node.js server directly or via containers. While this type of hosting solution is possible, it can lead to degraded performance, difficulty scaling, and high management complexity.
Sitecore does not recommend hosting your XM Cloud head application on Azure App Services. This applies to both Node and Docker web apps in Azure App Services.
For more information on server-based hosting and specifics to why we do not recommend Azure App Services review: Running Next.js on Azure App Services.
Common Server-Based Hosting Options
The providers listed and other server-based hosting options are not recommended.
- Azure App Services
- AWS Elastic Beanstalk
- Google Cloud Run
- Any container-based service