Enterprise scope vs Application Scope (SOA vs Microservices) - scope

I am trying to understand the difference of SOA and microservices archtitecture and some terms are so abstract to me, so it is hard for me to understand.
I read documents, generally mentioning about;
Soa is enterprise scope
Microservice is application scope
I can not understand this concepts, what is the difference of enterrise scope and application scope?
is that when dividing applications into multi services ? in both architectures applications are divided into multiple services and pieces are communicating by similar technology.
if difference is about how to divide application into multiple services and in soa it should be divided by busineess concepts, I dont think that there is rule in microservices architecture about not dividing by business concepts about the size of each service.
another abstract thing that I met:
This integration must occur by using service interfaces in soa- that's why it is Service-oriented.
what does that mean ? and how it is different from microservices integration?
Thanks for any ideas,answers

It's been a long since the question was asked so not sure if the insights below are relevant to you anymore.
Enterprise scope with respect to SOA usually refers to Service enablement of existing applications in an enterprise and unlocking their potential/investment while creating an overarching Business Process. SOA is very tightly bonded to the Business process and in simple terms can be assumed to be the actual implementation of an end-to-end process such as Sales Order Processing, Loan Application approval. Keep in mind that to create such a process, the SOA process/application would need to integrate with heterogeneous applications/systems/databases such as ERP, CRM, RDBMS, File systems, etc. In that sense, SOA architecture is not a pure app development architecture. Another aspect of SOA that you already mentioned is Service interfaces which can range from SOAP, JMS, and all other kinds of protocols
Microservices on the other hand are more aligned towards hardcore application development and breaking applications into granular and independent components (many times, even written in different programming languages). But most often the primary integration mechanism is lightweight REST API between the microservices.
Hope it helps.

Related

How to classify services in microservices?

I am new in microservices. I am coming from monolithic background in current environment i have different kinds services for different purposes like search, file, email, notification. I have taken so many courses but in that the instructor separate each entity and make it's own database also create API for that(like separate shopping cart entity, product entity) it makes no sense, I am not getting what is real world use of microservices or how to make separate component to build it's own microservice.
Can anyone give Real Project example?
Thanks in advance
Read this and this. Also look here and here. I don't think that anyone will give a link to the real working project, so you can try this.
I am not getting what is real world use of microservices
mostly as you heard in all of those tutorials the microservices architecture leverage advantages of:
the smaller services are easy to maintain and develop
easily can scale specific services rather than the whole project(monolith). for example you scale service-1 to 4 instances that request traffic split into these 4 instance and service-2 to 2 instances and go on (load balance). and these services may distributed in to different servers and locations.
if one service failed to work it does not terminate the whole system since they are independent.
services can be reusable for other scenarios or features.
small team can works for each services and its easy to manage both project and development flow.
and also it suffer from disadvantages of
services are simple and small but all as a whole system is complex so designing part are very critical.
poor performance and it requires do some extras to improve the performance (different types of caching on different levels).
transactions are complex and its developments are time costly. imagine simple update should be projected to other services if its required and you have to consider failure and rollback strategy ( SAGA ).
how to make separate component to build it's own microservice
this is the most challenging part of microservices. you need deep study on Domain driven design DDD.
Decompose by subdomain
Decompose by Business Capabilities
Can anyone give Real Project example?
there are many projects the develop microservices with different patterns. I think you have to start your own and make your hands dirty.

What is the difference between SOA and Microservices

