Azure Service Fabric vs Azure Container Service vs App Service - choosing a hosting model
Azure Service Fabric, Azure Container Service, App Service and Virtual Machines compared through workload fit, operational ownership, scaling and deployment responsibilities.
Azure Service Fabric vs Azure Container Service vs App Service - choosing a hosting model
The hosting model decides more than where an application runs. It decides who patches the operating system, how a release is promoted, how instances scale and who responds when the application is not healthy. Azure provides App Service, Azure Container Service and Azure Service Fabric, and Virtual Machines remain an important option. In this article, we are going to compare these choices using a fund search API, a pricing service and a document import as examples.
Last year, in Getting started with Docker - Part 1, we discussed images and containers, which is a good starting point for understanding why a container boundary is useful but is not the same as a hosting model.
TL;DR Summary
- App Service is the first choice for a normal ASP.NET web application or API when we do not need to manage the host.
- App Service plans are providing the compute boundary, autoscale settings and deployment slots for safe releases.
- Azure Container Service was generally available in April 2016 and supported DC/OS and Docker Swarm, not a managed Kubernetes service.
- Service Fabric was generally available in March 2016 and provides reliable services, actors and stateful or stateless service models.
- Virtual Machines are useful when the application needs operating-system control, but the team is owning patching and recovery.
- Stateful microservices are not the same as a stateless container, and the data ownership must be explicit.
- In our case, we are choosing the least operationally expensive model which is meeting the actual requirement.
Challenges
Every workload is called a web application
A fund search API, a pricing calculation and a document import can all have an HTTP endpoint, but they are not having the same lifecycle. Search is normally stateless and is scaling on request volume. Pricing may have a stateful workflow, while a document import is often being run as a background process. Selecting one platform for all three without checking the workload will create unnecessary operational work.
Control is also responsibility
Virtual Machines are providing control over the operating system, installed software and network configuration. The same control is making the team responsible for security patches, disk capacity, monitoring agents, failover and deployment scripts. A managed service is reducing these tasks, but it is also restricting some runtime choices. The trade-off must be considered as a total cost, not only as the monthly Azure bill.
Stateful and stateless are different problems
A stateless service can be replaced by another instance when the process fails. A stateful service owns data or a long-running identity, so a replacement must know how state is preserved. Service Fabric reliable services and reliable actors are designed for this type of workload. A container scheduler does not automatically solve state consistency just because it restarts a container.
What is a hosting model?
A hosting model is the combination of compute runtime, deployment boundary, scaling mechanism and operational ownership used to run an application.
In simple terms, it answers who is running the machine, who is running the process and who is responding when the process has failed. It is called as the operating model of an application.
Why a hosting model is important?
The hosting model is affecting release frequency, security updates, recovery time and the skills needed by the team. If a team is spending most of its time keeping a VM healthy, there is less time for improving fund search and unit-price features. On the other hand, choosing a highly specialised platform for a simple API is adding complexity which the business is not needing.
App Service
Azure App Service is a managed hosting platform for web applications and APIs. An App Service plan is providing the compute resources, and several applications can share that plan. We can configure autoscale rules based on metrics such as CPU or HTTP queue length, and deployment slots are allowing a release to be warmed up before swapping it into production.
For a normal ASP.NET application, the deployment can be as simple as publishing the package to a staging slot, checking the health endpoint and swapping the slot. The application should keep sessions and uploaded documents outside the process because a slot swap or scale-out is replacing instances. App Service is therefore a strong fit for a stateless fund API with SQL Database and Blob Storage behind it.
Azure Container Service
Azure Container Service (ACS) reached general availability in April 2016. It was supporting container orchestrators such as DC/OS and Docker Swarm. It was useful when the team needed a container packaging boundary or wanted to run more than one container with an orchestrator, but the team was still owning the cluster configuration, images, networking and operational process.
For a document import requiring a repeatable Linux container, ACS with Docker Swarm or DC/OS could be considered, but the team must still document how the cluster is patched and recovered.
Azure Service Fabric
Azure Service Fabric was generally available in March 2016. It provides a programming model for reliable services and reliable actors, with both stateless and stateful services. A reliable service implements a service lifecycle and can use reliable collections, while a reliable actor represents an isolated unit of state and behaviour.
Service Fabric is useful when the domain is having long-running services, stateful microservices or a .NET service model which is benefiting from the platform. A stateless Search service can be deployed as several instances, while a stateful Pricing service can use reliable state and controlled partitioning. This does not remove the need to understand backups, replication and cluster health.
Virtual Machines
Virtual Machines remain the most flexible choice. They are useful for a legacy runtime, a custom agent or software which cannot run in a managed application platform. The flexibility is also the cost: patching, scale sets or load balancing, certificates, backups and operating-system monitoring are owned by us.
The following diagram depicts the decision flow:

