SOA vs Microservices: What’s the Difference?
In this article, we will see a comparison between SOA vs Microservices and their basic differences.
1. Introduction
A service is a single software unit that performs business tasks. Service-oriented architecture (SOA) is a software architecture where distinct components of an application provide services to other components via a communications protocol over the network. SOA composes a complex application by orchestrating separately deployed components over the network. There are two key components in SOA:
- Service Components – including both services providers and consumers.
- Enterprise Message Bus (ESB) – orchestrating the service components. Click here to see a list of ESB tools.
2. SOA Principles
An individual department within an enterprise builds its software applications and may communicate with other applications to fulfill business tasks. SOA emerged in the late 1990s and is a cost-effective way because it reuses existing components. It usually depends on a tool to transform and communicate with service endpoints. Here are key SOA principles:
- Standardized service contract – services are well defined. e.g. SOAP web services describe services in WSDL and Restful services define with WADL.
- Loose coupling – less dependency on each other.
- Abstraction – each service component acts as black boxes.
- Autonomy – each service controls its own logic.
- Statelessness – each service returns a value for success or exception if it fails.
- Discovery – can find services via UDDI, etc.
3. Microservices Architecture
Microservices architecture (MSA) has evolved from SOA since 2005. Each microservice is deployed to a container in a cloud environment. MSA has the same principles as SOA. Click here for a basic understanding of MSA.
4. SOA vs Microservices (MSA)
SOA and MSA both focus on the service development. But there are different. Here are key differences between SOA and MSA:
SOA | MSA | |
Scope | focus on enterprise tasks. Components integrate together to achieve an enterprise goal. | focus on a single service. Each microservice is a self-contained application. |
Re-Use | reuse the services. | reuse the code to reduce the dependency of other components. |
Sync vs ASync | synchronous call is preferred. | asynchronous processes (events/messages driven) are preferred in MSA to improve performance. |
Data | services access the shared data storage. | each microservice accesses its local data so it doesn’t depend on other’s data. |
Tool Examples | Mule, TIBCO, etc | Docker, Kubernates, etc. |
Network Protocol | SOAP | HTTP |
5. Summary
In this article, I explained the basic definition of SOA and MSA and identified the key differences between them. It really depends on the business problem when choosing the better solution. In general, SOA is a better choice for a smaller web-based application. MSA is a better solution for a large complex business application.
great explanation!