Azure offers a wide range of options for hosting and running system components, ranging from full control of a virtual machine, including the operating system, to fully managed services.
The Particular Service Platform may be hosted using several Azure hosting models:
In serverless (also referred to as "Functions as a service (FaaS)") models, code is deployed directly to the service which runs it.
Azure Functions is Azure's serverless hosting model. NServiceBus supports integration with Azure Functions that allows deployment of new or existing NServiceBus applications into serverless environments with minimal effort. NServiceBus applications on Azure Functions can directly consume messages from Azure Service Bus. Other Azure Functions triggers can also use NServiceBus to send messages to Azure Service Bus.
Platform as a Service (PaaS) models provide managed hosting environments where applications can be deployed without having to manage the underlying infrastructure, operating system, or runtime environments.
Containers are a popular mechanism to deploy and host applications in PaaS services. NServiceBus can be used by containerized applications and deployed to services like:
- Azure App Services (using containers)
- Azure Container Instances
- Azure Container Apps
- Azure Kubernetes Services
Infrastructure as a Service (IaaS) provides virtualized computing resources like virtual machines, storage, and networking that can be used to build and manage the required infrastructure.
NServiceBus applications can easily be hosted on virtual machines. Popular techniques include:
- Integrating NServiceBus with the Microsoft Generic Host
- Custom hosted web applications
- Installing NServiceBus endpoints as Windows Services
- Manually controlling NServiceBus lifecycle in an executable (e.g. Console or GUI applications)
- Custom-managed Kubernetes clusters hosting container applications
The best choice of hosting model depends on the desired characteristics, such as:
- Scalability: Different hosting options offer different approaches to scaling. Managed solutions are typically easier to scale on demand and can scale on more granular levels. In addition to the scalability, elasticity (the time required to scale up or down) may also factor into the choice. Azure documentation provides more information about subscription and service limits.
- Pricing: Managed services typically offer more dynamic pricing models that adjust with the demands of an application, in comparison with more rigid pricing models for infrastructure services. However, managed services typically charge more for their pricing units, so infrastructure services may be more economical for consistent demand. Azure offers a pricing calculator to help understand a given service's pricing model.
- Portability: Serverless models are primarily built on proprietary programming models, heavily tied to the cloud service vendor. Hosting models built on open standards make it easier to run components in other hosting environments. Additionally, it may also be desirable to run components using on-premises servers or workstations.
- Flexibility: Lower-level infrastructure provides more control over the configuration and management of applications. Serverless offerings offer less flexibility due to the higher level of abstractions exposed to the code.
- Manageability: Serverless and PaaS models remove the concerns about the underlying infrastructure challenges (e.g. automatic scaling, OS updates, load balancing, etc.), typically at the cost of flexibility. Managing and maintaining infrastructure using other models may require significant resources and knowledge.