When we are going to compare the difference between SOA and Microservices architecture, it is almost nearly impossible to prove one superior than other, different perceptions are there like they solve their own set of problems, have different concepts etc., while other thinks both have same architecture and work for common goals. In this blog, I will explain the basic difference between SOA and Microservices Architecture?
A Service Oriented Architecture is a software architecture pattern, in which application components provide services to other components via a communications protocol over a network. The communication can involve either simple data passing or it could involve two or more services coordinating connecting services to each other. Services such as RESTful Web services carry out some small functions, such as validating an order, activating account, or providing shopping cart services.
Service Oriented Architecture is less about how to modularize an application, and more about how to compose an application by integration of distributed, separately-maintained and deployed software components. It is enabled by technologies and standards that make it easier for components to communicate and cooperate over a network, especially an IP network.
There are 2 main roles in SOA, a service provider and a service consumer. A software agent may play both roles. The Consumer Layer is the point where consumers (human users, other services or third parties) interact with the SOA and Provider Layer consists of all the services defined within the SOA.
Microservices is a software architecture pattern in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs.
Microservices must be a real need in the system architecture as it could be designed wrongly. It means a service should be independently deployable, or be able to shut-down a service when is not required in the system and that should not have any impact on other services. The following figure shows a quick view of a Microservices architecture.
As shown below, each service has its own database or a database is shared between a few of microservices:
Microservices are not invented. Enterprises such as Amazon, Netflix, and eBay used the divide and conquer strategy to functionally partition their monolithic applications into smaller units, and resolved many issues. Following the success of these companies, many other companies started adopting this as a common pattern to refactor their applications. Eventually the pattern was termed as Microservices Architecture. Nothing radically new has been introduced in MSA. MSA is the logical evolution of SOA and supports modern business use cases.
In the end, I only want to say that it is not as simple as to tell which architecture is good and it finally depends on the application that you are going to build. SOA is better suited for large and complex business applications while Microservices is good for small applications.