Capitalizing on the power of Microservices with Microsoft’s Azure Service Fabrication.
Over the last few years, the idea of Microservices has gained significant momentum as it aids in creating applications that are broken down into distinct pieces so that they are easier to build and maintain. Microsoft has made considerable strides with its Azure Service Fabric, a microservices platform that is the backbone of many Azure services such as Event Hub, IoT Hub, cosmos DB, SQL server and power BI among others.
With Microsoft rolling out several updates to Azure Service Fabric recently in June, it would be very timely to understand the workings of such a and how it can be leveraged to create and run varied services efficiently.
But first, let’s start off with a baseline understanding of what Azure Service Fabric is all about and how it compares to other Micro Services platforms.
What is Azure Service Fabric?
Service Fabric is a distributed systems platform for packaging, deploying, and managing scalable and reliable microservices and containers. Developers and administrators can focus on implementing mission-critical, demanding workloads that are scalable, reliable, and manageable in nature.
Today’s Internet-scale services are built of microservices. Examples of microservices are protocol gateways, user profiles, shopping carts, inventory processing, queues, and caches. Service Fabric is a microservices platform that gives every stateless or stateful microservice (or container) a unique name.
Comparison with other Micro Services
Azure Service Fabrication (ASF) is Microsoft’s platform-as-a-service (PaaS) for building and deploying highly scalable microservices-based cloud applications. It provides comprehensive runtime and lifecycle management capabilities to applications that are composed of multiple microservices. The microservices are hosted inside containers that are deployed and activated across the Service Fabric cluster.
Microsoft provides various possibilities in the name of “Microsoft Azure” to build these microservices.
- Azure Container Service
The Azure Container Service (ACS) is a Microsoft implementation of cloud-based open-source container technology for container and container orchestration. We can use these containers to manage, scale and orchestrate applications, build highly available and scalable Kubernetes clusters.
- Azure Functions
The Azure Function is a serverless compute service that enables us to run code on-demand without having to explicitly provision or manage infrastructure. We can use Azure Functions to achieve something quickly such as “Daily Automation”, “Prototyping a solution” or “Integrating legacy systems”.
Capabilities of Microsoft Azure Service Fabrication
Azure Service Fabrication helps in developing microservices that run on a pool of machines. Hence, it can start small and increase the scale with the number of machines. This helps in the orchestration of microservices. We just need to inform the service fabrication as to how many instances of services, storage and computing power it requires. Service Fabrication automatically handles spinning up virtual machines as well as launching of services.
- ASF helps to develop highly reliable stateless and stateful microservices.
- Ease of monitoring application and telemetry logs.
- It provides excellent flexibility in upgrading the Service fabric version and cluster configuration. This helps to deploy different versions of the same application side by side and upgrade each application independently with zero downtime.
- Helps in testing microservices locally. The code that runs on our local development cluster will be deployed to the clusters in other environments as well.
- Assists in monitoring and diagnosing the applications, clusters, infrastructure, and health of the application.
- It aids in scaling-out or scaling-in the number of nodes in a cluster which in turn helps our applications to automatically scale up or scale down.
Various services offered by Microsoft Azure Service Fabrication
ASF is comprised of 3 different reliable services such as “Stateless”, “Stateful” and “Actor” services.
A Stateless microservice does not maintain the state in the data store. It’s mainly used for data transformation operations. For example, the transformation of thousands of processed events to other microservices or to a centralized data store at regular intervals.
A Stateful microservice is mainly used to maintain the state in the service. The state is stored in its data store. To access the data from the service internal datastore its essential to expose the APIs and it can’t be directly accessed from any other services.
An Actor is a service that uses the Actor Model pattern mainly used to handle parallel operations. In this model, many units of computation have created that run concurrently and can interact with each other through message passing. It has a persistent state and its best suited for the domain which includes the number of small and independent logics.
Understanding its Storage and Partitions
- Node and Cluster
A node is a physical computer or a virtual machine. Considering our applications are hosted on the node, typically, there are 4 nodes and each node shares multiple applications. They can interact with each other via network connectivity.
A cluster contains a group of nodes (virtual or physical machines) and applications. It includes virtual machines, networks, IP addresses, load balancers and applications.
- Application and Services
An application is just a declaration that gives information about the different services it contains. When we compile our code, a single package is created which is nothing but an application.
Services are stand-alone functions that can start and run independently under the application branch in a specific cluster.
- Partitions and Replicas
Partitions involve dividing the data into a small piece of the collection and storing it in multiple reliable collections. This reduces the latency in extracting huge amounts of data from a reliable collection.
As the name itself suggests replicas contain multiple backup copies. Each time a copy of the replica is active other replicas would be in passive mode. Azure Service Fabric helps in handling the network or other failovers by enabling one replica over the others.
Azure Service Fabrication with its true potential has solved the difficult problem of building and running various services. It helps us solve our business problems by involving a microservices approach that uses infrastructure resources efficiently. By providing built-in APIs, service fabrication makes it easier to develop microservices. Service fabrication also allows for applications that have been built in the traditional monolithic way to be migrated to a Service Fabric environment.