very brief Introductory notes On Microservices
This would be mainly some notes I have took 3- years ago when I first read Sam Newman's book building microservices, along with some points gathered along the time since then.
Let's start with a definition, what are microservices:
These are independently deployable small services build around a business domain.
a little bit of details, These Microservices needs to be:
1- Able to change independently of each other.
2- Be Deployed by themselves without requiring the consumes to change.
3- All communications between the services are via network calls to enforce separation and avoid the perils of tight coupling.
some other Key points to the core of the definitions and introduction:
- How small is small: a Microservice is something that could be rewritten in around 2 weeks. (I believe this might be debatable or controversial).
Another suggestion is that it should be small enough that you can keep the structure in your mind
another key notice from Sam Newman, was that it seems like we have a good sense to notice when something is big or too big , so we can use this inversely that when something is not too big then its probably small. - What to Expose: we need to think what our services are going to expose and what should they hide because in case of too much sharing, our consuming services become coupled to our internal representations, this would eventually decrease autonomy as this would require additional coordination with our consumers when when making changes .
Key Benefits from Microservices :
- Technology Heterogeneity: Instead of having to use choose one technology for the whole application as in case of Monoliths, we can choose what fits the job this is also extended to data stores as well , whereas one service can have a relational database while another one uses a graph database or a document based one and so on.
- Reliance : if one component fails and the failure does not cascade you can isolate the problem and the rest of the system can carry on working .
- Scaling: In monoliths we scale everything together , while in microservices we can scale those services that need scaling.
- Ease of Deployment: in case of monolithic architecture a one line of code change might lead to the whole application to be deployed to deliver this change.
In Microservices we can make a change in one service and deploy it independently of the rest of the system.
This means that we can check our code for problems faster and we can make faster rollback if needed, which eventually means we can get new features to clients faster. - Composability: we open opportunities for function re-use and we also allow for our functionality to be consumed in different ways for different purposes.
- Optimizing for replaceability: with our individual services being small in size the cost to replace them with a better implementation is easier to manage.
The Flipside:
But as with everything with architecture and software there is no one size fits all , so there are some drawbacks with the microservices as well as it totally depends on the case and the domain.
Migration from Monolithic to Microservices might need a lot of time and planning as you would need to restructure you domain to a set of sub-domains , this also goes for business concerns, and subsequently the team itself so it is not only a technology problem.
There are are a massive list of concerns that needs to be addressed:
Monitoring and Health Checks , , Tooling, Fallbacks, Fault Tolerance , Logging, Service Discovery, Tracing, Build Pipeline, Release Pipelines, Scaling and Load Balancing , network latency, Development environment and Debugging.
Monitoring and Health Checks , , Tooling, Fallbacks, Fault Tolerance , Logging, Service Discovery, Tracing, Build Pipeline, Release Pipelines, Scaling and Load Balancing , network latency, Development environment and Debugging.
This might seems like stating the obvious but Microservices are not goal themselves they should be a way for a far more meaningful goals like discussed above.
Microservices do have a learning curve related to different tooling and concepts discussed above in order to be able to reap the corresponding benefits that is why this decision should be based on domain, team knowledge , time constraints , etc.
Microservices -and any distributed systems in this regard- I think needs a more experienced/mature team to handle it , while Monolith is more straightforward even though it might suffer from bottlenecks no clear boundaries , ..etc.
Tiered Architecture vs Microservice:
In traditional N-Tier Architectures , we divide the application to layers based on the functionality of each layer, for example in the more usual 3 Tier architecture we have a layer for presentation , a layer for Business Logic and a layer for Database , but what happens is that a change in one layer would usually need a change in other layers as well.
while in Microservices we would have different business functionalities represented as service and as stated previously each one has to be independently deployable .
while in Microservices we would have different business functionalities represented as service and as stated previously each one has to be independently deployable .
So consider for example an e-store application that runs as monolith , where there should be a change by introducing a new property to the user profile let's say adding the user's birth day , such. a change would require a change in the UI of the Profile page along with the api consumed by this ui , also the database to hold this user input data, like the figure below:
3-Tier Architecture with usual scope of changeif we are to have the same change in a microservice architecture:
we would have a single microservice for the user-profile , another for payment,...etc so the change would be in only one service .
so in general this would show that in a grander scheme, microservice architecture provide a cohesion in the system based on business functionality (Payment, Stocks, Order, User Profiles,...etc) rather than a technical cohesion (Database, frontend , backend) .
So I think to some point this is also a direct reflection on Conway's law:
Resources :
1- Article about a team that was thinking to migrate to Microservice then while weighing Pros and Cons over time they think against it :
Why our team cancelled our move to microservices
we would have a single microservice for the user-profile , another for payment,...etc so the change would be in only one service .
so in general this would show that in a grander scheme, microservice architecture provide a cohesion in the system based on business functionality (Payment, Stocks, Order, User Profiles,...etc) rather than a technical cohesion (Database, frontend , backend) .
So I think to some point this is also a direct reflection on Conway's law:
"Organizations who design systems, are constrained to produce designs which are copies of the communications structures of these organizations"
the way we used to form teams is based on their areas of competency/expertise (front end , backend -C#, Java , Database Admins ....etc) , while currently with the domain driven design gaining more appeal and as a way to reduce silos and facilitate thing like continuous integration and delivery, we are dividing the teams along vertical business lines like the last figure has shown.
So in case of microservices we would have a team with a full end-to-end responsibility for making changes related to the user-profile in general.
the way we used to form teams is based on their areas of competency/expertise (front end , backend -C#, Java , Database Admins ....etc) , while currently with the domain driven design gaining more appeal and as a way to reduce silos and facilitate thing like continuous integration and delivery, we are dividing the teams along vertical business lines like the last figure has shown.
So in case of microservices we would have a team with a full end-to-end responsibility for making changes related to the user-profile in general.
Resources :
1- Article about a team that was thinking to migrate to Microservice then while weighing Pros and Cons over time they think against it :
Why our team cancelled our move to microservices
2-Airbnb journey to Microservices: The Human Side of Airbnb’s Microservice Architecture
3-Github Journey Microservices https://www.infoq.com/presentations/airbnb-culture-soa/
4- A hilarious take on complications teams might suffer from with microservices:
https://www.youtube.com/watch?v=y8OnoxKotPQ
https://www.youtube.com/watch?v=y8OnoxKotPQ
5- jokes aside though , Dave Farley's well articulated take on the microservices pros and cons:
The Problem With Microservices
The Problem With Microservices
6- LinkedIn migration to Microservices LinkedIn _microservices
7- Company called Segment moved from Monolith to microservices then to monolith again.
Goodbye Microservices
Goodbye Microservices
8- Company named Istio that has moved from microservices to monolith again:


Comments
Post a Comment