Architecture Patterns: Monolithic Architecture vs Microservices Architecture
Monolithic Architecture
In Monolithic Architecture everything is tightly coupled (UI, Business logic and database schema)?together.
Advantages
Disadvantages
Use cases
Monolithic architecture is well suited for small applications that don't require high scalability.
Microservices Architecture
In Microservices Architecture the entire application is divided into small loosely coupled services.
领英推荐
Communication
Services communicate with each other
Synchronous: using API calls or gRPC but this type of communic ation makes services dependant on each other and if one service is down the dependent service on it works incorrectly and the performance of this type of communication is slow down.
Asynchronous: using message brokers (RabbitMQ, Kafka, ActiveMQ...) and this type of communication makes services independent of each other.
Scalability
In Microservices Architecture each service can be scalable independent other services.
Deployment
In Microservices Architecture each service can be deployed independent other services.
Data layer
Database per service: each service has its own database and in this option each service works independently and if one service down other services work correctly but in this option has challenges in making distributed transactions and ensuring consistency of data between services,
Shared Database: there is one database shared between services and In this option making trans- actions is simple but this makes scaling is limited.
Development
In Microservices Architecture each service can be developed with a different technology stack and this adds more flexibility but makes development slow and complex.