The power of Azure Service Fabric: more control for developers, less complexity

Update issues

Cloud services have to run all the time, but they also need regular updates – and too often, that's when problems happen. "One of the challenges is how do I update microservices while I keep my service available to clients – and how do I deal with any problems I introduce in an update? Service Fabric supports fully automatic updates with rolling updates.

"Only parts of the microservice that's offering functionality get taken down at a time. It has health monitoring with watchdogs, and the facility for automatic rollback – if there are problems it can move back to a known good state. There's health monitoring for VM failures, for service failures, for microservice failures."

If something goes wrong, Service Fabric can automatically heal your service. "If a server fails, say it's the primary server – it detects that failure and promotes the secondary to the primary and heals the old primary in place if it can, or creates a new instance on a healthy server and catches that one up – all behind the scenes. That is truly rocket science distributed systems stuff," claims Russinovich. "In terms of what you can do, all these things I've mentioned – rolling updates with rollback and healing and health monitoring and watchdogs and stateful replication – I'm just scratching the surface."

And building an app to take advantage of all this doesn't have to be complicated either. There are low-level commands that the developers at Microsoft who build services like AzureDB use, but there are also higher-level commands you can use with Service Fabric. "If you're familiar with distributed dictionaries in .NET like key-value stores and queues, we will have that exact same programming model," Russinovich explains, "backed by stateful replication with support for transactions.

"You could take a distributed dictionary and update it and put a message in a queue all within Service Fabric, and it will then be committed across all those replicas I talked about."

Actor model

But Service Fabric also has a much simpler, higher-level programming system called an actor model. Actors are virtual – you can always program against them and the system takes care of creating them when they're needed, and garbage collecting them when they're not, so they're very efficient. And it takes care of spreading them out over different clusters to make sure you have enough resources when you need to scale up and pass messages between them. The actor model handles transactions and availability and consistency for you and it's a very powerful way of building cloud services far more simply.

You might have heard of this from the Project Orleans .NET framework from MSR that all the cloud services for Halo 4 are built in (everything from finding someone to play against to the record of every shot fired in every game is stored as actors using Orleans).

"Orleans was an incubation that we're now productising on top of the Azure Service Fabric," explains Russinovich. "I'm really excited about this, especially on top of the Service Fabric foundation that's really hardened by all the usage inside Microsoft. This really democratises stateful distributed programming – which is the hardest there is."

And as you'd expect from the new Microsoft, you get plenty of choice in where you can use Service Fabric. The initial languages for developers are C++, C# and .NET but Russinovich says Microsoft will bring out other languages that developers ask for. And while Service Fabric will come out first as an SDK for Windows, he notes "we're working on making it available later on Linux for startups that have chosen to build on top of Linux."

It doesn't even have to run on Azure (although that's where it makes most sense because that gives you the cloud scale). "You can put the Service Fabric on your own servers or on other clouds and later we'll be releasing it as a service in Azure as well as on the Azure Pack. You can put it on your own cluster, or on a single box for integrated debugging with Visual Studio. You can put it on whichever server you want including very small ones," promises Russinovich. "A key focus of ours is that people can take advantage of this, without fear of being locked into something."

Contributor

Mary (Twitter, Google+, website) started her career at Future Publishing, saw the AOL meltdown first hand the first time around when she ran the AOL UK computing channel, and she's been a freelance tech writer for over a decade. She's used every version of Windows and Office released, and every smartphone too, but she's still looking for the perfect tablet. Yes, she really does have USB earrings.