Ok, as far as I've understood both in SOA and in Microservices modules should be independant and reusable. But what really differs SOA and Microservices ?
Both rely on the services as the main component but a lot of differences there. Few are below
SOA:
Follows “share-as-much-as-possible” architecture approach
Supports multiple message protocols
Multi-threaded with more overheads to handle I/O
Maximizes application service reusability
Not focussed fully into DevOps / Continuous Delivery
MicroService:
Follows “share-as-little-as-possible” architecture approach
Uses lightweight protocols such as HTTP/REST & AMQP
Single-threaded usually with use of Event Loop features for non-locking I/O handling
More focused on decoupling
Strong focus on DevOps / Continuous Delivery
Microservices Architecture is not an invention. 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.
Microservices vs SOA: How Are They Different?
I tend to agree with Chris Richardson's[1] definition.
3 main areas where SOA and micro services diverge:
Inter process communication
SOA:
Smart pipes eg. ESB
Protocols - SOAP, WS*
Micro service:
Dumb pipes eg. Message broker
Protocols eg. REST, gRPC
Database
SOA:
Shared databases
Micro Service:
Databases per service
Services tend to be monolith in SOA whereas small in nature as micro services.
[1]: https://microservices.io/index.html
Taken from: https://www.digitalroadmap.management/blog/2019/11/19/what-are-microservices-and-what-is-soa-and-what-are-the-differences-7245k
SOA and microservices have much in common and at first sight, it seems that the latter is just a new hyped buzzword for what SOA has already described. Yet, there are some differences between both.
What are Microservices?
Let´s first look at what a microservice is. Although there is no common definition for what a microservice is, there are a couple of common characteristics that definitions of microservices share. Those are:
Microservices are small, individual and independent components of software that, together, make an application.
Microservices are business-oriented, which means that the software architecture focuses on business purposes, such as a business capability, a particular product or service.
Every microservice provides a small piece of software to a greater purpose. Therefore, microservices regularly communicate with each other when in operation.
A major purpose of microservices is that they can be developed and deployed independently from each other. This leads to a decentralization of development teams in practice, which enables them to develop and deploy faster and with less dependencies and constraints.
Due to the modular architecture and the increased amount of communication interfaces between the microservices, errors and failures can be analyzed more precisely. In addition, microservice architectures are usually designed in such a way that they still function in the case that single microservices provide errors.
A microservices architecture is often used in areas that are continuously developed further. In such environments, the advantages of independent development and deployment, as well as failure tolerance is of highest importance.
What is Service Oriented Architecture (SOA)?
SOA, which stands for Service Oriented Architecture, is a software architecture style where generic services are provided to other components in the same architecture that provide more complex services based on the shared generic services. In the end, it is similar to a company´s shared services center.
Let´s imagine the following situation: A company that is operating in different countries has no shared services center at the moment. Therefore, basic HR and Finance activities, such as payroll and accounting are done individually in every country. By implementing a shared services center, the company can send all requests related to those activities to one single point of contact where the activities are executed. When the task is finalized, the results are sent back to the individual country. The individual countries then use the results, adapt them to country rules or their individual workforce and provide an additional, more sophisticated, or more individual service to their customers. SOA works in a very similar way. It allows to extract basic services from individual applications and bundles them in a shared services module instead. This shared services module then executes the tasks and provides the results back to the individual applications, which use them further.
So let´s investigate what SOA and microservices have in common and what not.
What do Microservices and SOA have in Common?
Both enable an integration into the wider IT – in contrast to monolithic systems that have no integration outside their own boundaries. A monolithic system can be the better option in areas where security is highly important or where there are no synergies with other systems expected, however, with the broad adoption of cloud technology and the required scalability, integrated systems are usually the preferred solution for architects
Both try to identify independent pieces of software that can be applied in different contexts and environments. SOA does this with the help of services that deliver information from one to another system and microservices do this with APIs that provide standardized interfaces for communication
SOA can have very different scopes, from very small to very big. Unlike the name suggests, this is also true for microservices, which can be just the authentication of a user at a service or the full purchase process behind your e-commerce basket
What are the Differences Between Microservices and SOA?
The objective of SOA is to design systems as a set of loosely coupled services that enable the integration of applications. On the contrary, microservices have the objective to work on different platforms and in different environments that emerged due to the manifold cloud environments and mobile solutions that require to work on different operating systems.
SOA is not dynamic and cannot fit for different purposes. They must be adapted or redeveloped every time a critical architecture piece of the involved technology changes. On the contrary, microservices try to be more independent by building on standardized interfaces that are valid across different technologies. However, there are often different standards, which can in the end lead to the same challenge that SOA has.
SOA typically shares fundamental components across different services. On the contrary, microservices usually have everything they need within the service, duplicated in every single microservice. Microservices are hence a bit slower, but less dependent on underlying services in order to work.
SOA and microservices are quite similar concepts. Some might also argue that microservices are a particular type of SOA. In the end, SOA and microservices both have their purposes. SOA helps to interconnect large enterprise systems (e.g. an HR or ERP system) so that they can communicate and interchange data. In contrast to that, microservices have the goal to work in different environments and independent from those environments, such as on web-based systems, operating systems, or cloud environments.
The difference between them (from real-life production project) is that SOA project has ESB (like Mule ESB, Camel or other) which intended to route messages (SOAP, JSON etc) from one service to another, and acts like a mediation layer between services. Services in turn, does not know about each other and just send\receive messages from ESB.
In opposite to SOA, microservice architecture implies that services will communicate with each other directly, using some protocol (usually HTTP).
Microservices similar to SOA in that we focus on business functionality and separate it into single, small deployable chunk.

Should I be moving to a microservices based architecture?

