What's the Deal Between SOA and Microservices?
What's the Deal Between SOA and Microservices?
Join the DZone community and get the full member experience.Join For Free
One day I was talking with other developers in my company about some modifications that we'll need to do in our current architecture of one specific system. At some point, one of these developers stated that we can't say that our architecture is based on Microservices because we have modules that communicate with each other directly and synchronously. He said that we must call it a Service Orientated Architecture (SOA).
In that occasion I didn't say anything but I started to reason about those words. I had never thought in those two architecture models as opposites. So I did some research and the result is this post. This post is not about some academic theoretic definition of concepts nor an absolute truth about anything. What I want to achieve is to start a discussion about the topic.
First of all I look through some resources to find a good definition of SOA and Microservices. I found two that I liked. The first one is:
"A service-oriented architecture is essentially a collection of services. These services communicate with each other in order to achieve one or more operations."
"A loosely-coupled architecture designed to meet the business needs of the organization."
Let's start thinking about the name: Service Oriented Architecture. And this means a lot. When I see the word "oriented" I tend to to think more abstractly. A set of concepts and patterns with a purpose. It doesn't define the implementation but the specification. When we think about orientation, we should think about the concepts that rule SOA that we should consider while designing the system, even if we don't apply them all. It's like Scrum and XP. The former just specifies a set of good practices without going into details, while the latter defines the rules for each one of these practices.
Later I found some definitions of a Microservices architecture. I would rather the definition that Martin Fowler wrote in his blog:
"[...] the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms [...]"
So, the definition of SOA states that a SOA architecture is based on the collaboration of services, and the definition of Microservices says that the approach is to have an application build up by small services. Interesting.
Based in those definitions I think that the key here is granularity.
Computer guys love binary numbers. True or false. Is or is not. But sometimes this duality lead us to do mistakes or get confused. It doesn't matter if SOA and Microservices are the same thing or not, or what is the boundary that makes Microservices turn into SOA and vice versa. What really matters is that they have similar concepts applied differently.
I think that Microservices is one type of Service Orientated Architecture. It has a lot of concepts that were born with SOA, applied in a different scale, within an application. While in "classic" SOA we have services designed to meet the business needs of an organization, a microservice application has small services working together to achieve something that is inside the boundary of the application.
Can Microservice be called SOA? Yes! Indeed, a Microservice architecture applies most of SOA concepts.
In the same post talking about Microservices, Martin Fowler wrote a note about Microservices and SOA. One of the things that he wrote is:
"The problem, however, is that SOA means too many different things, and that most of the time that we come across something called "SOA" it's significantly different to the style we're describing here [...]"
The whole definition of SOA is overwhelmed with a lot of other concepts. The original concept is lost in the middle of a lot of implementations, merchandise and other things. Some say that a Microservices architecture is SOA done right, but I don't like this idea. I prefer the idea that a Microservices architecture is SOA applied in the scope of an application with fine-grained services.
I hope that this post can be useful to someone trying to understand more about those concepts. As I said in the beginning my objective here wasn't discuss the characteristics of SOA and Microservices but analyse the relationship between them. I want to start a discussion and I'd like to see some other thoughts.
If you want to learn more about the concepts of Microservices, I recommend you to take a look in the reference links bellow.
Published at DZone with permission of Lucas Saldanha , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.