Monolithic is built as a single large system and typically has a single code base.
Typically single large shared database for the entire application.
Tightly Coupled, an Entire system has to be developed using the same tech stack and language. Difficult to change technology, language, and frameworks as it needs to change the whole solution at a time
It’s not easy to scale on demand
Microservices are smaller independent services that hold a single responsibility principle (SRP).
Typically each service will have its own database.
Loosely Coupled, Provide flexibility to develop each service in different tech stack and language, and later it’s easy to change the technology, language, and framework as each module is independent.
Easy to scale on demand
Microservices are more cost-effective to create, update, scale and support when compared to monolithic. Microservices are usually developed at a faster pace as parallel teams can work on each service hence increasing productivity. They provide reusable, scalable, and independently developed services, as well as simple and lightweight messaging systems and protocols
Development – With Microservices multiple teams can work independently on different services, enabling you to deploy more quickly when compared to the monolith. Development time is reduced, and the code is more reusable. By decoupling services, you won’t have to operate on expensive machines.
Performance – If built properly using proper design patterns microservices are faster compared to the monolith and each of them can be scaled at the microservice level. On the other hand, microservices with too many services can decrease the performance of the application as it increases the latency. A Monolith system is usually a large single application and database which reduces latency and roundtrips and hence increases performance.
For the majority of firms, microservices will open up an exciting future of possibilities in application development and maintenance. However, microservices may not necessarily replace monolithic architecture. For small and less complex applications, monolithic will continue to be a better choice.
- Domain Driven Design
- Loose Coupling
- Single Responsibility Principle
- Fault Tolerance
- Componentization via services
- Continuous Delivery through DevOps culture
A microservices architecture does not dictate the use of containers. Netflix, for example, runs its entire microservices-based offering on Amazon Web Services, using AWS instances. But most organizations that move to microservices architectures will find containers a more congenial way to implement their applications.
Netflix is one of the first companies to have successfully migrated from a traditional monolithic to cloud-based microservices architecture.
The main reason why Netflix had decided to move to the cloud was due to its rapidly increasing data and user information that it was hard to store in its current data centers, which caused a huge deal of problems.
The solution was accomplished using Amazon Web Service (AWS), which promised to provide large computing resources and data centers with guaranteed security and reliability. With AWS scaling can be done within a couple of minutes without any user involvement.
While moving to the cloud, Netflix managed to split its single monolithic application into hundreds of small loosely coupled services. Today Netflix has over 1000 microservices, each managing a separate part of the site.
- API Gateway
- Chained or Chain of Responsibility
- Asynchronous Messaging
- Database or Shared Data
- Event Sourcing
- Command Query Responsibility Segregator
- Circuit Breaker
With Spring Boot, your microservices can start small and iterate fast. That’s why it has become the de facto standard for Java™ microservices. Quickstart your project with Spring Initializr and then package it as a JAR. With Spring Boot’s embedded server model, you’re ready to go in minutes.
- The Single Responsibility Principle
- Have a separate data store(s) for your microservice
- Use asynchronous communication to achieve loose coupling
- Fail fast by using a circuit breaker to achieve fault tolerance
- Proxy your microservice requests through an API Gateway
- Ensure your API changes are backwards compatible
- Version your microservices for breaking changes
- Have dedicated infrastructure hosting your microservice
- Create a separate release train
- Create Organizational Efficiencies
A microservice-based architecture may have from 10 to 100 or more services. An API gateway can help provide a unified entry point for external consumers, independent of the number and composition of internal microservices
- Make your microservices architecture secure by design
- Scan for dependencies
- Use HTTPS everywhere
- Use access and identity tokens
- Encrypt and protect secrets
- Scan container images for vulnerabilities and bugs
- Implement authentication and authorization features
- Employ TLS everywhere
- Rotate your encryption keys to mitigate vulnerabilities
- Use network policies to limit traffic between pods
Yes. Monolithic apps can talk with microservices if their endpoints are reachable within the infrastructure or securely using a public endpoint. Microservices and their data can either be consumed synchronously via their endpoints or asynchronously through messaging like the Event Bus.
- Warm Up with a Simple and Fairly Decoupled Capability.
- Minimize Dependency Back to the Monolith.
- Split Sticky Capabilities Early.
- Decouple Vertically and Release the Data Early.
- Decouple What is Important to the Business and Changes Frequently.
- Decouple Capability and not Code.
- Go Macro First, then Micro.
- Migrate in Atomic Evolutionary Steps