I am working on a monolith system. All of it's code is in one repository (Web API and background workers). System is written in Nodejs and MongoDB (Mongoose) is used as a data store. My goal is to set a new path how project should evolve. At first I was wondering if I could move towards microservices based architecture.
Monolith architecture creates some problems:
If my background workers needs to scale. I have to deploy all the project to the server despite only using a small fraction of it.
All system must be redeployed when code changes. What if payment processor calls webhook while system is being redeployed?
Using microsevices advantages are quite obvious:
Smaller code base for individual microservice. Easier to reason about it.
Ability to select programming tools best for particular use case.
Easier to scale.
Looking at the current code I noticed that Mongoose ODM (Object Document Mapper) models are used across all the project to create, query and update models in database. As a principle of a good programming all such interactions with database should be abstracted. Business logic should not leak into other system layers. I could do that by introducing REPOSITORY pattern (Domain Driven Design). While code is still being shared across web api and it's background workers it is not a hard task to do.
If i decide to extract repositories into standalone microservices than all bunch of problems arise:
Some sort of query language must be introduced to accommodate complex search queries.
Interface must provide a way to iterate over search results (cursor based navigation) without returning all database documents over network.
Since project is in it's early stage and I am the only developer, going to microservices based architecture seems like an overkill. Maybe there are other approaches I should consider?
Extracting business logic and interaction with database into separate repository and sharing among services to avoid complex communication protocols between services?
Based on my experience with working in Microservices for last few years, it seems like an overkill in current scenario but pays off in long-term.
Based on the information stated above, my thoughts are:
Code Structure - Microservices Architecture (MSA) applying in above context means not separating DAO, Business Logic etc. rather is more on the designing system as per business functions. For example, if it is an eCommerce application, then you can shipping, cart, search as separate services, which can further be divided into smaller services. Read it more about domain-driven design here.
Deployment Unit - Keeping microservices apps as an independent deployment unit is a key principle. Hence, keep a vertical slice of the application and package them as Docker Image with Application Code, App Server (if any), Database and OS (Linux etc.)
Communication - With MSA, communication between services become a key and hence general practice is to remain with the message-oriented approach for communication (read about the reactive system and reactive programming for more insight).
PaaS Solution - There are multiple PaaS solutions available, which you can apply so that you don't need to worry about all the other aspects like container management, container orchestration, auto-scaling, configuration management, log management and monitoring etc. See following PaaS solutions:
https://www.nanoscale.io/ by TIBCO
https://fabric8.io/ - by RedHat
https://openshift.io - by RedHat
Cloud Vendor Platforms - AWS, Azure & Google Cloud all of them have specific support for Microservices App from the deployment perspective, which we can use as an alternative solution if you don't want to deploy PaaS solution in your organization.
Hope these pointers will have in understanding the overall landscape so that you can structure your architecture for future need.
I am working on a monolith system... My goal is to set a new path how project should evolve. At first I was wondering if I could move towards microservices based architecture.
In what ways do you need to evolve the project? Will it be mostly bugfixes, adding features, improving performance and/or scalability? Do you anticipate other developers collaborating in the future? Are you currently having maintenance issues? The answers to these questions (and many more) should be considered in guiding your choices.
You seem to be doing your homework around the pros and cons of a microservice architecture, so if you haven't asked yourself why you're even doing this in the first place, now would be good time to do so.
Maybe there are other approaches I should consider?
There's always the good old don't-break-what's-going ;)

Integration of bounded contexts locally

In "Implementing Domain-Driven Design", Vernon give detailed examples for integrating bounded context with a messaging or REST based solution, it also mention database integration, but I understand it is not a very clean solution to share database or at least db tables between BC.
But what if the 2 BCs I want to integrate are hosted locally on the same server, is it really a good idea to use a messaging/rest/rpc solution ? (which seems more suitable for a remotely hosted BC to me)
Otherwise, except with DB integration, what are the other alternatives ? Hosting both BC in the same process and calling it directly (still using adapters and translators for clean seperation) ?
Thanks
You could look into using something like 0MQ for inter-process communication on the same server. I've also in the past just hosted things in the same process as you suggest and just used interfaces / in-memory messaging to separate out contexts.
Everything is about trade-offs in the end, so you just need to decide what level of isolation you are willing to accept. The simplest solution would be to separate inside a solution via folders and interfaces, the other end of the spectrum being completely separate servers.
I don't think that location should come into play w.r.t. integration between BCs.
There really are other factors to consider such as guaranteed delivery to the recipient in order to ensure that the processing takes place. This should be required whether or not the two BCs are hosted on the same server.
Another reason to ignore location is that when you need to scale, your architecture should be able to handle it from the get-go.
As tomliversidge mentioned it is possible to use some deployment mechanisms such as non-durable messaging to speed up things but there will definitely be a trade-off and that has to be a conscious decision.

Utility applications in DDD

I am quite new to DDD and have come across a scenario that i'm not to sure how to handle.
I have an application that is used to track vehicles. This application is what will be implementing the "core" of the domain for the business i am working for. Not only is this application going to be used, there will be other utility programs that must be created and used in order to help this "core/main" application function.
for example:
there is an windows service needed that will perform configured queries on a database and return results to an external database that my routing application will use. This windows service has the concept of a QuerySettings class that can be created and is then executed by this application.
Question1:
What do you call utility applications like the above described in DDD? ( it definitely isn't the main core of the domain but it's needed in order for the core application to work )
QUestion2:
Is QuerySettings a domain model? if not what is it and where should it be placed within following the onion architecture?
For question1: You may have a look at Bounded context, I think Bounded context contains a group of Domain models that represent concepts in a subdomain(or a core domain). You may need to map or share domain models in different bounded contexts to handle your business, this depends on your bounded context strategy, share-kernal, anti-corruption-layer(to name a few).
For question2: I have little information of how QuerySettings works but in general it is a domain model but in a generic subdomain, not in your vehicle tracking core domain. In core domain's view, it maybe an infrastructure concept.

Resources