For a recent article on TechTarget.com, I was interviewed for my thoughts on microservices, a new term in our world. Here is what I said (the full quote):
Microservices is a great way to decouple an application for faster modernization, improved functionality and better performance, but done incorrectly or without proper architectural understanding, teams can find their efforts taking longer or not delivering the results they were expecting. When you get down to technologies for microservices, you can get tripped up in language wars. Very few companies use multiple technologies across their portfolio to create different functionalities, and this creates complexity for developer teams, particularly when they are asked to do microservices. Scripting languages like Python will never be as fast as compiling languages, like .NET or Java, but then you get into the vendor wars. It’s common for organizations to be a Microsoft shop or an Oracle shop, so your developers will need to be skilled accordingly. The good news is that Microsoft is making a concerted effort to improve .NET development in microservices. They are putting a lot of weight behind promoting .NET for Azure adoption and have made it easier to spin-up a microservices environment in .NET than it was even five years ago. As this adoption continues to get easier, we will see microservices adoption spread even further.
So what are microservices? Wikipedia defines them as:
Microservices are a software development technique—a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity. This makes the application easier to understand, develop, test, and become more resilient to architecture erosion. It parallelizes development by enabling small autonomous teams to develop, deploy and scale their respective services independently. It also allows the architecture of an individual service to emerge through continuous refactoring. Microservices-based architectures enable continuous delivery and deployment.
Wikipedia goes on to state that there is no industry consensus yet regarding the properties of microservices, and an official definition is missing as well. The term “microservices” is just an easier way to say what Wikipedia described above, especially to those not in the information technology space. Just like the “cloud” is an easy way to say what it actually means.
Why Use Microservices?
One of the things I talk about in my conference sessions or write it my books is about application performance. This is very important to your users so that they can complete a workflow as quick as possible. This can lead to happier users which equals more sales. Microservices can help with this, even using legacy code. In all of conference sessions and books I also strive to use real world examples, so the stats below come from a contract I worked on in 2018.
At this company, the users on their mobile device would upload one or more blobs of data that hovered around 600K each. Organizations that used the app could have many hundreds of uploads in a short amount of time. I was hired to create a handful of microservices to run on Amazon Web Services (AWS) to improve this data ingestion while using as much as the current (legacy) code running in ASP.NET. These microservices are call LAMBDA’s in AWS.
When I left, my microservices were in the final stages of testing and not on production. The ingestion speed on my last day was running from 7 to 70 seconds (running on 25 servers in AWS). This is incredibly slow and was preventing them from landing contracts with large organizations and their current customers were not very happy about the performance. I don’t blame them.
As with any app, the goal is to allow the user to continue with their workflow as soon as possible. With the microservice that I wrote to accept the 600K payloads from the mobile client, this turnarund time shrunk down to around 200ms. The remainder of the processing took around another 300ms. The majority of the data processing was still done by their legacy ASP.NET code. There are future plans to move all of the processing into microservices.
So I turned 7 to 70 seconds into around 500ms to process the data all the way into the database. Now, this is a huge difference that will allow the company to grow without adding any new virtual servers. Heck, they should be able to decrease the number of servers they currently paying for.
As you read above, if done right, microservices can dramatically improve the performance of your back-end processing. I want to emphasize “if done right”. I was on another contract this year where they were trying to use the “old way of doing things” in microservices. This does not work!
Microservices introduces a brand new way of architecture along with new frameworks whether you are using AWS or Microsoft Azure. Microservice frameworks are, to me, in their infancy. Due to this, there isn’t a lot of good documentation and even less “best practices”. Since microservices is a fast-moving target, documentation can be out of date very quickly. Tooling in apps like Visual Studio needs to be a lot better to improve the time it takes to write and test them.
So, are microservices a marketing term… yes. Does microservices completely change how to architect a workflow… yes. Can microservices improve application performance… yes (if done properly). Does microservices require training… yes (to do properly).
If you aren’t looking into microservices for use in your applications, you need to! If you are on the Microsoft stack, I highly recommend using Azure to host your microservices since writing, configuration, deploying and running them is so much easier as compared to AWS. Especially since, as the writing of this article, Azure is more profitable than AWS!
As the writing of this article, I am working on an article on microservices hosted in Azure in my series of articles titled Real World Cloud App – From Start to Finish. I hope that you will follow along. All source for these articles is available online.