Start by asking whether the workload is a normal web application or API with a standard stack. If yes, App Service is the first model to evaluate. If not, ask whether containers and DC/OS or Swarm are required. Then ask whether stateful .NET microservices are required, which is where Service Fabric becomes relevant. The remaining case is Virtual Machines. The flow highlighted in purple is the App Service path, because a managed platform usually reduces the day-to-day load for a standard API.
Comparing the choices
| Approach | Pros | Cons |
|---|---|---|
| App Service | + Managed web runtime<br>+ Deployment slots and autoscale<br>+ Small operations footprint | − Less host control<br>− Not a general container cluster |
| Azure Container Service | + Containers with DC/OS or Docker Swarm<br>+ Repeatable image boundary | − Cluster operations remain<br>− More moving parts than App Service |
| Service Fabric | + Reliable services and actors<br>+ Stateful and stateless .NET service model | − Cluster skills are required<br>− The application model is specialised |
| Virtual Machines | + Maximum runtime control<br>+ Works with legacy software | − Patching and recovery are our responsibility<br>− More infrastructure to monitor |
An everyday analogy is choosing transport for a journey. A taxi is similar to App Service: we describe where to go and the provider is operating the vehicle. Renting a van is similar to ACS: we are choosing the packaging and route, but we are taking more responsibility. Owning the vehicle is similar to a VM. Service Fabric is more like a managed fleet with rules for long-running vehicles, useful when the journey itself is having state.
In our case, we are using App Service for the normal ASP.NET fund API, and we are using an App Service plan with a staging slot when that is meeting the release requirement. We are considering ACS only when a container boundary is solving a real runtime problem. We are considering Service Fabric when reliable stateful or stateless services are making the cluster model worthwhile. We are selecting VMs for legacy or specialised requirements, not because they are familiar.
Must Do and Don’ts
- Must Do: Write the operational owner beside every hosting decision, otherwise a cluster or VM will be created without anyone owning its health.
- Must Do: Keep state outside a replaceable web process, otherwise autoscale and slot swaps will lose sessions or uploaded documents.
- Must Do: Record whether the 2016 ACS choice is DC/OS or Docker Swarm, otherwise later documentation will incorrectly describe it as managed Kubernetes.
- Must Do: Test a slot swap, container restart or Service Fabric failover with a small fund universe before production.
- Don’t: choose Service Fabric only because “microservices” is fashionable, otherwise the team will inherit cluster complexity without a state or ownership reason.
- Don’t: treat a VM as a complete architecture, because patching, backup, monitoring and deployment are still required.
Wrap up
In this article, we have looked at App Service plans and slots, Azure Container Service with DC/OS and Docker Swarm, Service Fabric reliable services and actors, and Virtual Machines. The decision depends on the workload and on the operational responsibility the team can honestly support. I hope this article provided you some insights into choosing a hosting model. In the next article, I will walk you through Serverless - what it is and where it fits.
Related Posts
Designing a multi-region application on Azure - traffic manager and failover
Multi-region Azure application design explained through Traffic Manager routing, primary and secondary regions, SQL replication, latency, health checks and failover practice.
Event-driven architecture with Service Bus topics
Azure Service Bus topics and subscriptions explained through fan-out messaging, SQL filters, duplicate delivery, dead-letter handling and explicit event ownership.
Serverless - what is it and where does it fit
Serverless computing explained by comparing IaaS, PaaS and Azure Functions, including triggers, retry-safe handlers, lifecycle ownership and production maturity considerations.