DEV Community

Panupog Chamsomboon
Panupog Chamsomboon

Posted on

Monolithic vs Microservice, What do you choose?

I have already work software devlopment and my repository is Devops engineer. My company have devlopment process is agile, devops cuture and microservice for develop application in company.

I have a question that what do you choose monolithic or micro service for devlop software application.

Thank you for The book Microservice patterns
(https://www.amazon.com/Microservices-Patterns-examples-Chris-Richardson/dp/1617294543)
In the chapter one in the book make good decision for my result and The have many recommendation about implement, testing and deployment for you start develop microservice application.

Monolithic Architecture

Monolithic Architecture

picture from book Microservice pattern(page 3)


A monolithic architecture is the traditional unified model for the design of a software program and compose business logic application for the one source code and one service.
(https://whatis.techtarget.com/definition/monolithic-architecture)

Benefit of Monolithic Architecture

  • Simple to develop IDEs and other developer tools are focused on building a single application.
  • Easy to make radical changes to the application You can change the code and the database schema, build, and deploy.
  • Straightforward to test The developers wrote unit test, end-to-end tests that launched the application in one source code.
  • Straightforward to deploy have one source code for build and deploy result in easy to deploy (for small application I love it.)
  • Easy to scale can ran multiple instances of the application behind a load balancer(application sohuld be stateless. about stateless/stateful -> https://www.redhat.com/en/topics/cloud-native-apps/stateful-vs-stateless)

Drawback of Monolithic Architecture

  • hard process develop for the big team imagin you have 100 developers in project. you have 50 or more commit, merging or pull request every day. they make overhaed process for you.
  • slow deployment when big source code very log for build, complie, deploy and testing.
  • hard for mange resource some bussiness logic code use a lot of resource such as generate report feature. you can't separate resource becase all bussiness logic store in same place source code
  • effect of compiled code broken some devloper make some broker code in source code result in all compiled code broken.
  • technology stack block example you have java application and have new feature. You try implement application with golang for new feature and golang application have performance and manage resource more than java application but you can't adapt to main application becase your main application is compiled with JAVA.

Productivity in Sofware Architecture

Productivity in Sofware Architecture

(https://martinfowler.com/bliki/MicroservicePremium.html)

In the picture you can see when you implement software with monolithic such as add feature or refactor code when source code is big you have a long time to compile unit test and build source code result in make one ploblem for slow producitvity but you implement software with microserivce same way like. The time conpile and build focus in new feature code or refactor code and not make effect of other service result and about git management you can separate source code and developer teams help you for reduce manage git such as many commit and pull request.

All about of deployment time and proess development result in microservice faster productivity than monolic when your application is growing fallow the picture.

Microservice Architecture

Microservice Architecture

picture from book Microservice pattern(page 13)


Microservices is an architectural style that structures an application as a collection of services that are

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities
  • Owned by a small team

(https://microservices.io/)

Benefit of Micro Architecture

  • it enable the continuous delivery and deployment enable for CI/CD tools for deployment
  • Service are small easily maintained
  • Service are independency deployable about deployment you shouldn't recompile all service.
  • Service are independency scalable when one service scale all service needn't scale.
  • enable for separate team you can separate big team to many small team for implement and manage each service.
  • allow easy experimenting and adoption of new technologies you can separate service and team for implementing new framwork or new programing language.
  • increase reliability when some service is down but other service can still working.

Drawback of Micro Architecture

  • finding the right set of services is challenging
  • increase complex distributed systems are complex, which makes development, testing, and deployment difficult
  • increase networking traffic complex deploying features that span multiple services requires careful coordination.
  • adopt the microservice architecture is difficult micro service help your solution for you have big source code and big team developer but about many process suach as testing process, reliable of build ACID transaction process, deployment process and orther are change from monolithic result in difficult for adopt.

Conclusion

When you have a small project, demo project and small team monolithic architecture is a good way to use in devlop your software architecture. when your project is growing, a lot of feature is coming or you'll have a big team. Microservice architect is one of good way solution to adopt your software architecture development but when your adaopt you have a new many process develop and maintain your application and The book Microservice patterns (https://www.amazon.com/Microservices-Patterns-examples-Chris-Richardson/dp/1617294543) is one of good resource for help you develop application with microservice.

Top comments (1)

Collapse
 
andreidascalu profile image
Andrei Dascalu

Monolith are NOT simple to scale. The fact that you can run them in a scaling architecture doesn't mean it's easy. It's actually hard due to several reasons:

  • it's very difficult to reliably measure real espurce consumption. You can deploy them on dedicated vms with dedicated resources in the way of 1 Monolith =1 VM and add more as needed but it's neither fast nor efficient to do so ( some resource waste is unavoidable, on the fly provisioning can't match up peak demand or address spikes)
  • single code bases can become very large depending on application type which also affects the ability to deploy

They are NOT easy to develop.
You need to sync work from many people on the same code base to orchestrate a deploy. Whereas for a microservice you can do targeted changes and deploy fast, monoliths need a lot of preemptive integration work before deploys (microservice need that continuously but it doesn't affect the act of deploying)