Monolith to Microservices: Things to Consider

Things to keep in mind while breaking a monolithic system down to microservicesFirst things first, monolith systems are never the enemy.Breaking the monolith system is a conscious effort made by the team to reduce the bottlenecks and increase the syste…


This content originally appeared on Bits and Pieces - Medium and was authored by Sahil Shethiya

Things to keep in mind while breaking a monolithic system down to microservices

First things first, monolith systems are never the enemy.

Breaking the monolith system is a conscious effort made by the team to reduce the bottlenecks and increase the system scalability, ability to release into production frequently without disturbing other modules and to loosely couple different modules with high cohesion.

Set a Goal

You just don’t win by having microservices-based architecture, you never know the true pain until microservices are live in production and a ticket is generated.

💡 Microservices can be complex — but making the right decisions on identifying and isolating each microservice is half the battle. Treating the microservices architecture like composable building blocks is key, and it’s made easier with a tool like Bit which allows your teams to independently publish, version, document, test, and share individual components such as functions, UI elements, or data models, that can be reused across multiple microservices. This can greatly reduce the duplication of code and increase the modularity and scalability of your system.

Learn more here:

Component-Driven Microservices with NodeJS and Bit

Start Small

Instead of focusing on the entire application, focus on one small part of the application (for example, a simple email service) which is easy to detangle or can be a separate entity, ask yourself what benefits you’ll get from these microservices and if it’s even worth considering as a microservice?

Fast forward, once identified and developed as a separate microservice run both the monolith service and microservice in parallel without affecting production and compare to see if it yields the same result or not. If after several tries, you’re not getting the expected result, just stop right there it’s not worth it.

However, if you’re able to succeed we need to make sure to score some quick wins under our belt since it’s a long journey and we need to keep stack-holders on our side. Most of the time, only the parts of the monolith system are turned into microservices architecture while the rest remains as a monolith and both can be run in parallel if redirecting of traffic and files are done correctly.

Step by Step Decomposition on different modules.

Of course, any production live application would have different modules tightly integrated with each other. So where to start? There are only three different components: UI, backend and data. Extracting the UI from the backend is considered a separate step since it isn’t always possible that one UI is mapped to just microservices and mapping can be 4:1 or even 1:4.

Basically, identify a UI Component which is currently a bottleneck in the monolith system and start there. However, turning a backend service into a monolith is quicker than UI Integration. Will see why later. Now with the backend, we need to identify the code part or data part that would be converted first to a microservice.

Code First.

Let’s try and break down the code of a backend monolith into microservices. We’ll keep the database operations inside the monolith application for now. Firstly, we need to make sure the code we implemented serves the request the same way the current application does. We can assert via finite state machines and end-result comparisons. If we found it impossible to extract the code cleanly, it’s impossible to do rest of the parts. We need to do the sketch work to identify first before actual implementation and have a Q&A with the team.

Data First.

Integrating the data part first would allow you to deal with different kinds of issues such as data enforcement, transaction concurrency, and loss of ACID properties since the data is treated as a separate entity and we can have multiple microservices dealing with the data microservice the same time and the properties which where handled by the database would need to be implemented via application code if necessary. This can be a useful heads-up for our journey further.

Performance issues.

Since different parts of databases, would be handled by different microservices and operations are moved up from the data tier into microservices. We would need to join operations in many cases to retrieve information based on ID from another table.

For this to be implemented, we would need to call the microservice handling the data. This would create the select statement in the second microservice and the data will be provided back to the calling microservice.

So the simple join inside the database which was done before now needs three additional steps every time. Data Caching is a good example at the microservice level, but this creates an additional need for storage and purging. And it’s unlikely to be fast.

From monolithic to composable software with Bit

Bit’s open-source tool help 250,000+ devs to build apps with components.

Turn any UI, feature, or page into a reusable component — and share it across your applications. It’s easier to collaborate and build faster.

Learn more

Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:

Micro-Frontends

Design System

Code-Sharing and reuse

Monorepo

Learn more


Monolith to Microservices: Things to Consider was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Bits and Pieces - Medium and was authored by Sahil Shethiya


Print Share Comment Cite Upload Translate Updates
APA

Sahil Shethiya | Sciencx (2023-04-04T03:12:31+00:00) Monolith to Microservices: Things to Consider. Retrieved from https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/

MLA
" » Monolith to Microservices: Things to Consider." Sahil Shethiya | Sciencx - Tuesday April 4, 2023, https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/
HARVARD
Sahil Shethiya | Sciencx Tuesday April 4, 2023 » Monolith to Microservices: Things to Consider., viewed ,<https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/>
VANCOUVER
Sahil Shethiya | Sciencx - » Monolith to Microservices: Things to Consider. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/
CHICAGO
" » Monolith to Microservices: Things to Consider." Sahil Shethiya | Sciencx - Accessed . https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/
IEEE
" » Monolith to Microservices: Things to Consider." Sahil Shethiya | Sciencx [Online]. Available: https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/. [Accessed: ]
rf:citation
» Monolith to Microservices: Things to Consider | Sahil Shethiya | Sciencx | https://www.scien.cx/2023/04/04/monolith-to-microservices-things-to-consider/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.