Introduction to Microservices with Azure Service Fabric
The shift to cloud architectures has coincided with a shift towards smaller, purpose-built services. Instead of classic “monolithic” architectures which are large, tightly-coupled, and slow to evolve, most architects prefer “microservices”.
Microservices are purpose-built services that do one thing well and can be utilized by one or more consumers in a distributed environment. They have minimal statefulness, allowing for easier scaling and distribution. Microservices are federated and can be viewed as an extension of “Service-Oriented Architecture”, allowing businesses to build (or buy) best-of-breed solutions and reuse them instead of reinventing the wheel in every application.
There are a few platforms for deploying and managing microservices. The most popular are Docker and Kubernetes. Yet, one of the best options is Microsoft’s Azure Service Fabric. Let’s review the pros, cons, and resources for getting started.
Pros of Microservices
The benefits of microservices are obvious:
Quality: Microservices concentrate on one version of a service instead of embedding varying versions in multiple applications. Improving the central definition ends up improving every application that relies on the service.
Scale: Microservices can be defined in one package, but distributed worldwide and scaled on-demand. When load increases for a specific microservice, more instances are automatically added to scale out.
Resiliency: Because microservices can be deployed so quickly, because they are built as independently as possible, and because they offer rich tooling and instrumentation, it is easier to offer high availability and recover from faults.
Consistency: Microservices are predictable because they’re based on a central definition. Every instance of a microservice is the same and automated testing is easier. Updating the definition in one place updates the service everywhere.
Cost Management: Microservice architectures are generally more efficient and elastic than traditional services. They can coexist with a higher density on fewer hosts and be configured to scale up or down depending on demand, leading to fewer idle servers.
Cons of Microservices
There are a few considerations to understand before adopting microservices:
Initial Complexity: There is a steeper learning curve when deploying your orchestration layer and planning your microservices. Finding experienced talent is tougher.
Ongoing Complexity: Versioning, service discovery, and troubleshooting are more complicated when deploying microservices. A robust orchestration platform should be used.
Monitoring: Because microservices are newer, are portable, and tend to be “chatty” on the network, it is more difficult to monitor them compared to traditional approaches.
Limitations: Microservices are not yet as versatile as infrastructure like virtual machines. Not every service and be decomposed into microservices and not all platforms are supported. Docker and Kubernetes are rooted entirely in Linux and have minimal tooling for Microsoft technologies.
Why Azure Service Fabric
Thankfully, Azure Service Fabric taps into all of the positives mentioned above while addressing the downsides.
Azure Service Fabric is a Platform-as-a-Service (PaaS) offering that supports microservices built on Windows or Linux. It provides rich tooling, templates, and orchestration to publish and manage microservices.
Microsoft is heavily invested in Azure Service Fabric and relies on it for core services like Skype for Business, Cosmos DB, Azure SQL, and Dynamics 365.
Through the Azure Portal, we can deploy a Service Fabric cluster consisting of as many nodes as we like. Once provisioned (in a matter of minutes), we can upload traditional executables, import containerized services from Docker Hub, or start developing new applications against a rich API.
Azure Service Fabric offers Visual Studio templates and supports multiple programming paradigms including the “Reliable Actor” model which allows for tens of thousands of concurrent network-aware processes.
Getting Started with Microservices Using Azure Service Fabric
If you’ve already made investments in containers and slim applications, Azure Service Fabric is a great option for hosting them. If you’re brand new to microservices, it’s a great option.