Microservices and SOA: Better Together
Microservices and SOA: Better Together
While microservices certainly don't replace service-oriented architecture, the two can complement each other in enterprise settings.
Join the DZone community and get the full member experience.Join For Free
Integration is essential.
No single enterprise can have just one technology or just one system to cater all their computing needs. Enterprises need to be composed of multiple programming languages, multiple vendor applications, multiple partner systems, legacy applications, etc.
One architecture style simply cannot fulfill IT needs since we typically deal with discrete technologies from many generations, heterogeneous technologies, different vendor systems, and much more. On top of that, each system possesses different architectural abilities.
When a new project comes on board, most solution implementations typically involve leveraging existing investments in systems, catalogs of services, and staff with existing skill sets and experiences. Designing solutions using existing systems is only possible with application integration.
Application integration, in Mule’s words, is:
“the sharing of processes and data among different applications in an enterprise. For both small and large organizations alike, it has become a mission-critical priority to connect disparate applications and leverage application collaboration across the enterprise in order to improve overall business efficiency, enhance scalability, and reduce IT costs.”
Application integration can happen at three levels:
User interface integration (portals), though some may say that this is a dated integration style and should be deferred due to its tradeoffs
System or services integration
Experts admit that no single architecture is the architecture for all enterprise IT needs. It all depends on what system you are designing and where it is used.
Some of the well-known architecture styles are:
Microservices and SOA
While all architecture patterns are important to know, microservices architecture is catching up all the trends in today’s industry for distributed applications.
Microservices is indeed a very well-thought-out architecture pattern for applications development, and further services are exposed via RESTful interfaces.
Figure 1: Microservices Architecture Diagram
Some characteristics of microservices are that they share nothing, have bounded context, use a RESTful service interface, involve direct invocation and API layers, favor rewrites over maintenance, and are separately deployed.
Some of these characteristics translate to atomic services, no distributed transactions, statelessness (since they were exposed via REST), whether or not something is the right size for microservices, and idempotence.
SOA is not just ESB or a full-blown product. SOA is an architecture style at the enterprise level that brings visibility of all types of services and systems like REST services, SOAP services, and legacy apps via service layer.
Figure 2: Service Oriented Architecture Diagram
Some traits of SOA are that it involves the interoperability of systems, offers native support to integrate, compliments with microservices and the cloud, promotes the reuse of IT assets, and involves service taxonomy.
SOA doesn’t prescribe how to implement a service. This is left to the individual service designer. Since SOA primarily solves the application integration problem, it works for most integration needs such as file-based integration, data-based integration, and WS-based integration. These are all possible in SOA through JCA, adapters, etc.
Following are some intrinsic characteristics of services involving SOA from Lucas Jellema in his SOA handbook:
Service should support atomic operations whenever possible.
Service should be stateless to keep the footprint small.
Service should be idempotent to allow retries without side effects.
Service should be of the right size.
Now, if you scroll back a bit, you can find that microservices characteristics perfectly match the service definition of a service per SOA.
Service in SOA architecture under any taxonomy can be materialized by microservices. Maybe that’s the reason why everyone's said, “microservices are SOA done right!” Those who do budgeting and project costs, don’t you agree that any service is reusable at the enterprise level?
In conclusion, microservices don't replace SOA, but they complement very well with SOA for large enterprises.
Opinions expressed by DZone contributors are their own.