In the last couple of years, container technology has become more popular as companies seek to develop more Microservice based applications in the Cloud. With the introduction of Container orchestrators such as Docker Swarm, Kubernetes and Mesos the need for Cloud providers to support such technology has become critical in a very competitive market.
Containers are lightweight compared to Virtual Machines. Virtual Machines are a software abstraction of the underlying hardware and therefore are much heftier in terms of memory and processor consumption.
The image above shows that each Virtual Machine Operating System runs above the Hypervisor layer. The Virtual Machine believes that it is interacting with the underlying hardware. Compare this to a Container system, the Container manager allows each application to use the underlying Operating system of the host. This makes a big difference as multiple applications are essentially sharing the same Operating system kernel and system libraries. As a result, containers allow applications to be deployed faster compared to Virtual Machines that have to be booted from an image. There main advantages compared to Virtual machines include:
Microservices are becoming more popular as they replace the old Monolithic approaches to application development. With the advent of Cloud Computing, Application services can be developed to scale out using the underlying scaling capabilities of the Cloud infrastructure. For example, Azure Service fabric uses Azure scale sets to scale out the Micro services across multiple Virtual Machines in a cluster.
As of today, Microsoft Azure offers primarily two ways to develop and deploy your Microservices. This offering includes Azure Service fabric and Azure Container Service.
Azure Service Fabric is a Microsoft technology that has been around since 2003. It was originally named Microsoft Fabric and was used to develop Software such as Bing and DocumentDB. Service fabric is essentially an Orchestration engine which can be run in the Cloud, On premises or even on your Virtual Machines.
Azure Service fabric provides a prescriptive programming model using either Reliable Services or the Actor model. This allows application developers to build the following type of services:
Services are developed on top of the Azure Service fabric platform. As can be seen from the image above Service fabric provides the following features:
Azure Service Fabric provides tight tool integration with Microsoft Visual Studio. All of the above mentioned services are available in the Visual Studio project templates. Service fabric therefore leans towards developing Microservices in .Net. However, as Microservices are meant to be agnostic to the underlying technology stack there is also a SDK available in Java.
Service fabric abstracts away the underlying infrastructure from the developer so they can concentrate on building services as it can run workloads on either Linux or Windows. This is why Service Fabric is described as a Paas service.
Additional to Service Fabric providing a Paas platform for building Microservices it also offers Container Orchestration. Currently Service fabric supports:
This feature essentially means that you can deploy Docker images to Azure Service Fabric and it will perform the Orchestration of the container for you.
Azure Container service is more of a Iaas offering compared to Azure Service Fabric which is offered as a Paas. Whereas Azure Service Fabric provides a SDK and platform to develop Microservice applications, Azure Container Service provides hosting of a selected container Orchestrator which will run the containerized application. Essentially Azure Container Service provides the recommended Azure infrastructure you will need to run the Container Orchestrator you choose. It does not provide Orchestration. This is delegated to the Container Orchestrator you select.
When you create an Azure Container Service It will provision the following resources:
The main difference between Azure Container Service and Azure Service fabric is that it provides a bridge to the Open source containers available in the market. It allows you to make use of the available Open source tooling. As of today Azure Container Service supports the following:
One of the benefits of Microservices architecture is to leverage the scale of the Cloud. This enables an Application to be developed as small independent services which can be deployed and scaled independently of other services. This is where Container Orchestration becomes important.
Once your orchestrator is setup it will then be responsible for the following type of tasks
In this section I will demonstrate how easy it is to setup your Orchestrator via the Portal.
On the Master Configuration select the following and select OK:
Once the deployment is over a Resource group will be created. Go to the Resource Group blade and look for the Resource Group called Azurecsrg.
As you can see from the screenshot above Azure has deployed all the required infrastructure.
To automate the deployment, you can download the ARM template for the above Portal deployment.
Look for the Resource Group you created from the previous steps. In the resource group blade select the Automation script option.
Select the download option. Now you can use PowerShell or the Azure cli to redeploy the resources. Furthermore, this can be integrated into your CI/CD pipeline.
If you use Linux and want to harness Docker or one of the other supported Orchestrators, then Azure Container Service will provide you with all the underlying infrastructure you need to deploy your container based workloads. If your team is already using Containers, then Azure Container Service should not be a big jump for them. Also you are also not bound to Visual Studio and .NET and can use the Open source tooling and stack of your choice.
However, if you are a Microsoft Shop and want to be able to develop Microservices using your existing Visual Studio toolkit then Azure Service Fabric is a good choice. It offers you the flexibility to develop non container based Microservice using either an Actor, stateless or stateful service model. If you want to use Docker, you can also deploy that with Service Fabric. It will provide orchestration for your container.
It all depends on the requirements of your application. Additionally, by building Services using Service fabric you will automatically get the features of versioning, state partitioning/replication and more out of the box.