Friday 22 May 2020

Micrososervice and SOA introduction

What are Microservices: A type of SOA, basically distributed computing.  Microservices are a subset of SOA but with loosely couple architecture.  Independent deploy-able services, tries to reduce/remove other services dependency on a specific service.  I can change a service and it does not affect other service/break existing services.  Allows us to have a small scope of release, therefore easy to test and increase release frequency.  Services will depend on other services.  SOA is older but both are well tried and tested.  Microservices is generally preferred but it's much easier to move to SOA for a monolith.  

Monolith Systems:  Monolith are the way most systems were built, large full deployments.  All code is packaged into a large module of code.  They are simple and often are sometimes fairly appropriate such as on-prem. software.  Beware the Distributed Monolith:  Separate services but high dependent, end up having to co-ordinate deployment between code bases.

More on SOA: Independently deploy able,  DDD for scoping works well for defining Microservices.  Need to get the boundaries right is key.  Using Bounded Context is a good way to have multiple related models and show their overlapping points.

Each service operates in isolation which are processes.  Allow us to scale independently.  Containers are good for hosting these services.  Communication generally done over request/Response (most commonly HTTPS) e.g. REST API or Event-Driven e.g. Azure Service Bus.  Event is broadcast from the service, listening services is responsible for listening to the event.

Encapsulation of data, the data is hidden inside the Microservice boundary. Allows for independent deployment.

Main Benefits of SOA:

  • "Microservice buy you options";
  • As smaller independent units are deployed, which leads itself to faster deployments to production using CI and CD.  More teams/devs  can work independently;
  • Defense in Depth Security;
  • Scalability from performance - Scale up, identify bottlenecks (change tech or scale service hosting bottleneck);
  • Failure Independence - tolerate partial failures, service redundancy;
  • Cost - focus cost as needed, scale up and down.  Deliver service quickly, can replace with better technology e.g. service use an expensive workflow software to do some logic, as business grows, build a C# service that does the work faster, better, and lower cost and no need to BPM.

Note: SOA does not guarantee these benefits, you need to adjust to get them

Tip:  Still use similar technology stacks and patterns, don't allow each service to be built without considering the consumers.  Try keep on a similar stack e.g. don't use C#, NodeJS, Python, Go for different web services.


0 comments:

Post a Comment