Introduction to Microservices using Azure Service Fabric

Azure_LogoToday’s Internet scale services are built using microservices. Example microservices are protocol gateways, user profiles, shopping carts, inventory processing, queues, caches, etc. Microservices can further be defined by:

  • Is (logic + state) independently versioned, scaled, and deployed
  • Has a unique name that can be resolved
  • Interacts with other microservices over well-defined interfaces like REST
  • Remains logically consistent in the presence of failures
  • Hosted in a container (code + config)
  • Can be written in any language or framework

The Microsoft Azure Service Fabric is a microservices platform giving every microservice a unique name that can either be stateless or stateful.
Stateless microservices (e.g. protocol gateways, web proxies, etc.) do not maintain any mutable state outside of any request and its response from the service. Azure Cloud Services worker roles are an example of stateless service. Stateful microservices (e.g. user accounts, databases, devices, shopping carts, queues etc.) maintain mutable, authoritative state beyond the request and its response. Today’s Internet scale applications consist of a combination of stateless and stateful microservices.
Why are stateful microservices important? Why not simply use stateless services for everything? Two reasons:
1) The ability to build high-throughput, low-latency, failure-tolerant OLTP services like interactive store fronts, search, Internet of Things (IoT) systems, trading systems, credit card processing and fraud detection systems, personal record management etc by keeping code and data close on the same machine.
2) Application design simplification as stateful microservices remove the need for additional queues and caches that have traditionally been required to address the availability and latency requirements of a purely stateless application. Since stateful service are naturally highly-available and low-latency this means fewer moving parts to manage in your application as a whole.
Azure Service Fabric enables you to build and manage scalable and reliable applications composed of microservices running at very high density on a shared pool of machines (commonly referred to as a Service Fabric cluster). It provides a sophisticated runtime for building distributed, scalable stateless and stateful microservices and comprehensive application management capabilities for provisioning, deploying, monitoring, upgrading/patching, and deleting deployed applications.
Service Fabric powers many Microsoft services today such as Azure SQL Databases, Azure DocumentDB, Cortana, Power BI, Microsoft Intune, Azure Event Hubs, many core Azure Services, and Skype for Business to name a few.
Service Fabric is tailored to creating “born in the cloud” services that can start small, as needed, and grow to massive scale with hundreds or thousands of machines, creating Service Fabric clusters across availability sets in a region or across regions.
Service Fabric provides comprehensive runtime and lifecycle management capabilities to applications composed of these microservices. It hosts microservices inside containers that are deployed and activated across the Service Fabric cluster. Just like an order of magnitude increase in density is made possible by moving from VMs to containers, a similar order of magnitude in density becomes possible when moving from containers to microservices. For example, a single Azure SQL Database cluster, which is built on Service Fabric, comprises of hundreds of machines running ten of thousands of containers hosting a total of hundreds of thousands of databases (each database is a Service Fabric stateful microservice). The same is true of Event Hubs and the other service mentioned above. This is why the term hyperscale can be used to describe Service Fabric capabilities — if containers give you high density, then microservices give you hyperscale.
Service Fabric provides first class support for the full application lifecycle management (ALM) of cloud applications: from development to deployment, to daily management, to maintenance, and to eventual decommissioning.
The Service Fabric ALM capabilities enable application administrators/IT operators to use simple, low-touch workflows to provision, deploy, patch, and monitor applications. These built-in workflows greatly reduce the burden on IT Operators to keep applications continuously available.
Most applications consist of a combination of stateless and stateful microservices and other EXE/runtimes that are deployed together. By having strong types on the applications and the packaged microservices, Service Fabric enables the deployment of multiple application instances each of which can be managed and upgraded independently. Importantly, Service Fabric is able to deploy any executables or runtimes and make these reliable. For example it can be used to deploy ASP.NET 5, node.js, scripts, or anything that makes up your application.
For more information on Azure Service Fabric and Microservices, contact us at Perficient and one of our 28 certified Azure consultants can help envision your solution today!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Joe Crabtree

More from this Author

Subscribe to the Weekly Blog Digest:

Sign Up
Follow Us