Over a million developers have joined DZone.

Microsoft Azure Service Fabric as a Platform for Developing Microservices

DZone 's Guide to

Microsoft Azure Service Fabric as a Platform for Developing Microservices

See how the Microsoft Azure Service Fabric platform enables all the most important parts of microservice architecture development.

· Microservices Zone ·
Free Resource

Essential Features of a Microservice

A microservice architecture consists of components/services with well-defined interfaces communicating over standard protocols that can be deployed, maintained and scaled independently.

  • Smaller, independent services: Functionality is segregated into separate smaller services.
  • Agility and DevOps: Consist of smaller units of code that can be independently versioned, deployed, and scaled. Smaller and geographically spread teams can work independently. A DevOps based tooling approach is required to achieve the required agility.
  • Interoperability: Interfaces and protocols (REST approach with HTTP and TCP protocols and XML or JSON as the serialization format) are well defined to interact with other services.
  • Resilient: The services remain consistent and available in the presence of failures.
  • Monitoring: Health events and diagnostics from the services help make informed decisions thus helping in creating self-healing services.
  • Scalability: Each service can be independently and massively scaled.

Microsoft Azure Service Fabric (ASF) as a Platform for Developing Microservices

Azure Service Fabric is a Platform as a Service (PaaS) offering from Microsoft.  Azure SQL Database, Azure DocumentDB, Azure IoT, Cortana, Power BI, Microsoft Intune, Event Hubs and Skype for Business are some of the products from Microsoft that leverage Service Fabric.

Service Fabric provides the infrastructure to run massive scale, reliable, stateless or stateful services. It provides end-to-end application lifecycle management and provides container and process orchestration services and health monitoring.

Image title

  • Ability to deploy applications either running in containers or as processes.
    • Programming APIs, to build applications as microservices: ASP.NET Core, Reliable Actors, and Reliable Services.
    • Health Monitoring
    • High Availability
    • Reliability
    • Service Discovery
    • Resource Optimization using Higher Density – multiple services can be hosted on a single node
    • End-to-End Lifecycle Management

Stateless vs. Stateful Services

Stateless and stateful applications differ in the way the data associated with the application is stored. While some of the stateless applications like a web interface for end users can be truly stateless, long-running stateless application might still need to maintain state but this is done outside the application. Stateful applications store the data internally.

Services built leveraging Reliable Services Framework have access to a large number of APIs that help them query the system, report health about entities in the cluster, receive notifications about configuration and code changes, find and communicate with other services.

Stateless Services

Stateful Services


State is stored outside the code

Co-located with code

S can be maintained leveraging Reliable Collections. Latency is low as code and data are co-located. Application state is stored in the compute tier.

Programming Model

Guest Executable

Stateless Reliable Services

Stateful Reliable Services – most stateful services are built using this model

Stateful Actor Model

Sample Use Cases

An endpoint

Web interface for end users

API gateway to other services


Guest Executable-Existing applications that are moving over to Service Fabric

Guest executables will not be able to leverage features of Service Fabric platform like endpoint registration, load reporting

Gaming, instant messaging applications, which require low latency reads and writes.

Computation intensive applications

Data processing on device data collected from a large number of devices

Transactional applications which involve workflows

Data Analytics based applications

Image title

(Updated from https://github.com/Azure/azure-content/blob/master/articles/service-fabric/media/service-fabric-application-scenarios/AppwithStatefulServices.jpg)

(Updated from https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/service-fabric/media/service-fabric-application-scenarios/AppwithStatelessServices.jpg)

Dev & Ops Tooling

  • Continuous Integration/Deployment: Developing as micro services helps in breaking the functionally into smaller independent units. Upgrades / new features can be rolled out independently to each of the units resulting in much faster and more error free development cycles. Continuous Integration/Deployment of micro services to the Service Fabric cluster can be achieved leveraging Microsoft’s Visual Studio Team Services platform. New features can be rolled out error free leveraging CI/CD pipeline for deployment of Micro services. A commit to the source control can be detected by a build tool. Build can be deployed to the service fabric cluster as soon as the build is created successfully.

  • Rolling Upgrades: Minimum downtime is ensured while updating services deployed on the Service Fabric Platform. Nodes in a cluster are divided into logical groups (update domains) which are updated one at a time, ensuring that there is no downtime.

  • Service Fabric Explorer: Service Fabric Explorer can be leveraged to visualize the state of the applications and the nodes on which they are running. Service Fabric explorer provides a view of the health of the nodes and provides a view of applications running on each node, provides insights by displaying any errors/warnings on the applications. It provides a lot of additional services like Naming Services, Failover Manager Service, Performance Management Operations etc. for managing the services.


microservices ,software architecture ,azure ,paas

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}