When you build cloud services, they need to be built as scalable, distributed systems that can go from a handful of customers to a million if the service takes off, and will always be available even if the network gets slow or there are server failures.
If you build on a public cloud platform like Azure or AWS, the cloud platform will have that scalable, distributed fault tolerance itself, but you have to build it into your own apps yourself – and that's hard. Especially as your service will have to keep evolving as you add features, but also stay stable even when you're updating it.
That's what the new Azure Service Fabric is for, Azure CTO Mark Russinovich explained to TechRadar Pro. "Traditional tools that people use to develop applications just aren't up to the job of maintaining that kind of complexity with the reliability and flexibility and availability these services require.
"Developers have been hand rolling their own solutions to this, which explains the rise in open source solutions and cluster orchestrators and containerisation – but the fact is these solutions are not really solving the full spectrum of problems that developers are facing."
The Azure team knows those problems pretty well, because they have to help the teams behind Microsoft cloud services like Visual Studio Online and Cortana to solve them. "This technology isn't just something we've been working on just for a few months and are popping out and shoving over the wall here," says Russinovich.
"It's something that we've been running for five years inside Microsoft. It powers a growing number of Azure services as well as general Microsoft services. Everything from Azure Database to Skype for Business to Cortana, to Service Bus, Event Hubs, to Intune, to DocumentDB and more – they're all running on our service fabric. And what we're releasing isn't just a version of that or just something that's like what we're powering these internal services on; it's the exact same bits."
More control, less complexity
Usually, developers get a choice between using PaaS and only being able to do what the platform allows, or using IaaS and having to handle all the complexity themselves. Azure Service Fabric gives you the control but takes care of the complexities of scaling and updating and maintaining a service that you're running in the cloud (or on your own servers).
Service Fabric can work with microservices where you explicitly care about the state of every transaction as well as ones where you leave the platform to take care of that. "There's nothing else out there that supports stateful microservices," claims Russinovich. "Of course this supports stateless microservices like you see people developing on top of containers but it also supports stateful microservices like DocumentDB and Azure Database."
"Service Fabric is designed from the ground up with a microservices approach to cloud service architecture," he notes. "It's kind of unique in that it really understands the binding between microservices, your application and the underlying infrastructure, the cluster that those run on."
Take Microsoft's Azure Database service, which is running two million active databases on tens of thousands of databases – that's all done with the service fabric, says Russinovich. "Each one of those databases is represented as three or four microservice replicas and each one of those replicas has a copy of a database in a different server in a different track. Service Fabric is responsible for honouring those placement requirements, saying these microservices have to be on different servers in different racks.
"The only thing the Azure database developers worry about is 'a request came into my microservice and I'm going to commit it to my durable-state store'. Service fabric is what's responsible for routing those requests to the primary of those three replicas and it also takes care of 'how do I get that state replicated to those secondary replicas?' It does that all automatically under the hood. The developer can make multiple changes to the state in a transactionally consistent way and those transactions are implemented by the service fabric."