Microservices are the next evolution of Service Oriented Architecture (SOA). Combined with Microsoft Azure they are also a powerful technology to produce agile, scalable and resilient PaaS services. This blog posting is the first in a series of blogs that will provide a deep dive into Microservices and the Microsoft Service Fabric. By the end of this blog series the reader should have enough knowledge to start to architect and build Microservice solutions on the Azure platform
What are Microservices?
Microservices is a term to describe a service that does one thing and does it well. It is important to keep the functions provided by a Microservice as small as possible. These services are also decoupled by nature. They are not interdependent. For example, you could create a service that takes an uploaded image and saves it to Azure blob storage. Or a Microservice could be created to monitor an Azure Service Bus queue for logging messages to store in Azure table storage. The point is to make the services specific in their purpose and not have them do multiple complex tasks. Sometimes you may need to have a service perform multiple functions, but these should be the exception and not the rule. See figure 1 for a view of these sample Microservices.
Figure 1 – Sample Microservices
The two Microservices shown in our example could be written in any modern language. Visual Studio provides templates and Microsoft provides a Microservice SDK (Service Fabric SDK) for building out Microservices. But they can be built in Java, Node.js, Python, PHP, etc. Any language that allows to you create services with REST interfaces. For this series I will be using Visual Studio 2015 and C# to develop the sample Microservices.
As long as you maintain REST interface discipline (well defined and immutable interfaces), you can deploy an updated service without effecting the existing Microservice application. In fact, you can have multiple versions of your service existing side by side inside the Service Fabric environment. This is huge for agile teams and enterprises. It allows you to make changes to an existing service or to add a new service with little worry that you will break the system. Of course, you will still need to test your code before you put it into production. But because of the small agile nature of the individual services your regression testing should be minimized. Done correctly, each Microservice in your application can be individually scalable. The scaling of the services is managed again by the Service Fabric.
As part of this series we will also have a blog on DevOps for Microservices. Microservices also eases deploying your application. It really will allow your agile team to become faster and more efficient in its software development cycle.
I have mention something called the “Service Fabric”. This is the environment that will host Microservices. Service Fabric is a Microsoft technology that has been used and production tested for years. Many Azure services are managed by the Service Fabric (Azure SQL Database Service, Cortana Analytics and other core Azure services run on Service Fabric). Microsoft has made Service Fabric available to enterprises to build out and host Microservices. Service Fabric is not an Azure only technology. If you wanted to run Microservices inside your own data center, it is available. You can also use it on competing cloud platforms. Service Fabric is even available on Linux, so you can deploy Linux Microservices.
Service Fabric provides many features to help you build applications with a Microservice architecture. Here is just a sampling:
- Detecting and restarting failed services
- Service Discovery
- State Management
- Health Monitoring
- Programming API’s and Framework (In VS2015 Reliable Actors, Reliable Services and Stateless Web API)
In conclusion, I have just given you a taste of what Microservice architecture can bring to your developer toolbox. As stated above this is just the first in a series of blogs that will dive deep into Microservices. I plan to have code snippets and walkthroughs in future posts so you can learn the tooling inside Visual Studio 2015 and can get a faster start on developing your own Microservice solutions.
Thank you for reading. Coming up next – Getting your Visual Studio Environment Microservice ready.